mirror of
https://github.com/Kvan7/Exiled-Exchange-2.git
synced 2025-11-21 08:56:13 +00:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ec3bd80164 | ||
|
|
42a936f84e | ||
|
|
ec43d953a1 | ||
|
|
d3fefea1e4 | ||
|
|
19bea458d9 | ||
|
|
3b1f06497a | ||
|
|
b4ecb2007e | ||
|
|
3740b12fff |
@@ -2,6 +2,7 @@
|
|||||||
"name": "exiled-exchange-2",
|
"name": "exiled-exchange-2",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"lint": "eslint --ext .ts,.vue src",
|
"lint": "eslint --ext .ts,.vue src",
|
||||||
|
|||||||
25
renderer/public/.DS_Store/.gitignore
vendored
25
renderer/public/.DS_Store/.gitignore
vendored
@@ -131,6 +131,8 @@ dist
|
|||||||
|
|
||||||
__pycache__
|
__pycache__
|
||||||
|
|
||||||
|
__pycache__
|
||||||
|
|
||||||
vendor/json-api/*.json
|
vendor/json-api/*.json
|
||||||
vendor/json-api/en/*.json
|
vendor/json-api/en/*.json
|
||||||
vendor/json-api/ru/*.json
|
vendor/json-api/ru/*.json
|
||||||
@@ -142,16 +144,18 @@ vendor/client/descriptions/*
|
|||||||
|
|
||||||
vendor/client/tables/*
|
vendor/client/tables/*
|
||||||
!vendor/client/tables/index.ts
|
!vendor/client/tables/index.ts
|
||||||
|
|
||||||
!vendor/client/tables/ArmourTypesOverride.json
|
!vendor/client/tables/ArmourTypesOverride.json
|
||||||
|
!vendor/client/tables/en/ArmourTypesOverride.json
|
||||||
|
!vendor/client/tables/ru/ArmourTypesOverride.json
|
||||||
|
!vendor/client/tables/ko/ArmourTypesOverride.json
|
||||||
|
!vendor/client/tables/cmn-Hant/ArmourTypesOverride.json
|
||||||
|
|
||||||
!vendor/client/tables/en/.gitkeep
|
!vendor/client/tables/en/.gitkeep
|
||||||
!vendor/client/tables/ru/.gitkeep
|
!vendor/client/tables/ru/.gitkeep
|
||||||
!vendor/client/tables/ko/.gitkeep
|
!vendor/client/tables/ko/.gitkeep
|
||||||
!vendor/client/tables/cmn-Hant/.gitkeep
|
!vendor/client/tables/cmn-Hant/.gitkeep
|
||||||
|
|
||||||
!vendor/client/tables/en/ArmourTypesOverride.json
|
|
||||||
!vendor/client/tables/ru/ArmourTypesOverride.json
|
|
||||||
!vendor/client/tables/ko/ArmourTypesOverride.json
|
|
||||||
!vendor/client/tables/cmn-Hant/ArmourTypesOverride.json
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -162,8 +166,11 @@ vendor/client/tables/*
|
|||||||
!vendor/json-api/cmn-Hant/.gitkeep
|
!vendor/json-api/cmn-Hant/.gitkeep
|
||||||
|
|
||||||
|
|
||||||
EXPORT/tables/English/*.json
|
EXPORT/tables/**/*.json
|
||||||
EXPORT/tables/Korean/*.json
|
vendor/client/tables/*.json
|
||||||
EXPORT/tables/Russian/*.json
|
!vendor/client/tables/ArmourTypesOverride.json
|
||||||
EXPORT/tables/Traditional Chinese/*.json
|
vendor/json-api/*.json
|
||||||
|
vendor/json-api/en/*.json
|
||||||
|
vendor/json-api/ru/*.json
|
||||||
|
vendor/json-api/ko/*.json
|
||||||
|
vendor/json-api/cmn-Hant/*.json
|
||||||
|
|||||||
@@ -2,7 +2,9 @@
|
|||||||
"steam": "C:\\Program Files (x86)\\Steam\\steamapps\\common\\Path of Exile 2",
|
"steam": "C:\\Program Files (x86)\\Steam\\steamapps\\common\\Path of Exile 2",
|
||||||
"translations": [
|
"translations": [
|
||||||
"English",
|
"English",
|
||||||
"Russian"
|
"Russian",
|
||||||
|
"Korean",
|
||||||
|
"Traditional Chinese"
|
||||||
],
|
],
|
||||||
"tables": [
|
"tables": [
|
||||||
{
|
{
|
||||||
|
|||||||
19
renderer/public/.DS_Store/copy-tables.sh
Normal file
19
renderer/public/.DS_Store/copy-tables.sh
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
|
||||||
|
echo "Copying files from EXPORT/tables/English to data/en"
|
||||||
|
cp -R EXPORT/tables/English/* vendor/client/tables/en/
|
||||||
|
|
||||||
|
echo "Copying files from EXPORT/tables/Russian to data/ru"
|
||||||
|
cp -R EXPORT/tables/Russian/* vendor/client/tables/ru/
|
||||||
|
|
||||||
|
echo "Copying files from EXPORT/tables/Korean to data/ko"
|
||||||
|
cp -R EXPORT/tables/Korean/* vendor/client/tables/ko/
|
||||||
|
|
||||||
|
echo "Copying files from EXPORT/tables/Traditional Chinese to data/cmn-Hant"
|
||||||
|
cp -R EXPORT/tables/Traditional\ Chinese/* vendor/client/tables/cmn-Hant/
|
||||||
|
|
||||||
|
echo "Copying not generated files from english to other languages"
|
||||||
|
|
||||||
|
# Copy without overwriting English -> data/ru
|
||||||
|
cp -n vendor/client/tables/en/* vendor/client/tables/ru/
|
||||||
|
cp -n vendor/client/tables/en/* vendor/client/tables/ko/
|
||||||
|
cp -n vendor/client/tables/en/* vendor/client/tables/cmn-Hant/
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
"start": "node dist/index.js",
|
"start": "node dist/index.js",
|
||||||
"items": "ts-node items.ts",
|
"items": "ts-node items.ts",
|
||||||
"stats": "ts-node stats.ts",
|
"stats": "ts-node stats.ts",
|
||||||
"copy-files": "cp -R EXPORT/tables/English/* vendor/client/tables/",
|
"copy-files": "sh ./copy-tables.sh",
|
||||||
"push-ndjson": "bash ./push-ndjson.sh",
|
"push-ndjson": "bash ./push-ndjson.sh",
|
||||||
"anon-vodka-python": "python ./vendor/client/parser.py",
|
"anon-vodka-python": "python ./vendor/client/parser.py",
|
||||||
"langs-anon-vodka-python": "python ./vendor/client/parserRunner.py",
|
"langs-anon-vodka-python": "python ./vendor/client/parserRunner.py",
|
||||||
|
|||||||
147
renderer/public/.DS_Store/vendor/client/parser.py
vendored
147
renderer/public/.DS_Store/vendor/client/parser.py
vendored
@@ -20,6 +20,12 @@ import urllib.parse
|
|||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
|
LANG_CODES_TO_NAMES = {
|
||||||
|
"ru": "Russian",
|
||||||
|
"ko": "Korean",
|
||||||
|
"cmn-Hant": "Traditional Chinese",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class Parser:
|
class Parser:
|
||||||
def get_script_dir(self):
|
def get_script_dir(self):
|
||||||
@@ -27,7 +33,9 @@ class Parser:
|
|||||||
return os.path.dirname(os.path.realpath(__file__))
|
return os.path.dirname(os.path.realpath(__file__))
|
||||||
|
|
||||||
def load_file(self, file):
|
def load_file(self, file):
|
||||||
return json.loads(open(f"{self.base_dir}/{self.lang}/{file}.json").read())
|
return json.loads(
|
||||||
|
open(f"{self.base_dir}/{self.lang}/{file}.json", encoding="utf-8").read()
|
||||||
|
)
|
||||||
|
|
||||||
def __init__(self, lang="en"):
|
def __init__(self, lang="en"):
|
||||||
self.lang = lang
|
self.lang = lang
|
||||||
@@ -47,13 +55,19 @@ class Parser:
|
|||||||
self.mods_file = self.load_file("Mods")
|
self.mods_file = self.load_file("Mods")
|
||||||
# NOTE: could need to add local here?
|
# NOTE: could need to add local here?
|
||||||
self.trade_stats = json.loads(
|
self.trade_stats = json.loads(
|
||||||
open(f"{self.cwd}/../json-api/en/stats.json").read()
|
open(
|
||||||
|
f"{self.cwd}/../json-api/{self.lang}/stats.json", encoding="utf-8"
|
||||||
|
).read()
|
||||||
) # content of https://www.pathofexile.com/api/trade2/data/stats
|
) # content of https://www.pathofexile.com/api/trade2/data/stats
|
||||||
self.trade_items = json.loads(
|
self.trade_items = json.loads(
|
||||||
open(f"{self.cwd}/../json-api/en/items.json").read()
|
open(
|
||||||
|
f"{self.cwd}/../json-api/{self.lang}/items.json", encoding="utf-8"
|
||||||
|
).read()
|
||||||
) # content of https://www.pathofexile.com/api/trade2/data/items
|
) # content of https://www.pathofexile.com/api/trade2/data/items
|
||||||
self.trade_exchange_items = json.loads(
|
self.trade_exchange_items = json.loads(
|
||||||
open(f"{self.cwd}/../json-api/en/static.json").read()
|
open(
|
||||||
|
f"{self.cwd}/../json-api/{self.lang}/static.json", encoding="utf-8"
|
||||||
|
).read()
|
||||||
) # content of https://www.pathofexile.com/api/trade2/data/static
|
) # content of https://www.pathofexile.com/api/trade2/data/static
|
||||||
|
|
||||||
self.items = {}
|
self.items = {}
|
||||||
@@ -115,9 +129,15 @@ class Parser:
|
|||||||
|
|
||||||
self.stats_trade_ids[text][type].append(id)
|
self.stats_trade_ids[text][type].append(id)
|
||||||
|
|
||||||
def parse_mod(self, id, english):
|
def parse_mod(self, id, english, log=False):
|
||||||
|
if log:
|
||||||
|
print(
|
||||||
|
"===================================================================="
|
||||||
|
)
|
||||||
|
print(f"[id:{id}] {english}")
|
||||||
matchers = []
|
matchers = []
|
||||||
ref = None
|
ref = None
|
||||||
|
|
||||||
for lang in english:
|
for lang in english:
|
||||||
lang = self.convert_stat_name(lang)
|
lang = self.convert_stat_name(lang)
|
||||||
|
|
||||||
@@ -151,11 +171,38 @@ class Parser:
|
|||||||
"matchers": matchers,
|
"matchers": matchers,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def parse_translation_line(self, stats_translations, i, id, log=False):
|
||||||
|
if log:
|
||||||
|
print(
|
||||||
|
"===================================================================="
|
||||||
|
)
|
||||||
|
print(f"[i:{i}, id:{id}] {stats_translations[i]}")
|
||||||
|
print(f"[i:{i+1}, id:{id}] {stats_translations[i+1]}")
|
||||||
|
print(f"[i:{i+2}, id:{id}] {stats_translations[i+2]}")
|
||||||
|
print(f"[i:{i+3}, id:{id}] {stats_translations[i+3]}")
|
||||||
|
line = stats_translations[i + 3].strip() # skip first 2 characters
|
||||||
|
start = line.find('"')
|
||||||
|
end = line.rfind('"')
|
||||||
|
line = line[start + 1 : end]
|
||||||
|
|
||||||
|
# convert to array so we can add the negated option later on, if one exists
|
||||||
|
line = [line]
|
||||||
|
|
||||||
|
negate_line = stats_translations[i + 4].strip()
|
||||||
|
if "lang" not in negate_line and "negate" in negate_line:
|
||||||
|
# mod has a negated version
|
||||||
|
end = negate_line.find("negate")
|
||||||
|
negate_line = negate_line[negate_line.find('"') + 1 : end + len("negate")]
|
||||||
|
line.append(negate_line)
|
||||||
|
|
||||||
|
self.parse_mod(id, line, log=log)
|
||||||
|
|
||||||
def parse_translation_file(self, file):
|
def parse_translation_file(self, file):
|
||||||
dir = f"{self.cwd}/descriptions/{file}"
|
dir = f"{self.cwd}/descriptions/{file}"
|
||||||
print("Parsing", dir)
|
print("Parsing", dir)
|
||||||
stats_translations = open(dir, encoding="utf-16").read().split("\n")
|
stats_translations = open(dir, encoding="utf-16").read().split("\n")
|
||||||
for i in range(0, len(stats_translations)):
|
should_log = True
|
||||||
|
for i in range(0, 100):
|
||||||
line = stats_translations[i]
|
line = stats_translations[i]
|
||||||
|
|
||||||
if line == "description":
|
if line == "description":
|
||||||
@@ -163,24 +210,29 @@ class Parser:
|
|||||||
id = (
|
id = (
|
||||||
stats_translations[i + 1].strip()[2:].replace('"', "")
|
stats_translations[i + 1].strip()[2:].replace('"', "")
|
||||||
) # skip first 2 characters
|
) # skip first 2 characters
|
||||||
english = stats_translations[i + 3].strip() # skip first 2 characters
|
if self.lang == "en":
|
||||||
start = english.find('"')
|
self.parse_translation_line(
|
||||||
end = english.rfind('"')
|
stats_translations, i, id, log=should_log
|
||||||
english = english[start + 1 : end]
|
)
|
||||||
|
should_log = False
|
||||||
# convert to array so we can add the negated option later on, if one exists
|
else:
|
||||||
english = [english]
|
j = i
|
||||||
|
while (
|
||||||
negate_english = stats_translations[i + 4].strip()
|
j + 5 < 100
|
||||||
if "lang" not in negate_english and "negate" in negate_english:
|
and stats_translations[j + 1] != "description"
|
||||||
# mod has a negated version
|
and LANG_CODES_TO_NAMES[self.lang]
|
||||||
end = negate_english.find("negate")
|
not in stats_translations[j + 1]
|
||||||
negate_english = negate_english[
|
):
|
||||||
negate_english.find('"') + 1 : end + len("negate")
|
j += 1
|
||||||
]
|
if should_log:
|
||||||
english.append(negate_english)
|
print(
|
||||||
|
f"Parsing [j:{j + 1}, id:{id}] {stats_translations[j + 1]}"
|
||||||
self.parse_mod(id, english)
|
)
|
||||||
|
if stats_translations[j + 1] != "description":
|
||||||
|
self.parse_translation_line(
|
||||||
|
stats_translations, j, id, log=should_log
|
||||||
|
)
|
||||||
|
should_log = False
|
||||||
|
|
||||||
def parse_mods(self):
|
def parse_mods(self):
|
||||||
for stat in self.stats_file:
|
for stat in self.stats_file:
|
||||||
@@ -206,6 +258,7 @@ class Parser:
|
|||||||
translation = self.mod_translations.get(stats_id)
|
translation = self.mod_translations.get(stats_id)
|
||||||
if translation:
|
if translation:
|
||||||
ref = translation.get("ref")
|
ref = translation.get("ref")
|
||||||
|
print(translation)
|
||||||
matchers = translation.get("matchers")
|
matchers = translation.get("matchers")
|
||||||
ids = self.stats_trade_ids.get(matchers[0].get("string"))
|
ids = self.stats_trade_ids.get(matchers[0].get("string"))
|
||||||
# if ref.lower() == "bow attacks fire an additional arrow":
|
# if ref.lower() == "bow attacks fire an additional arrow":
|
||||||
@@ -440,37 +493,41 @@ class Parser:
|
|||||||
if gem:
|
if gem:
|
||||||
out.update({"gem": gem})
|
out.update({"gem": gem})
|
||||||
|
|
||||||
f.write(json.dumps(out) + "\n")
|
f.write(json.dumps(out, ensure_ascii=False) + "\n")
|
||||||
|
|
||||||
for item in self.unique_items:
|
for item in self.unique_items:
|
||||||
f.write(json.dumps(item) + "\n")
|
f.write(json.dumps(item, ensure_ascii=False) + "\n")
|
||||||
|
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
# somehow not a thing? - possibly missing some data
|
# somehow not a thing? - possibly missing some data
|
||||||
self.mods["physical_local_damage_+%"] = {
|
# self.mods["physical_local_damage_+%"] = {
|
||||||
"ref": "#% increased Physical Damage",
|
# "ref": "#% increased Physical Damage",
|
||||||
"better": 1,
|
# "better": 1,
|
||||||
"id": "physical_local_damage_+%",
|
# "id": "physical_local_damage_+%",
|
||||||
"matchers": [{"string": "#% increased Physical Damage"}],
|
# "matchers": [{"string": "#% increased Physical Damage"}],
|
||||||
"trade": {
|
# "trade": {
|
||||||
"ids": {
|
# "ids": {
|
||||||
"explicit": ["explicit.stat_419810844"],
|
# "explicit": ["explicit.stat_419810844"],
|
||||||
"fractured": ["fractured.stat_419810844"],
|
# "fractured": ["fractured.stat_419810844"],
|
||||||
"rune": ["rune.stat_419810844"],
|
# "rune": ["rune.stat_419810844"],
|
||||||
}
|
# }
|
||||||
},
|
# },
|
||||||
}
|
# }
|
||||||
|
|
||||||
seen = set()
|
seen = set()
|
||||||
m = open(f"{self.out_dir}/stats.ndjson", "w", encoding="utf-8")
|
m = open(
|
||||||
|
f"{self.out_dir}/stats.ndjson",
|
||||||
|
"w",
|
||||||
|
encoding="utf-8",
|
||||||
|
)
|
||||||
for mod in self.mods.values():
|
for mod in self.mods.values():
|
||||||
id = mod.get("id")
|
id = mod.get("id")
|
||||||
|
|
||||||
if id in seen:
|
if id in seen:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
m.write(json.dumps(mod) + "\n")
|
m.write(json.dumps(mod, ensure_ascii=False) + "\n")
|
||||||
seen.add(id)
|
seen.add(id)
|
||||||
m.close()
|
m.close()
|
||||||
|
|
||||||
@@ -479,21 +536,23 @@ class Parser:
|
|||||||
"w",
|
"w",
|
||||||
encoding="utf-8",
|
encoding="utf-8",
|
||||||
) as f:
|
) as f:
|
||||||
f.write(json.dumps(self.items, indent=4))
|
f.write(json.dumps(self.items, indent=4, ensure_ascii=False))
|
||||||
|
|
||||||
with open(
|
with open(
|
||||||
f"{self.get_script_dir()}/pyDumps/{self.lang+'-out'}/mods_dump.json",
|
f"{self.get_script_dir()}/pyDumps/{self.lang+'-out'}/mods_dump.json",
|
||||||
"w",
|
"w",
|
||||||
encoding="utf-8",
|
encoding="utf-8",
|
||||||
) as f:
|
) as f:
|
||||||
f.write(json.dumps(self.mods, indent=4))
|
f.write(json.dumps(self.mods, indent=4, ensure_ascii=False))
|
||||||
|
|
||||||
with open(
|
with open(
|
||||||
f"{self.get_script_dir()}/pyDumps/{self.lang+'-out'}/matchers_no_trade_ids.json",
|
f"{self.get_script_dir()}/pyDumps/{self.lang+'-out'}/matchers_no_trade_ids.json",
|
||||||
"w",
|
"w",
|
||||||
encoding="utf-8",
|
encoding="utf-8",
|
||||||
) as f:
|
) as f:
|
||||||
f.write(json.dumps(self.matchers_no_trade_ids, indent=4))
|
f.write(
|
||||||
|
json.dumps(self.matchers_no_trade_ids, indent=4, ensure_ascii=False)
|
||||||
|
)
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.parse_trade_ids()
|
self.parse_trade_ids()
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
40053
renderer/public/.DS_Store/vendor/client/pyDumps/ru-out/items_dump.json
vendored
Normal file
40053
renderer/public/.DS_Store/vendor/client/pyDumps/ru-out/items_dump.json
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
renderer/public/.DS_Store/vendor/client/pyDumps/ru-out/matchers_no_trade_ids.json
vendored
Normal file
1
renderer/public/.DS_Store/vendor/client/pyDumps/ru-out/matchers_no_trade_ids.json
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
[]
|
||||||
25
renderer/public/.DS_Store/vendor/client/pyDumps/ru-out/mods_dump.json
vendored
Normal file
25
renderer/public/.DS_Store/vendor/client/pyDumps/ru-out/mods_dump.json
vendored
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"physical_local_damage_+%": {
|
||||||
|
"ref": "#% increased Physical Damage",
|
||||||
|
"better": 1,
|
||||||
|
"id": "physical_local_damage_+%",
|
||||||
|
"matchers": [
|
||||||
|
{
|
||||||
|
"string": "#% increased Physical Damage"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"trade": {
|
||||||
|
"ids": {
|
||||||
|
"explicit": [
|
||||||
|
"explicit.stat_419810844"
|
||||||
|
],
|
||||||
|
"fractured": [
|
||||||
|
"fractured.stat_419810844"
|
||||||
|
],
|
||||||
|
"rune": [
|
||||||
|
"rune.stat_419810844"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
3059
renderer/public/.DS_Store/vendor/client/pyDumps/ru/items.ndjson
vendored
Normal file
3059
renderer/public/.DS_Store/vendor/client/pyDumps/ru/items.ndjson
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
renderer/public/.DS_Store/vendor/client/pyDumps/ru/stats.ndjson
vendored
Normal file
1
renderer/public/.DS_Store/vendor/client/pyDumps/ru/stats.ndjson
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"ref": "#% increased Physical Damage", "better": 1, "id": "physical_local_damage_+%", "matchers": [{"string": "#% increased Physical Damage"}], "trade": {"ids": {"explicit": ["explicit.stat_419810844"], "fractured": ["fractured.stat_419810844"], "rune": ["rune.stat_419810844"]}}}
|
||||||
@@ -704,7 +704,7 @@ export async function requestTradeResultList(
|
|||||||
{
|
{
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Accept": "application/json",
|
Accept: "application/json",
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
},
|
},
|
||||||
body: JSON.stringify(body),
|
body: JSON.stringify(body),
|
||||||
|
|||||||
Reference in New Issue
Block a user