Skip to content

Commit

Permalink
Merge 0.4.3 into QWebEngineView
Browse files Browse the repository at this point in the history
  • Loading branch information
KrisCris committed Apr 5, 2024
2 parents bb0f762 + 093a233 commit 0c704b2
Show file tree
Hide file tree
Showing 16 changed files with 263 additions and 105 deletions.
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
include src/palworld_pal_editor/assets/*
include src/palworld_pal_editor/assets/data/*
include src/palworld_pal_editor/assets/icons/elements/*
include src/palworld_pal_editor/assets/icons/pals/*
include src/palworld_pal_editor/webui/*
include src/palworld_pal_editor/webui/assets/*
include src/palworld_pal_editor/webui/icons/*
24 changes: 16 additions & 8 deletions README.cn.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
# Palworld Pal Editor

<p align="center">
<h3 align="center">
<a href="/README.md">English</a> | <strong>简体中文</strong>
</p>
</h3>

<p align='center'>
<a href="https://github.com/KrisCris/Palworld-Pal-Editor"><img alt="GitHub Repo Stars" src="https://img.shields.io/github/stars/KrisCris/Palworld-Pal-Editor?style=for-the-badge"></a>&nbsp;&nbsp;
<a href="https://github.com/KrisCris/Palworld-Pal-Editor/releases/latest"><img alt="GitHub Repo Downloads" src="https://img.shields.io/github/downloads/KrisCris/Palworld-Pal-Editor/total?style=for-the-badge"></a>&nbsp;&nbsp;
<a href="https://discord.gg/FnuA95nMJ8"><img alt="Discord Server" src="https://dcbadge.vercel.app/api/server/FnuA95nMJ8"></a>&nbsp;&nbsp;
<img alt="Python" src="https://img.shields.io/badge/Python-FFD43B?style=for-the-badge&logo=python&logoColor=blue">&nbsp;&nbsp;
<img alt="Vue.js" src="https://img.shields.io/badge/Vue%20js-35495E?style=for-the-badge&logo=vuedotjs&logoColor=4FC08D">&nbsp;&nbsp;
<a href="https://github.com/KrisCris/Palworld-Pal-Editor"><img alt="GitHub Repo Stars" src="https://img.shields.io/github/stars/KrisCris/Palworld-Pal-Editor?style=for-the-badge"></a>&nbsp;
<a href="https://github.com/KrisCris/Palworld-Pal-Editor/releases/latest"><img alt="GitHub Release" src="https://img.shields.io/github/v/release/kriscris/palworld-pal-editor?display_name=tag&style=for-the-badge"></a>
<a href="https://github.com/KrisCris/Palworld-Pal-Editor/releases/latest"><img alt="GitHub Repo Downloads" src="https://img.shields.io/github/downloads/KrisCris/Palworld-Pal-Editor/total?style=for-the-badge"></a>&nbsp;
</p>
<p align='center'>
<img alt="Python" src="https://img.shields.io/badge/Python-FFD43B?style=for-the-badge&logo=python&logoColor=blue">&nbsp;
<a href="https://pypi.org/project/palworld-pal-editor/"><img alt="PyPI - Version" src="https://img.shields.io/pypi/v/palworld-pal-editor?style=for-the-badge"></a>&nbsp;
<a href="https://pypi.org/project/palworld-pal-editor/"><img alt="PyPI - Downloads" src="https://img.shields.io/pypi/dd/palworld-pal-editor?style=for-the-badge&label=PYPI%20DOWNLOADS"></a>&nbsp;
</p>
<p align='center'>
<a href="https://discord.gg/FnuA95nMJ8"><img alt="Discord Server" src="https://dcbadge.vercel.app/api/server/FnuA95nMJ8"></a>&nbsp;
</p>

## 支持的语言
Expand All @@ -25,9 +31,11 @@

### 幻兽帕鲁 帕鲁 编辑器

<https://www.bilibili.com/video/av1001846154>
<https://www.bilibili.com/video/av1952608324>

> [!NOTE]
> Steam 本地游戏存档文件夹: `%localappdata%\Pal\Saved\SaveGames`
>
> **本工具目前只支持Steam,如果你使用的是Xbox Game Pass版本,可以参考一下两个工具来转换存档格式:**
>
> - [XGP-save-extractor (XGP -> Steam)](https://github.com/windwq/XGP-save-extractor)
Expand Down
25 changes: 18 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
# Palworld Pal Editor

<p align="center">
<h3 align="center">
<strong>English</strong> | <a href="/README.cn.md">简体中文</a>
</p>
</h3>

<p align='center'>
<a href="https://github.com/KrisCris/Palworld-Pal-Editor"><img alt="GitHub Repo Stars" src="https://img.shields.io/github/stars/KrisCris/Palworld-Pal-Editor?style=for-the-badge"></a>&nbsp;&nbsp;
<a href="https://github.com/KrisCris/Palworld-Pal-Editor/releases/latest"><img alt="GitHub Repo Downloads" src="https://img.shields.io/github/downloads/KrisCris/Palworld-Pal-Editor/total?style=for-the-badge"></a>&nbsp;&nbsp;
<a href="https://discord.gg/FnuA95nMJ8"><img alt="Discord Server" src="https://dcbadge.vercel.app/api/server/FnuA95nMJ8"></a>&nbsp;&nbsp;
<img alt="Python" src="https://img.shields.io/badge/Python-FFD43B?style=for-the-badge&logo=python&logoColor=blue">&nbsp;&nbsp;
<img alt="Vue.js" src="https://img.shields.io/badge/Vue%20js-35495E?style=for-the-badge&logo=vuedotjs&logoColor=4FC08D">&nbsp;&nbsp;
<a href="https://github.com/KrisCris/Palworld-Pal-Editor"><img alt="GitHub Repo Stars" src="https://img.shields.io/github/stars/KrisCris/Palworld-Pal-Editor?style=for-the-badge"></a>&nbsp;
<a href="https://github.com/KrisCris/Palworld-Pal-Editor/releases/latest"><img alt="GitHub Release" src="https://img.shields.io/github/v/release/kriscris/palworld-pal-editor?display_name=tag&style=for-the-badge"></a>
<a href="https://github.com/KrisCris/Palworld-Pal-Editor/releases/latest"><img alt="GitHub Repo Downloads" src="https://img.shields.io/github/downloads/KrisCris/Palworld-Pal-Editor/total?style=for-the-badge"></a>&nbsp;
</p>
<p align='center'>
<img alt="Python" src="https://img.shields.io/badge/Python-FFD43B?style=for-the-badge&logo=python&logoColor=blue">&nbsp;
<a href="https://pypi.org/project/palworld-pal-editor/"><img alt="PyPI - Version" src="https://img.shields.io/pypi/v/palworld-pal-editor?style=for-the-badge"></a>&nbsp;
<a href="https://pypi.org/project/palworld-pal-editor/"><img alt="PyPI - Downloads" src="https://img.shields.io/pypi/dd/palworld-pal-editor?style=for-the-badge&label=PYPI%20DOWNLOADS"></a>&nbsp;
</p>
<p align='center'>
<a href="https://discord.gg/FnuA95nMJ8"><img alt="Discord Server" src="https://dcbadge.vercel.app/api/server/FnuA95nMJ8"></a>&nbsp;
</p>


## Supported Language

Expand All @@ -25,9 +32,13 @@

### A Palworld Pal Editor developed by _connlost with ❤️

<https://youtu.be/v9U60jj5Ugw>

~~(yeah i am just too lazy to change github username)~~

> [!NOTE]
> Steam Local Save Dir: `%localappdata%\Pal\Saved\SaveGames`
>
> **This tool currently only supports the Steam version of Palworld, if you are playing the Xbox Game Pass version, you can look into these two tools for save format conversion:**
>
> - [XGP-save-extractor (XGP -> Steam)](https://github.com/windwq/XGP-save-extractor)
Expand Down
23 changes: 16 additions & 7 deletions frontend/palworld-pal-editor-webui/src/components/PalEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ function formatString(input) {
return formatted;
}
function filterInvalid(list) {
return list.filter(item => {
if (palStore.HIDE_INVALID_OPTIONS) {
// return !(item.Invalid || item.IsHuman)
return !item.Invalid
}
return true
})
}
</script>

<template>
Expand All @@ -37,18 +47,17 @@ function formatString(input) {
<div class="item flex-v left">
<p class="cat">BASIC INFO</p>
<div class="editField">
<!-- <p class="const"> Specie: {{ palStore.displayPalElement(palStore.SELECTED_PAL_DATA.DataAccessKey) }} {{
<p class="const"> Species: {{ palStore.displayPalElement(palStore.SELECTED_PAL_DATA.DataAccessKey) }} {{
palStore.PAL_STATIC_DATA[palStore.SELECTED_PAL_DATA.DataAccessKey]?.I18n || palStore.SELECTED_PAL_DATA.DataAccessKey}}
</p> -->
<p class="const"> Specie: </p>
</p>
<!-- <p class="const"> Specie: </p> -->
<select class="selector" name="CharacterID" v-model="palStore.SELECTED_PAL_DATA.DataAccessKey">
<option class="" v-for="pal in palStore.PAL_STATIC_DATA_LIST" :value="pal.InternalName"
:key="pal.InternalName" :title="pal.I18n"> {{ `
<option class="" v-for="pal in filterInvalid(palStore.PAL_STATIC_DATA_LIST)" :value="pal.InternalName" :key="pal.InternalName" :title="pal.I18n"> {{ `
${formatString(pal.SortingKey) || ""}
${pal.Invalid ? '' : ""}
${palStore.displayPalElement(pal.InternalName)}
${pal.I18n}`
}}</option>
}} </option>
</select>
<button class="edit" @click="palStore.SELECTED_PAL_DATA.changeSpecie" name="CharacterID"
:disabled="palStore.LOADING_FLAG"></button>
Expand Down Expand Up @@ -262,7 +271,7 @@ function formatString(input) {
<div class="editField">
<select class="selector" name="add_MasteredWaza" v-model="palStore.PAL_ACTIVE_SELECTED_ITEM">
<option value="" key="">Add Skills</option>
<option v-for="skill in palStore.ACTIVE_SKILLS_LIST" :value="skill.InternalName" :key="skill.InternalName"
<option v-for="skill in filterInvalid(palStore.ACTIVE_SKILLS_LIST)" :value="skill.InternalName" :key="skill.InternalName"
:title="skill.I18n[1]">
{{ `${palStore.displayElement(skill.Element)} ${skill.I18n[0]} ${palStore.skillIcon(skill.InternalName)} -
⚔️ ${skill.Power} - ⏱️ ${skill.CT}` }}
Expand Down
26 changes: 23 additions & 3 deletions frontend/palworld-pal-editor-webui/src/components/TopBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,28 @@ watch(() => palStore.LOADING_FLAG, (newValue) => {
<button class="op save" @click="palStore.writeSave" :disabled="palStore.LOADING_FLAG">💾 SAVE CHANGES</button>
<button class="op" @click="palStore.loadSave" :disabled="palStore.LOADING_FLAG">🔄 Reload Save</button>
<button class="op" @click="palStore.reset" :disabled="palStore.LOADING_FLAG">🏠 Return to Main Page</button>
<button :class="['op', {'toggled': palStore.SHOW_OOB_PAL_FLAG}]" @click="palStore.SHOW_OOB_PAL_FLAG = !palStore.SHOW_OOB_PAL_FLAG" :disabled="palStore.LOADING_FLAG" title="Display pals that are not in owner player pal containers, i.e. viewing cage, or taken by somebody.">🧊 Show Out of Box Pal</button>
<button :class="['op', {'toggled': palStore.SHOW_UNREF_PAL_FLAG}]" @click="palStore.SHOW_UNREF_PAL_FLAG = !palStore.SHOW_UNREF_PAL_FLAG" :disabled="palStore.LOADING_FLAG">👀 Toggle Ghost Pal</button>

<button
:class="['op', { 'toggled': palStore.SHOW_OOB_PAL_FLAG }]"
@click="palStore.SHOW_OOB_PAL_FLAG = !palStore.SHOW_OOB_PAL_FLAG"
:disabled="palStore.LOADING_FLAG"
title="Display pals that are not in owner player pal containers, i.e. viewing cage, or taken by someone">
🧊 Show Out of Box Pal
</button>

<button
:class="['op', { 'toggled': palStore.SHOW_UNREF_PAL_FLAG }]"
@click="palStore.SHOW_UNREF_PAL_FLAG = !palStore.SHOW_UNREF_PAL_FLAG"
:disabled="palStore.LOADING_FLAG"
title="Show ghost pals, those no longer can be found in game, i.e. sold, dropped, butchered.">
👀 Toggle Ghost Pal
</button>
<button
:class="['op', { 'toggled': palStore.HIDE_INVALID_OPTIONS }]"
@click="palStore.HIDE_INVALID_OPTIONS = !palStore.HIDE_INVALID_OPTIONS"
:disabled="palStore.LOADING_FLAG"
title="Hide invalid dropdown menu options">
⚠️ Hide Invalid Options</button>
</div>
<div class="options">
<p>🌐</p>
Expand Down Expand Up @@ -100,7 +120,7 @@ input.savePath {
align-items: center;
background-color: #34353a;
height: 1.8rem;
width: 40vw;
max-width: 30vw;
margin: .2rem;
padding: .2rem .4rem;
border-radius: .5rem;
Expand Down
12 changes: 7 additions & 5 deletions frontend/palworld-pal-editor-webui/src/stores/paleditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ export const usePalEditorStore = defineStore("paleditor", () => {
const UPDATE_PAL_RESELECT_CTR = ref(0);
const SHOW_UNREF_PAL_FLAG = ref(false);
const SHOW_OOB_PAL_FLAG = ref(true);
const HIDE_INVALID_OPTIONS = ref(true)

const PAL_LIST_SEARCH_KEYWORD = ref("")

Expand All @@ -275,7 +276,7 @@ export const usePalEditorStore = defineStore("paleditor", () => {
const I18n = ref(localStorage.getItem("PAL_I18n"));
const PAL_GAME_SAVE_PATH = ref(localStorage.getItem("PAL_GAME_SAVE_PATH"));
const HAS_PASSWORD = ref(false);
const IS_GUI = ref(false)
const FilePickerAvailable = ref(false)
const PAL_WRITE_BACK_PATH = ref("");

// auth
Expand Down Expand Up @@ -437,7 +438,7 @@ export const usePalEditorStore = defineStore("paleditor", () => {
PAL_GAME_SAVE_PATH.value = response.data.Path;
}
HAS_PASSWORD.value = response.data.HasPassword;
IS_GUI.value = response.data.Mode == "gui"
FilePickerAvailable.value = response.data.FilePickerAvailable
// console.log(I18n.value, PAL_GAME_SAVE_PATH.value, HAS_PASSWORD.value, IS_GUI.value);
} else if (response.status == 2) {
alert("Unauthorized Access, Please Login. ");
Expand All @@ -451,7 +452,7 @@ export const usePalEditorStore = defineStore("paleditor", () => {
}

async function show_file_picker() {
if (!IS_GUI.value) {
if (!FilePickerAvailable.value) {
alert("This only works in GUI mode!")
return;
}
Expand Down Expand Up @@ -1167,12 +1168,13 @@ export const usePalEditorStore = defineStore("paleditor", () => {
UPDATE_PAL_RESELECT_CTR,
SHOW_UNREF_PAL_FLAG,
SHOW_OOB_PAL_FLAG,

HIDE_INVALID_OPTIONS,

PAL_LIST_SEARCH_KEYWORD,

IS_LOCKED,
HAS_PASSWORD,
IS_GUI,
FilePickerAvailable,

HAS_WORKING_PAL_FLAG,
BASE_PAL_BTN_CLK_FLAG,
Expand Down
2 changes: 1 addition & 1 deletion frontend/palworld-pal-editor-webui/src/views/EntryView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const palStore = usePalEditorStore()
<input type="text" v-model="palStore.PAL_GAME_SAVE_PATH"
placeholder="/Path/To/PalServer/Pal/Saved/SaveGames/0/HEXHEXHEXHEXHEX"
:disabled="palStore.LOADING_FLAG">
<button class="pathSelect" @click="palStore.show_file_picker" v-if="palStore.IS_GUI">Select Path</button>
<button class="pathSelect" @click="palStore.show_file_picker" v-if="palStore.FilePickerAvailable">Select Path</button>
<button @click="palStore.loadSave" :disabled="palStore.LOADING_FLAG">Load Save</button>
</div>
</div>
Expand Down
52 changes: 52 additions & 0 deletions pypi_publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
if which npm > /dev/null; then
NPM_CMD=npm
else
echo "Node is not installed."
fi

cd "./frontend/palworld-pal-editor-webui"
${NPM_CMD} install
${NPM_CMD} run build
cd "../../"
rm -r "./src/palworld_pal_editor/webui"
mv "./frontend/palworld-pal-editor-webui/dist" "./src/palworld_pal_editor/webui"

# Check for Python 3.x and set the appropriate command
if which python3 > /dev/null; then
PYTHON_CMD=python3
elif which python > /dev/null; then
PYTHON_CMD=python
else
echo "Python is not installed."
exit 1
fi

# Extract the Python version
PYTHON_VERSION=$(${PYTHON_CMD} --version | awk '{print $2}')
PYTHON_MAJOR_VERSION=$(echo ${PYTHON_VERSION} | cut -d. -f1)
PYTHON_MINOR_VERSION=$(echo ${PYTHON_VERSION} | cut -d. -f2)

# Check if Python version is 3.11 or newer
if [ "${PYTHON_MAJOR_VERSION}" -lt 3 ] || { [ "${PYTHON_MAJOR_VERSION}" -eq 3 ] && [ "${PYTHON_MINOR_VERSION}" -lt 11 ]; }; then
echo "Python version 3.11 or newer is required."
exit 1
fi

echo "Using ${PYTHON_CMD} (version ${PYTHON_VERSION})"

# Create a virtual environment named 'venv' (skip if already created)
${PYTHON_CMD} -m venv venv

# Activate the virtual environment
source venv/bin/activate

# Install packages from requirements.txt
pip install -r requirements.txt

pip install twine
pip install --upgrade build

rm -r "./dist"

python -m build
python -m twine upload dist/*
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ keywords = ["palworld", "editor", "pal"]
license = {file = "LICENSE"}
requires-python = ">=3.11"
readme = "README.md"
version = "0.4.1"
version = "0.4.3"
dependencies = [
"setuptools==69.1.0",
"palworld_save_tools==0.19.0",
Expand Down
38 changes: 27 additions & 11 deletions src/palworld_pal_editor/api/save.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,22 @@

@save_blueprint.route("/fetch_config", methods=["GET"])
def fetch_config():
tk_status = False
if Config.mode == "gui":
try:
import tkinter as tk
tk_status = True
except:
trace = traceback.format_exc()
LOGGER.error(f"Hiding File Picker Since It Will Not Work: {trace}")

return reply(
0,
{
"I18n": Config.i18n,
"Path": Config.path,
"HasPassword": Config.password != None,
"Mode": Config.mode
"FilePickerAvailable": Config.mode == "gui" and tk_status
},
)

Expand Down Expand Up @@ -143,6 +152,7 @@ def get_pal_data():
"I18n": DataProvider.get_pal_i18n(pal["InternalName"])
or pal["InternalName"],
"SortingKey": DataProvider.get_pal_sorting_key(pal["InternalName"]),
"IsHuman": DataProvider.is_pal_human(pal["InternalName"]) or False
}
pal_dict[pal["InternalName"]] = data
pal_arr.append(data)
Expand All @@ -156,13 +166,19 @@ def show_file_picker():
LOGGER.warning(msg)
return reply(1, msg=msg)

import tkinter as tk
from tkinter import filedialog

root = tk.Tk()
root.withdraw()
root.attributes('-topmost', True)
folder_selected = filedialog.askdirectory(parent=root)
root.destroy()
LOGGER.info(f"File picker result: {folder_selected}")
return reply(0, {"path": folder_selected})
try:
import tkinter as tk
from tkinter import filedialog

root = tk.Tk()
root.withdraw()
root.attributes('-topmost', True)
folder_selected = filedialog.askdirectory(parent=root)
root.destroy()
LOGGER.info(f"File picker result: {folder_selected}")
return reply(0, {"path": folder_selected})
except:
trace = traceback.format_exc()
LOGGER.error(f"Failed Open File Picker: {trace}")
LOGGER.error(f"Please Manually Type in the Path.")
return reply(1, msg="Failed open file picker (check log for detail), please manually type in the path.")
8 changes: 4 additions & 4 deletions src/palworld_pal_editor/assets/data/pal_attacks.json
Original file line number Diff line number Diff line change
Expand Up @@ -2397,19 +2397,19 @@
"Power": 12,
"I18n": {
"en": {
"Name": "Punch",
"Name": "Punch [Human]",
"Description": "Punch with conviction; believe in the power of the fist."
},
"zh-CN": {
"Name": "击打",
"Name": "击打 [人类]",
"Description": "相信自己的拳头,出拳攻击。"
},
"ja": {
"Name": "パンチ",
"Name": "パンチ [人間]",
"Description": "己の拳を信じて、パンチする。"
}
},
"Invalid": true
"UniqueSkill": true
},
"EPalWazaID::Throw": {
"InternalName": "EPalWazaID::Throw",
Expand Down
Loading

0 comments on commit 0c704b2

Please sign in to comment.