summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-08-19 15:40:42 +0200
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2025-03-07 09:54:31 +0100
commit9d1c20860e8a5b8e7d5a4fb53c2ddb1c372bad7f (patch)
treeeb1f6bcd9f4c81c16efdc5dcdd869fdbcc9626c3 /src/net
parent2d94ced04f34387352e4250363b18a908a67fdf2 (diff)
downloadmana-9d1c20860e8a5b8e7d5a4fb53c2ddb1c372bad7f.tar.gz
mana-9d1c20860e8a5b8e7d5a4fb53c2ddb1c372bad7f.tar.bz2
mana-9d1c20860e8a5b8e7d5a4fb53c2ddb1c372bad7f.tar.xz
mana-9d1c20860e8a5b8e7d5a4fb53c2ddb1c372bad7f.zip
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)
Diffstat (limited to 'src/net')
-rw-r--r--src/net/manaserv/manaserv_protocol.h1
-rw-r--r--src/net/manaserv/playerhandler.cpp10
2 files changed, 9 insertions, 2 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:
{