From 04e8780bf3a9c3a15cea541d8238e2b42ac18413 Mon Sep 17 00:00:00 2001 From: Nattsu39 Date: Fri, 16 Oct 2026 13:21:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20parser:=20jackpot=5Fshop?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - JackPotShop.bytes: 商品项新增 commodity、petinfo 字段读取 - JackPotShop_temp 的类型定义独立为 JackPotShopTempItem 系列 TypedDict Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../solaris/parse/parsers/jackpot_shop.py | 42 +++++++++++++++++-- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/packages/solaris/solaris/parse/parsers/jackpot_shop.py b/packages/solaris/solaris/parse/parsers/jackpot_shop.py index b1a25de..0cda5b6 100644 --- a/packages/solaris/solaris/parse/parsers/jackpot_shop.py +++ b/packages/solaris/solaris/parse/parsers/jackpot_shop.py @@ -5,6 +5,8 @@ class JackPotShopItem(TypedDict): + commodity: str + petinfo: str product_name: str product_id: list[int] batch: int @@ -63,8 +65,10 @@ def parse(self, data: bytes) -> JackPotShopConfig: item_id = reader.ReadSignedInt() opentime = reader.ReadSignedInt() batch = reader.ReadSignedInt() + commodity = reader.ReadUTFBytesWithLength() exchange_id = reader.ReadSignedInt() forever = reader.ReadSignedInt() + petinfo = reader.ReadUTFBytesWithLength() product_id: list[int] = [] if reader.ReadBoolean(): pid_count = reader.ReadSignedInt() @@ -73,6 +77,8 @@ def parse(self, data: bytes) -> JackPotShopConfig: product_price = reader.ReadSignedInt() shopkind = reader.ReadSignedInt() item: JackPotShopItem = { + 'commodity': commodity, + 'petinfo': petinfo, 'product_name': product_name, 'product_id': product_id, 'batch': batch, @@ -93,7 +99,35 @@ def parse(self, data: bytes) -> JackPotShopConfig: return {'root': {'blue_chip_shops': shops}} -class JackPotShopTempParser(BaseParser[JackPotShopConfig]): +class JackPotShopTempItem(TypedDict): + product_name: str + product_id: list[int] + batch: int + endtime: int + exchange_id: int + forever: int + id: int + opentime: int + product_price: int + shopkind: int + + +class _JackPotShopTempBlueChipShops(TypedDict): + bulechip_shop: list[JackPotShopTempItem] + endday: str + endtime: str + openday: str + + +class _JackPotShopTempRoot(TypedDict): + blue_chip_shops: _JackPotShopTempBlueChipShops + + +class JackPotShopTempConfig(TypedDict): + root: _JackPotShopTempRoot + + +class JackPotShopTempParser(BaseParser[JackPotShopTempConfig]): @classmethod def source_config_filename(cls) -> str: return 'JackPotShop_temp.bytes' @@ -102,9 +136,9 @@ def source_config_filename(cls) -> str: def parsed_config_filename(cls) -> str: return 'jackPotShopTemp.json' - def parse(self, data: bytes) -> JackPotShopConfig: + def parse(self, data: bytes) -> JackPotShopTempConfig: reader = BytesReader(data) - shops: _JackPotShopBlueChipShops = { + shops: _JackPotShopTempBlueChipShops = { 'bulechip_shop': [], 'endday': '', 'endtime': '', @@ -133,7 +167,7 @@ def parse(self, data: bytes) -> JackPotShopConfig: product_name = reader.ReadUTFBytesWithLength() product_price = reader.ReadSignedInt() shopkind = reader.ReadSignedInt() - item: JackPotShopItem = { + item: JackPotShopTempItem = { 'product_name': product_name, 'product_id': product_id, 'batch': batch,