diff options
-rw-r--r-- | src/net/manaserv/manaserv_protocol.h | 1 | ||||
-rw-r--r-- | src/net/manaserv/playerhandler.cpp | 10 | ||||
-rw-r--r-- | src/playerinfo.cpp | 4 | ||||
-rw-r--r-- | src/playerinfo.h | 6 |
4 files changed, 14 insertions, 7 deletions
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: { diff --git a/src/playerinfo.cpp b/src/playerinfo.cpp index 6eaa20b7..a05ffaaa 100644 --- a/src/playerinfo.cpp +++ b/src/playerinfo.cpp @@ -280,9 +280,9 @@ void setBuySellState(BuySellState buySellState) // --- Abilities -------------------------------------------------------------- -void clearAbilityStatus() +void clearAbilityStatus(int id) { - mAbilities.clear(); + mAbilities.erase(id); } void setAbilityStatus(int id, int current, int max, int recharge) diff --git a/src/playerinfo.h b/src/playerinfo.h index 8ac82463..492ccf42 100644 --- a/src/playerinfo.h +++ b/src/playerinfo.h @@ -218,9 +218,9 @@ namespace PlayerInfo // --- Abilities -------------------------------------------------------------- /** - * Removes all abilities. + * Removes the status for the given ability. */ - void clearAbilityStatus(); + void clearAbilityStatus(int id); /** * Changes the status of the given ability. @@ -228,7 +228,7 @@ namespace PlayerInfo void setAbilityStatus(int id, int current, int max, int recharge); /** - * Returns the status of the given ability. + * Returns the status all abilities. */ const std::map<int, Ability> &getAbilityStatus(); |