Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions extra/gear.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


def get_row_from_reader(table_name: str, row_id: int):
rows = READER.query(table_name, dict(ID=row_id))
rows = Tool.READER.query(table_name, dict(ID=row_id))
if not rows:
return None
return rows[0]
Expand All @@ -15,23 +15,20 @@ class ExtraGear(Gear):
id: int = 0
temp_enchant: Enchant = None

def __init__(
self, gear_id: int, strength_level: int, embed_levels: list[int],
position_id: int = None, tab_id: int = None
):
def __init__(self, gear_id: int, strength_level: int, embed_levels: list[int], position_id: int = None, tab_id: int = None):
if tab_id in EQUIPMENT_BY_TABS:
row = get_row_from_reader(EQUIPMENT_BY_TABS[tab_id], gear_id)
elif position_id in EQUIPMENT_BY_POSITIONS:
row = get_row_from_reader(EQUIPMENT_BY_POSITIONS[position_id], gear_id)
else:
raise KeyError("Not Passing Any ID")
raise KeyError('Not Passing Any ID')
if row and row['SubType'] in POSITION_MAP:
detail = get_equip_code(get_equip_detail(row))
super().__init__(detail['school'], detail['kind'], detail['name'], detail)
self.strength_level = strength_level
self.embed_levels = {i: level for i, level in enumerate(embed_levels)}
else:
super().__init__("", "", "", {})
super().__init__('', '', '', {})

def __bool__(self):
return bool(self.id)
Expand Down Expand Up @@ -59,7 +56,7 @@ def __init__(self, enchant_id: int):
detail = get_enchant_code(get_enchant_detail(row))
super().__init__(detail['name'], detail)
else:
super().__init__("", {})
super().__init__('', {})

def __bool__(self):
return bool(self.id)
Expand All @@ -76,7 +73,7 @@ def __init__(self, item_id: int = None, enchant_id: int = None):
detail = get_stone_code(STONE_BY_ENCHANT_IDS[enchant_id].copy())
super().__init__(detail)
else:
raise KeyError("Not Passing Any ID")
raise KeyError('Not Passing Any ID')

def __bool__(self):
return bool(self.enchant_id)
Expand Down Expand Up @@ -127,7 +124,7 @@ def from_item(cls, data: dict):
gear.temp_enchant = temp_enchant
if not gear.is_primary_weapon:
continue
_, stone_id = equip_data["ColorInfo"]["0"]
_, stone_id = equip_data['ColorInfo']['0']
gear.stone = ExtraStone(item_id=stone_id)
return cls(gears)

Expand Down
65 changes: 65 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@

[tool.poetry]
name = "KlAttribute"
version = "0.0.1"
description = "AttributeDpsCalc"
authors = ["IcyTide","serfend <serfend@foxmail.com>"]
license = "AGPL"

[tool.poetry.dependencies]
python = "^3.13.3"

[build-system]
requires = ["poetry_core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.ruff]
line-length=160
# Enable Pyflakes `E` and `F` codes by default.
# select = ["E", "F"]

# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".hg",
".mypy_cache",
".nox",
".pants.d",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
'tests',
'lib_config_debug.py',
'ins_u_const.py',
'docs',
]

# Allow unused variables when underscore-prefixed.
# lint.dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

target-version = "py313"

# Never enforce `E501` (line length violations).
# Never enforce `F401` (imported but not used).
# Never enforce `F403` (star imported unable to detect undefined).
# Never enforce `F405` (star imported make defined fuss).
# Never enforce `F811` (redefinition of unused xxx).
lint.ignore = ["E402","E501", "F401", "F403", "F405", "F811"]

# Never try to fix
lint.unfixable = ["E402","E501", "F401", "F403", "F405", "F811"]

[tool.ruff.format]
# 使用单引号
quote-style = "single"
Loading