Fixed: item names
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -22,22 +22,20 @@ from PySide2 import QtGui
|
|||||||
from PySide2 import QtCore
|
from PySide2 import QtCore
|
||||||
|
|
||||||
from . import weapon
|
from . import weapon
|
||||||
|
from . import names
|
||||||
from . import assets
|
from . import assets
|
||||||
from . import async_request
|
from . import async_request
|
||||||
|
|
||||||
Style = collections.namedtuple('Style', 'bg')
|
Style = collections.namedtuple('Style', 'bg')
|
||||||
|
|
||||||
def weapon_info(items):
|
enchant_re = re.compile(r"(.*)@(\d+)")
|
||||||
tier_re = re.compile(r"(T\d+).*")
|
def map_name(name):
|
||||||
enchant_re = re.compile(r".*@(\d+)")
|
|
||||||
|
match = enchant_re.match(name)
|
||||||
|
if match:
|
||||||
|
return names.map_name(match[1])
|
||||||
|
|
||||||
if 'weapon' in items:
|
return names.map_name(name)
|
||||||
tier = tier_re.match(items['weapon'])
|
|
||||||
enchant = enchant_re.match(items['weapon'])
|
|
||||||
if tier:
|
|
||||||
return f'{tier[1] if tier else ""}@{enchant[1] if enchant else 0}'
|
|
||||||
|
|
||||||
return ''
|
|
||||||
|
|
||||||
# T8_MAIN_NATURESTAFF@3
|
# T8_MAIN_NATURESTAFF@3
|
||||||
# T8_MAIN_NATURESTAF
|
# T8_MAIN_NATURESTAF
|
||||||
@@ -120,7 +118,7 @@ class DmgList(QListView):
|
|||||||
|
|
||||||
self.setBackground(brush)
|
self.setBackground(brush)
|
||||||
icon = player_icon(self.player.items['weapon'])
|
icon = player_icon(self.player.items['weapon'])
|
||||||
self.setToolTip('\n'.join([f'{k}: {v}' for (k,v) in self.player.items.items() if v]))
|
self.setToolTip('\n'.join([f'{k}: {map_name(v)}' for (k,v) in self.player.items.items() if v]))
|
||||||
if icon:
|
if icon:
|
||||||
self.setIcon(icon)
|
self.setIcon(icon)
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
import json
|
||||||
|
|
||||||
|
from . import assets
|
||||||
|
|
||||||
|
_mappings = None
|
||||||
|
|
||||||
|
def map_name(name):
|
||||||
|
global _mappings
|
||||||
|
|
||||||
|
if not _mappings:
|
||||||
|
with open(assets.path('localization.json')) as m:
|
||||||
|
_mappings = json.loads(m.read())
|
||||||
|
|
||||||
|
return _mappings[name] if name in _mappings else name
|
||||||
|
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
import json
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
import xml.etree.ElementTree as ET
|
||||||
|
|
||||||
|
file = sys.argv[1]
|
||||||
|
|
||||||
|
item_re = re.compile("@ITEMS_(.*)")
|
||||||
|
|
||||||
|
def add_item(db, name, desc):
|
||||||
|
match = item_re.match(name)
|
||||||
|
if match:
|
||||||
|
db[match[1]] = desc
|
||||||
|
|
||||||
|
nd = {}
|
||||||
|
tree = ET.parse(file)
|
||||||
|
root = tree.getroot()
|
||||||
|
|
||||||
|
for child in root[0]:
|
||||||
|
tuid = child.attrib['tuid']
|
||||||
|
for loc in child:
|
||||||
|
if loc.attrib['{http://www.w3.org/XML/1998/namespace}lang'] == 'EN-US':
|
||||||
|
for desc in loc:
|
||||||
|
add_item(nd, tuid, desc.text)
|
||||||
|
|
||||||
|
print(json.dumps(nd))
|
||||||
Reference in New Issue
Block a user