forked from Hay1tsme/artemis
sao: fix get_m_res_earn_campaign_shops
This commit is contained in:
parent
dffa11f420
commit
9c49a4f54a
@ -939,9 +939,27 @@ class SaoBase:
|
||||
|
||||
resp.data_list.append(tmp)
|
||||
|
||||
self.logger.debug(f"Load {len(resp.data_list)} Yui Medal Shop Items")
|
||||
self.logger.debug(f"Load {len(resp.data_list)} Gasha Medal Shops")
|
||||
return resp.make()
|
||||
|
||||
def handle_d604(self, header: SaoRequestHeader, request: bytes) -> bytes:
|
||||
# master_data_2/get_m_res_earn_campaign_shops
|
||||
return SaoNoopResponse(header.cmd + 1).make()
|
||||
req = GetMResEarnCampaignShopsRequest(header, request)
|
||||
resp = GetMResEarnCampaignShopsResponse(header.cmd + 1)
|
||||
|
||||
shops = self.load_data_csv("ResEarnCampaignShops")
|
||||
for shop in shops:
|
||||
tmp = ResEarnCampaignShop.from_args(shop['ResEarnCampaignShopId'], shop['ResEarnCampaignApplicationId'], shop['Name'])
|
||||
tmp.selling_yui_medal = shop['SellingYuiMedal']
|
||||
tmp.selling_col = shop['SellingCol']
|
||||
tmp.selling_event_item_id = shop['SellingEventItemId']
|
||||
tmp.selling_event_item_num = shop['SellingEventItemNum']
|
||||
tmp.purchase_limit = shop['PurchaseLimit']
|
||||
tmp.get_application_point = shop['GetApplicationPoint']
|
||||
|
||||
tmp.sales_end_date = datetime(2100, 1, 1, 0, 0, 0, 0) # always open
|
||||
|
||||
resp.data_list.append(tmp)
|
||||
|
||||
self.logger.debug(f"Load {len(resp.data_list)} Res Earn Campaign Shops")
|
||||
return resp.make()
|
||||
|
@ -3212,3 +3212,21 @@ class GetMGashaMedalShopsResponse(SaoBaseResponse):
|
||||
|
||||
self.header.length = len(ret)
|
||||
return super().make() + ret
|
||||
|
||||
class GetMResEarnCampaignShopsRequest(SaoBaseRequest):
|
||||
def __init__(self, header: SaoRequestHeader, data: bytes) -> None:
|
||||
super().__init__(header, data)
|
||||
self.dummy = decode_byte(data, 0)
|
||||
|
||||
class GetMResEarnCampaignShopsResponse(SaoBaseResponse):
|
||||
def __init__(self, cmd_id: int) -> None:
|
||||
super().__init__(cmd_id)
|
||||
self.result = 1 # byte
|
||||
self.data_list: List[ResEarnCampaignShop] = []
|
||||
|
||||
def make(self) -> bytes:
|
||||
ret = encode_byte(self.result)
|
||||
ret += encode_arr_cls(self.data_list)
|
||||
|
||||
self.header.length = len(ret)
|
||||
return super().make() + ret
|
||||
|
@ -816,6 +816,61 @@ class YuiMedalShopItemData(BaseHelper):
|
||||
ret += encode_int(self.property4_value2)
|
||||
return ret
|
||||
|
||||
class ResEarnCampaignShop(BaseHelper):
|
||||
def __init__(self, data: bytes, offset: int) -> None:
|
||||
super().__init__(data, offset)
|
||||
self.res_earn_campaign_shop_id = decode_int(data, offset + self._sz)
|
||||
self._sz += INT_OFF
|
||||
self.res_earn_campaign_application_id = decode_int(data, offset + self._sz)
|
||||
self._sz += INT_OFF
|
||||
|
||||
name = decode_str(data, offset + self._sz)
|
||||
self.name = name[0]
|
||||
self._sz += name[1]
|
||||
|
||||
self.selling_yui_medal = decode_short(data, offset + self._sz)
|
||||
self._sz += SHORT_OFF
|
||||
self.selling_col = decode_int(data, offset + self._sz)
|
||||
self._sz += INT_OFF
|
||||
self.selling_event_item_id = decode_int(data, offset + self._sz)
|
||||
self._sz += INT_OFF
|
||||
self.selling_event_item_num = decode_int(data, offset + self._sz)
|
||||
self._sz += INT_OFF
|
||||
self.purchase_limit = decode_short(data, offset + self._sz)
|
||||
self._sz += SHORT_OFF
|
||||
self.get_application_point = decode_short(data, offset + self._sz)
|
||||
self._sz += SHORT_OFF
|
||||
|
||||
sales_start_date = decode_str(data, offset + self._sz)
|
||||
self.sales_start_date = prs_dt(sales_start_date[0])
|
||||
self._sz += sales_start_date[1]
|
||||
|
||||
sales_end_date = decode_str(data, offset + self._sz)
|
||||
self.sales_end_date = prs_dt(sales_end_date[0])
|
||||
self._sz += sales_end_date[1]
|
||||
|
||||
@classmethod
|
||||
def from_args(cls, shop_id: int = 0, app_id: int = 0, name: str = "") -> "ResEarnCampaignShop":
|
||||
ret = cls(b"\x00" * 26, 0)
|
||||
ret.res_earn_campaign_shop_id = shop_id
|
||||
ret.res_earn_campaign_application_id = app_id
|
||||
ret.name = name
|
||||
return ret
|
||||
|
||||
def make(self) -> bytes:
|
||||
ret = encode_int(self.res_earn_campaign_shop_id)
|
||||
ret = encode_int(self.res_earn_campaign_application_id)
|
||||
ret += encode_str(self.name)
|
||||
ret += encode_short(self.selling_yui_medal)
|
||||
ret += encode_int(self.selling_col)
|
||||
ret += encode_int(self.selling_event_item_id)
|
||||
ret += encode_int(self.selling_event_item_num)
|
||||
ret += encode_short(self.purchase_limit)
|
||||
ret += encode_short(self.get_application_point)
|
||||
ret += encode_str(fmt_dt(self.sales_start_date))
|
||||
ret += encode_str(fmt_dt(self.sales_end_date))
|
||||
return ret
|
||||
|
||||
class GashaMedalShop(BaseHelper):
|
||||
def __init__(self, data: bytes, offset: int) -> None:
|
||||
super().__init__(data, offset)
|
||||
|
Loading…
Reference in New Issue
Block a user