Takeoff relic & lightcone

This commit is contained in:
Naruse
2025-04-18 09:13:19 +08:00
parent 6208880642
commit dc17150b86
2 changed files with 36 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
import betterproto
from game_server.net.session import PlayerSession
from rail_proto.lib import (
TakeOffEquipmentCsReq,
TakeOffEquipmentScRsp
)
async def handle(session: PlayerSession, msg: TakeOffEquipmentCsReq) -> betterproto.Message | None:
avatar_data = session.player.avatar_manager.get(msg.avatar_id)
if not avatar_data: return None
item_data = session.player.inventory_manager.get(avatar_data.lightcone_id)
if not item_data: return None
avatar_data.lightcone_id = 0
item_data.equip_avatar = 0
session.pending_notify(session.player.PlayerSyncProto())
return TakeOffEquipmentScRsp()

View File

@@ -0,0 +1,20 @@
import betterproto
from game_server.net.session import PlayerSession
from rail_proto.lib import (
TakeOffRelicCsReq,
TakeOffRelicScRsp
)
async def handle(session: PlayerSession, msg: TakeOffRelicCsReq) -> betterproto.Message | None:
avatar_data = session.player.avatar_manager.get(msg.avatar_id)
if not avatar_data: return None
for type in msg.relic_type_list:
relic_type = str(type)
relic_id = avatar_data.relic_ids.get(relic_type)
if not relic_id or relic_id == 0: continue
item_data = session.player.inventory_manager.get(relic_id)
if not item_data: continue
avatar_data.relic_ids.pop(relic_type)
item_data.equip_avatar = 0
session.pending_notify(session.player.PlayerSyncProto())
return TakeOffRelicScRsp()