diff options
Diffstat (limited to 'src/net/ea')
-rw-r--r-- | src/net/ea/generalhandler.cpp | 6 | ||||
-rw-r--r-- | src/net/ea/playerhandler.cpp | 4 | ||||
-rw-r--r-- | src/net/ea/protocol.h | 1 | ||||
-rw-r--r-- | src/net/ea/skillhandler.cpp | 48 |
4 files changed, 34 insertions, 25 deletions
diff --git a/src/net/ea/generalhandler.cpp b/src/net/ea/generalhandler.cpp index 404bff69..959e7632 100644 --- a/src/net/ea/generalhandler.cpp +++ b/src/net/ea/generalhandler.cpp @@ -19,10 +19,11 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "gui/inventorywindow.h" - #include "net/ea/generalhandler.h" +#include "gui/inventorywindow.h" +#include "gui/skilldialog.h" + #include "net/ea/network.h" #include "net/ea/protocol.h" @@ -201,6 +202,7 @@ void GeneralHandler::guiWindowsLoaded() { partyTab = new PartyTab; inventoryWindow->setSplitAllowed(false); + skillDialog->loadSkills("ea-skills.xml"); } void GeneralHandler::guiWindowsUnloaded() diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp index 40cfc71c..07b738ee 100644 --- a/src/net/ea/playerhandler.cpp +++ b/src/net/ea/playerhandler.cpp @@ -37,7 +37,6 @@ #include "gui/gui.h" #include "gui/okdialog.h" #include "gui/sell.h" -#include "gui/skill.h" #include "gui/storagewindow.h" #include "gui/viewport.h" @@ -233,8 +232,7 @@ void PlayerHandler::handleMessage(MessageIn &msg) break; case 0x000b: player_node->setLevel(value); break; case 0x000c: - player_node->mSkillPoint = value; - skillDialog->update(); + player_node->setSkillPoints(value); break; case 0x0018: if (value >= player_node->getMaxWeight() / 2 && diff --git a/src/net/ea/protocol.h b/src/net/ea/protocol.h index b3759946..ce8417bf 100644 --- a/src/net/ea/protocol.h +++ b/src/net/ea/protocol.h @@ -69,6 +69,7 @@ static const int STORAGE_OFFSET = 1; #define SMSG_PLAYER_ARROW_EQUIP 0x013c #define SMSG_PLAYER_ARROW_MESSAGE 0x013b #define SMSG_PLAYER_SKILLS 0x010f +#define SMSG_PLAYER_SKILL_UP 0x010e #define SMSG_SKILL_FAILED 0x0110 #define SMSG_ITEM_USE_RESPONSE 0x00a8 #define SMSG_ITEM_VISIBLE 0x009d /**< An item is on the floor */ diff --git a/src/net/ea/skillhandler.cpp b/src/net/ea/skillhandler.cpp index 69b0fd65..9fb4e566 100644 --- a/src/net/ea/skillhandler.cpp +++ b/src/net/ea/skillhandler.cpp @@ -29,7 +29,7 @@ #include "localplayer.h" #include "log.h" -#include "gui/skill.h" +#include "gui/skilldialog.h" #include "gui/widgets/chattab.h" @@ -76,6 +76,7 @@ SkillHandler::SkillHandler() static const Uint16 _messages[] = { SMSG_PLAYER_SKILLS, SMSG_SKILL_FAILED, + SMSG_PLAYER_SKILL_UP, 0 }; handledMessages = _messages; @@ -85,42 +86,49 @@ SkillHandler::SkillHandler() void SkillHandler::handleMessage(MessageIn &msg) { int skillCount; + int skillId; switch (msg.getId()) { case SMSG_PLAYER_SKILLS: msg.readInt16(); // length skillCount = (msg.getLength() - 4) / 37; - skillDialog->cleanList(); for (int k = 0; k < skillCount; k++) { - int skillId = msg.readInt16(); + skillId = msg.readInt16(); msg.readInt16(); // target type - msg.readInt16(); // unknown + msg.skip(2); // unused int level = msg.readInt16(); int sp = msg.readInt16(); - msg.readInt16(); // range - std::string skillName = msg.readString(24); + int range = msg.readInt16(); + msg.skip(24); // unused int up = msg.readInt8(); - if (level != 0 || up != 0) - { - if (skillDialog->hasSkill(skillId)) { - skillDialog->setSkill(skillId, level, sp); - } - else { - skillDialog->addSkill(skillId, level, sp); - } - } + player_node->setAttributeBase(skillId, level); + player_node->setAttributeEffective(skillId, level); + skillDialog->setModifiable(skillId, up); + } + break; + + case SMSG_PLAYER_SKILL_UP: + { + skillId = msg.readInt16(); + int level = msg.readInt16(); + int sp = msg.readInt16(); + int range = msg.readInt16(); + int up = msg.readInt8(); + + player_node->setAttributeBase(skillId, level); + player_node->setAttributeEffective(skillId, level); + skillDialog->setModifiable(skillId, up); } - skillDialog->update(); break; case SMSG_SKILL_FAILED: // Action failed (ex. sit because you have not reached the // right level) - short skill = msg.readInt16(); + skillId = msg.readInt16(); short bskill = msg.readInt16(); msg.readInt16(); // unknown char success = msg.readInt8(); @@ -131,7 +139,7 @@ void SkillHandler::handleMessage(MessageIn &msg) } std::string msg; - if (success == SKILL_FAILED && skill == SKILL_BASIC) + if (success == SKILL_FAILED && skillId == SKILL_BASIC) { switch (bskill) { @@ -196,7 +204,7 @@ void SkillHandler::handleMessage(MessageIn &msg) } else { - switch (skill) + switch (skillId) { case SKILL_WARP : msg = _("Warp failed..."); @@ -217,7 +225,7 @@ void SkillHandler::handleMessage(MessageIn &msg) void SkillHandler::up(int skillId) { - if (player_node->mSkillPoint <= 0) + if (player_node->getSkillPoints() <= 0) return; MessageOut outMsg(CMSG_SKILL_LEVELUP_REQUEST); |