Skip to content
Merged
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
7 changes: 2 additions & 5 deletions packages/solaris/solaris/parse/parsers/product_diamond.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
class ProductDiamondItem(TypedDict):
"""钻石产品项"""

icon: str
name: str
item_id: list[int] # 对应 C# 的 itemID[]
price: int
Expand Down Expand Up @@ -52,21 +51,19 @@ def parse(self, data: bytes) -> ProductDiamondConfig:

for _ in range(count):
# 按照IItemItem.Parse的顺序读取字段
icon = reader.ReadUTFBytesWithLength()

# 读取可选的itemID数组
item_id: list[int] = []
if reader.ReadBoolean():
item_id_count = reader.ReadSignedInt()
item_id = [reader.ReadSignedInt() for _ in range(item_id_count)]
if item_id_count > 0:
item_id = [reader.ReadSignedInt() for _ in range(item_id_count)]

name = reader.ReadUTFBytesWithLength()
price = reader.ReadSignedInt()
product_id = reader.ReadSignedInt()
vip = reader.ReadFloat()

item = ProductDiamondItem(
icon=icon,
name=name,
item_id=item_id,
price=price,
Expand Down
Loading