From dc17150b86fc605ba8a2d0589623eb3dcb3e1cea Mon Sep 17 00:00:00 2001 From: Naruse <71993948+DevilProMT@users.noreply.github.com> Date: Fri, 18 Apr 2025 09:13:19 +0800 Subject: [PATCH] Takeoff relic & lightcone --- game_server/handlers/TakeOffEquipmentCsReq.py | 16 +++++++++++++++ game_server/handlers/TakeOffRelicCsReq.py | 20 +++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 game_server/handlers/TakeOffEquipmentCsReq.py create mode 100644 game_server/handlers/TakeOffRelicCsReq.py diff --git a/game_server/handlers/TakeOffEquipmentCsReq.py b/game_server/handlers/TakeOffEquipmentCsReq.py new file mode 100644 index 0000000..6ace52f --- /dev/null +++ b/game_server/handlers/TakeOffEquipmentCsReq.py @@ -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() \ No newline at end of file diff --git a/game_server/handlers/TakeOffRelicCsReq.py b/game_server/handlers/TakeOffRelicCsReq.py new file mode 100644 index 0000000..f64ce76 --- /dev/null +++ b/game_server/handlers/TakeOffRelicCsReq.py @@ -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() \ No newline at end of file