Skip to content

Commit

Permalink
Use dummy item for trade event point
Browse files Browse the repository at this point in the history
  • Loading branch information
squaresmile committed Nov 14, 2024
1 parent 4d1b81f commit 94d0aa4
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
29 changes: 28 additions & 1 deletion app/core/nice/event/trade.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from ....config import Settings
from ....schemas.common import Region
from ....schemas.enums import NiceItemBGType
from ....schemas.gameenums import NiceItemType
from ....schemas.nice import (
AssetURL,
NiceEventTradeGoods,
Expand Down Expand Up @@ -37,6 +39,31 @@ def get_nice_trade_goods(
raw_releases: list[MstCommonRelease],
item_map: dict[int, NiceItem],
) -> NiceEventTradeGoods:
dummy_point_item = NiceItem(
id=5,
name="",
originalName="",
type=NiceItemType.questRewardQp,
uses=[],
detail="",
individuality=[],
icon=fmt_url(
AssetURL.items,
base_url=settings.asset_url,
region=region,
item_id=5,
),
background=NiceItemBGType.questClearQPReward,
value=0,
eventId=0,
eventGroupId=0,
priority=0,
dropPriority=0,
startedAt=0,
endedAt=0,
itemSelects=[],
)

return NiceEventTradeGoods(
id=trade.id,
name=trade.name,
Expand All @@ -49,7 +76,7 @@ def get_nice_trade_goods(
gifts=get_nice_gifts(region, trade.giftId, gift_data),
consumes=get_nice_common_consumes(raw_consumes, trade.commonConsumeId),
eventPointNum=trade.eventPointNum,
eventPointItem=item_map.get(trade.eventPointItemId, None),
eventPointItem=item_map.get(trade.eventPointItemId, dummy_point_item),
tradeTime=trade.tradeTime,
maxNum=trade.maxNum,
maxTradeTime=trade.maxTradeTime,
Expand Down
2 changes: 1 addition & 1 deletion app/schemas/nice.py
Original file line number Diff line number Diff line change
Expand Up @@ -2165,7 +2165,7 @@ class NiceEventTradeGoods(BaseModelORJson):
gifts: list[NiceGift]
consumes: list[NiceCommonConsume]
eventPointNum: int
eventPointItem: NiceItem | None
eventPointItem: NiceItem
tradeTime: int
maxNum: int
maxTradeTime: int
Expand Down

0 comments on commit 94d0aa4

Please sign in to comment.