Fix parsing of implicit mod
This commit is contained in:
@@ -96,7 +96,7 @@ class Item:
|
||||
lvl: int | None = None
|
||||
quality: Quality | None = None
|
||||
graphic: int | None = None
|
||||
inherent: int | None = None
|
||||
implicit: int | None = None
|
||||
low_quality: LowQualityType | None = None
|
||||
prefixes: list[int] | None = None
|
||||
suffixes: list[int] | None = None
|
||||
|
||||
@@ -156,7 +156,7 @@ def parse_item(data: bytes) -> tuple[bytes, Item]:
|
||||
item.graphic, graphic_end = parse_item_graphic(bits[extended_end:])
|
||||
graphic_end += extended_end
|
||||
|
||||
item.inherent, inherent_end = parse_inherent_mod(bits[graphic_end:])
|
||||
item.implicit, inherent_end = parse_implicit_mod(bits[graphic_end:])
|
||||
inherent_end += graphic_end
|
||||
|
||||
item, quality_end = parse_quality_data(bits[inherent_end:], item)
|
||||
@@ -210,11 +210,13 @@ def parse_item_graphic(bits: bitarray) -> tuple[int | None, int]:
|
||||
return ba2int(bits[1:4]), 4
|
||||
|
||||
|
||||
def parse_inherent_mod(bits: bitarray) -> tuple[int | None, int]:
|
||||
def parse_implicit_mod(bits: bitarray) -> tuple[int | None, int]:
|
||||
# References a row in automagic.txt which adds an implicit mod to the item.
|
||||
# However, that mod seems to also be present in the stats at the end.
|
||||
if not bits[0]:
|
||||
return None, 1
|
||||
else:
|
||||
return ba2int(bits[1:4]), 4
|
||||
return ba2int(bits[1:11]), 12
|
||||
|
||||
|
||||
def parse_extended_item(bits: bitarray) -> tuple[int, int, Quality]:
|
||||
|
||||
Reference in New Issue
Block a user