diff options
author | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2010-10-19 23:17:18 +0200 |
---|---|---|
committer | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2010-10-19 23:17:18 +0200 |
commit | 14b048899065054bf2a8171a566616607479c09f (patch) | |
tree | 3e531350fdcff72e33dde66bed3574b2e882bd06 /src/net/manaserv/playerhandler.cpp | |
parent | 1b21442b5eb6dcc41a585715d07c73ed3ad59a1b (diff) | |
download | mana-14b048899065054bf2a8171a566616607479c09f.tar.gz mana-14b048899065054bf2a8171a566616607479c09f.tar.bz2 mana-14b048899065054bf2a8171a566616607479c09f.tar.xz mana-14b048899065054bf2a8171a566616607479c09f.zip |
Heavy GUI fixes related to stats for Manaserv.
Also tested to be compatible with tA.
Now the Status window is much more nicer when using Manaserv.
HP, max hp, ... are now working fine along with corrections made
in the attributes.xml file (in next commit.)
Reviewed-by: Thorbjorn.
Diffstat (limited to 'src/net/manaserv/playerhandler.cpp')
-rw-r--r-- | src/net/manaserv/playerhandler.cpp | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/net/manaserv/playerhandler.cpp b/src/net/manaserv/playerhandler.cpp index 5bacce49..a579517f 100644 --- a/src/net/manaserv/playerhandler.cpp +++ b/src/net/manaserv/playerhandler.cpp @@ -43,6 +43,7 @@ #include "net/manaserv/messagein.h" #include "net/manaserv/messageout.h" #include "net/manaserv/protocol.h" +#include "net/manaserv/attributes.h" /** * Max. distance we are willing to scroll after a teleport; @@ -112,18 +113,23 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg) { while (msg.getUnreadLength()) { - int attr = msg.readInt16(); + int attrId = msg.readInt16(); double base = msg.readInt32() / 256.0; double value = msg.readInt32() / 256.0; - /* TODO handle HP - if (attr == ATTR_HP) - PlayerInfo::setAttribute(HP, value); - else if (attr == ATTR_MAX_HP) - PlayerInfo::setAttribute(MAX_HP, value);*/ - - PlayerInfo::setStatBase(attr, base); - PlayerInfo::setStatMod(attr, value - base); + // Set the core player attribute the stat + // depending on attribute link. + int playerInfoId = + Attributes::getPlayerInfoIdFromAttrId(attrId); + if (playerInfoId > -1) + { + PlayerInfo::setAttribute(playerInfoId, value); + } + else + { + PlayerInfo::setStatBase(attrId, base); + PlayerInfo::setStatMod(attrId, value - base); + } } } break; |