diff options
author | Jared Adams <jaxad0127@gmail.com> | 2009-07-07 11:23:14 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-07-07 11:23:14 -0600 |
commit | 5662b7d9ad9eb6927df7ca83713d3b6108f59ddc (patch) | |
tree | 1e962203f7bf2440b558045967d0f93ccf21bbe4 /src/net | |
parent | 851f67cd9975b090b051decb1deab6b0489d14c5 (diff) | |
download | mana-5662b7d9ad9eb6927df7ca83713d3b6108f59ddc.tar.gz mana-5662b7d9ad9eb6927df7ca83713d3b6108f59ddc.tar.bz2 mana-5662b7d9ad9eb6927df7ca83713d3b6108f59ddc.tar.xz mana-5662b7d9ad9eb6927df7ca83713d3b6108f59ddc.zip |
Use tmw-skills.xml instead of hardcoding
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/tmwserv/generalhandler.cpp | 2 | ||||
-rw-r--r-- | src/net/tmwserv/playerhandler.cpp | 27 | ||||
-rw-r--r-- | src/net/tmwserv/protocol.h | 2 |
3 files changed, 6 insertions, 25 deletions
diff --git a/src/net/tmwserv/generalhandler.cpp b/src/net/tmwserv/generalhandler.cpp index 5886aafb..10b2c0f3 100644 --- a/src/net/tmwserv/generalhandler.cpp +++ b/src/net/tmwserv/generalhandler.cpp @@ -21,6 +21,7 @@ #include "gui/inventorywindow.h" #include "gui/partywindow.h" +#include "gui/skilldialog.h" #include "net/tmwserv/generalhandler.h" @@ -146,6 +147,7 @@ void GeneralHandler::guiWindowsLoaded() { inventoryWindow->setSplitAllowed(true); partyWindow->clearPartyName(); + skillDialog->loadSkills("tmw-skills.xml"); } void GeneralHandler::guiWindowsUnloaded() diff --git a/src/net/tmwserv/playerhandler.cpp b/src/net/tmwserv/playerhandler.cpp index 69a2bdb4..bbce3ae1 100644 --- a/src/net/tmwserv/playerhandler.cpp +++ b/src/net/tmwserv/playerhandler.cpp @@ -133,7 +133,7 @@ void PlayerHandler::handleMessage(MessageIn &msg) logger->log("ATTRIBUTE UPDATE:"); while (msg.getUnreadLength()) { - int stat = msg.readInt8(); + int stat = msg.readInt16(); int base = msg.readInt16(); int value = msg.readInt16(); logger->log("%d set to %d %d", stat, base, value); @@ -143,24 +143,11 @@ void PlayerHandler::handleMessage(MessageIn &msg) player_node->setMaxHp(base); player_node->setHp(value); } - else if (stat < NB_CHARACTER_ATTRIBUTES) + else { - if (stat >= CHAR_SKILL_BEGIN && stat < CHAR_SKILL_END - && player_node->getAttributeBase(stat) < base - && player_node->getAttributeBase(stat) > -1) - { - Particle* effect = particleEngine->addEffect("graphics/particles/skillup.particle.xml", 0, 0); - player_node->controlParticle(effect); - } - player_node->setAttributeBase(stat, base); player_node->setAttributeEffective(stat, value); } - else - { - logger->log("Warning: server wants to update unknown " - "attribute %d to %d", stat, value); - } } } break; @@ -173,15 +160,7 @@ void PlayerHandler::handleMessage(MessageIn &msg) int current = msg.readInt32(); int next = msg.readInt32(); - if (skill < CHAR_SKILL_NB) - { - player_node->setExperience(skill, current, next); - } - else - { - logger->log("Warning: server wants to update experience of unknown " - "skill %d to %d / %d", skill, current, next); - } + player_node->setExperience(skill, current, next); } } break; diff --git a/src/net/tmwserv/protocol.h b/src/net/tmwserv/protocol.h index e9fc5b8a..13a15256 100644 --- a/src/net/tmwserv/protocol.h +++ b/src/net/tmwserv/protocol.h @@ -83,7 +83,7 @@ enum { PGMSG_MOVE_ITEM = 0x0114, // B slot1, B slot2, B amount GPMSG_INVENTORY = 0x0120, // { B slot, W item id [, B amount] }* GPMSG_INVENTORY_FULL = 0x0121, // { B slot, W item id [, B amount] }* - GPMSG_PLAYER_ATTRIBUTE_CHANGE = 0x0130, // { B attribute, W base value, W modified value }* + GPMSG_PLAYER_ATTRIBUTE_CHANGE = 0x0130, // { W attribute, W base value, W modified value }* GPMSG_PLAYER_EXP_CHANGE = 0x0140, // { W skill, D exp got, D exp needed }* GPMSG_LEVELUP = 0x0150, // W new level GPMSG_LEVEL_PROGRESS = 0x0151, // B percent completed to next levelup |