From 9d1c20860e8a5b8e7d5a4fb53c2ddb1c372bad7f Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Mon, 19 Aug 2024 15:40:42 +0200 Subject: Ability related network message adjustments * Handle GPMSG_ABILITY_REMOVED for removal of abilities (mana/manaserv@e3fcc1a47db312933a0f5b7e725c5779a1a45722) * Adjust GPMSG_ABILITY_STATUS now that it only sends abilities that have changed state, so it should no longer clear all abilities. (mana/manaserv@3598685c0fcbb9b5fdbcdbbaee258e2b55d5c98a) --- src/net/manaserv/manaserv_protocol.h | 1 + src/net/manaserv/playerhandler.cpp | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'src/net') diff --git a/src/net/manaserv/manaserv_protocol.h b/src/net/manaserv/manaserv_protocol.h index 01632215..ab81846b 100644 --- a/src/net/manaserv/manaserv_protocol.h +++ b/src/net/manaserv/manaserv_protocol.h @@ -141,6 +141,7 @@ enum { PGMSG_USE_ABILITY_ON_BEING = 0x0292, // B abilityID, W being id GPMSG_ABILITY_STATUS = 0x0293, // { B abilityID, D current, D max, D recharge } PGMSG_USE_ABILITY_ON_POINT = 0x0294, // B abilityID, W*2 position + GPMSG_ABILITY_REMOVED = 0x0295, // B abilityID PGMSG_SAY = 0x02A0, // S text GPMSG_SAY = 0x02A1, // W being id, S text GPMSG_NPC_CHOICE = 0x02B0, // W being id, { S text }* diff --git a/src/net/manaserv/playerhandler.cpp b/src/net/manaserv/playerhandler.cpp index 335546be..e0d4e783 100644 --- a/src/net/manaserv/playerhandler.cpp +++ b/src/net/manaserv/playerhandler.cpp @@ -76,6 +76,7 @@ PlayerHandler::PlayerHandler() GPMSG_RAISE_ATTRIBUTE_RESPONSE, GPMSG_LOWER_ATTRIBUTE_RESPONSE, GPMSG_ABILITY_STATUS, + GPMSG_ABILITY_REMOVED, 0 }; handledMessages = _messages; @@ -245,10 +246,8 @@ void PlayerHandler::handleMessage(MessageIn &msg) case GPMSG_ABILITY_STATUS: { - PlayerInfo::clearAbilityStatus(); while (msg.getUnreadLength()) { - // { B abilityID, L current, L max, L recharge } int id = msg.readInt8(); int current = msg.readInt32(); int max = msg.readInt32(); @@ -256,6 +255,13 @@ void PlayerHandler::handleMessage(MessageIn &msg) PlayerInfo::setAbilityStatus(id, current, max, recharge); } } break; + + case GPMSG_ABILITY_REMOVED: + { + int id = msg.readInt8(); + PlayerInfo::clearAbilityStatus(id); + } break; + /* case SMSG_PLAYER_ARROW_MESSAGE: { -- cgit v1.2.3-70-g09d2