diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-09-05 12:08:28 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-09-06 01:18:57 +0300 |
commit | 57978a09e9d32a44a95823716d790065d73f977a (patch) | |
tree | 0d89ebeebb91b86fd2c16fa9066b5a08fd7e4f73 /src | |
parent | 3b1d570f626786d141d99a7923669e82e0c125ca (diff) | |
download | manaplus-57978a09e9d32a44a95823716d790065d73f977a.tar.gz manaplus-57978a09e9d32a44a95823716d790065d73f977a.tar.bz2 manaplus-57978a09e9d32a44a95823716d790065d73f977a.tar.xz manaplus-57978a09e9d32a44a95823716d790065d73f977a.zip |
Add skill type reading from server
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/widgets/skillinfo.cpp | 1 | ||||
-rw-r--r-- | src/gui/widgets/skillinfo.h | 1 | ||||
-rw-r--r-- | src/gui/windows/skilldialog.cpp | 11 | ||||
-rw-r--r-- | src/gui/windows/skilldialog.h | 8 | ||||
-rw-r--r-- | src/net/ea/skillhandler.cpp | 4 | ||||
-rw-r--r-- | src/net/eathena/skillhandler.cpp | 6 | ||||
-rw-r--r-- | src/net/tmwa/skillhandler.cpp | 6 |
7 files changed, 24 insertions, 13 deletions
diff --git a/src/gui/widgets/skillinfo.cpp b/src/gui/widgets/skillinfo.cpp index 683854ce8..93b9bcf60 100644 --- a/src/gui/widgets/skillinfo.cpp +++ b/src/gui/widgets/skillinfo.cpp @@ -48,6 +48,7 @@ SkillInfo::SkillInfo() : skillLevelWidth(0), id(0), range(0), + type(0), modifiable(false), visible(false) { diff --git a/src/gui/widgets/skillinfo.h b/src/gui/widgets/skillinfo.h index 7570feca5..f096da9ac 100644 --- a/src/gui/widgets/skillinfo.h +++ b/src/gui/widgets/skillinfo.h @@ -53,6 +53,7 @@ struct SkillInfo final int skillLevelWidth; unsigned int id; int range; + int type; bool modifiable; bool visible; diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp index 63451d1a1..73a023005 100644 --- a/src/gui/windows/skilldialog.cpp +++ b/src/gui/windows/skilldialog.cpp @@ -342,8 +342,10 @@ void SkillDialog::loadXmlFile(const std::string &fileName) } } -bool SkillDialog::updateSkill(const int id, const int range, - const bool modifiable) +bool SkillDialog::updateSkill(const int id, + const int range, + const bool modifiable, + const int type) { const SkillMap::const_iterator it = mSkills.find(id); @@ -354,6 +356,7 @@ bool SkillDialog::updateSkill(const int id, const int range, { info->modifiable = modifiable; info->range = range; + info->type = type; info->update(); } return true; @@ -365,12 +368,14 @@ void SkillDialog::addSkill(const int id, const std::string &name, const int level, const int range, - const bool modifiable) + const bool modifiable, + const int type) { if (mDefaultModel) { SkillInfo *const skill = new SkillInfo; skill->id = static_cast<unsigned int>(id); + skill->type = type; SkillData *const data = skill->data; if (name.empty()) { diff --git a/src/gui/windows/skilldialog.h b/src/gui/windows/skilldialog.h index e82faef05..39082c1e7 100644 --- a/src/gui/windows/skilldialog.h +++ b/src/gui/windows/skilldialog.h @@ -73,13 +73,17 @@ class SkillDialog final : public Window, void loadSkills(); - bool updateSkill(const int id, const int range, const bool modifiable); + bool updateSkill(const int id, + const int range, + const bool modifiable, + const int type); void addSkill(const int id, const std::string &name, const int level, const int range, - const bool modifiable); + const bool modifiable, + const int type); SkillInfo* getSkill(const int id) const A_WARN_UNUSED; diff --git a/src/net/ea/skillhandler.cpp b/src/net/ea/skillhandler.cpp index 5197cff30..f3c2a6982 100644 --- a/src/net/ea/skillhandler.cpp +++ b/src/net/ea/skillhandler.cpp @@ -88,8 +88,8 @@ void SkillHandler::processPlayerSkillUp(Net::MessageIn &msg) PlayerInfo::setSkillLevel(skillId, level); if (skillDialog) { - if (!skillDialog->updateSkill(skillId, range, up)) - skillDialog->addSkill(skillId, "", level, range, up); + if (!skillDialog->updateSkill(skillId, range, up, 0)) + skillDialog->addSkill(skillId, "", level, range, up, 0); } } diff --git a/src/net/eathena/skillhandler.cpp b/src/net/eathena/skillhandler.cpp index d9aedce2c..09580b8fc 100644 --- a/src/net/eathena/skillhandler.cpp +++ b/src/net/eathena/skillhandler.cpp @@ -107,7 +107,7 @@ void SkillHandler::processPlayerSkills(Net::MessageIn &msg) for (int k = 0; k < skillCount; k++) { const int skillId = msg.readInt16("skill id"); - msg.readInt32("inf"); // what is it? + const int inf = msg.readInt32("inf"); const int level = msg.readInt16("skill level"); msg.readInt16("sp"); const int range = msg.readInt16("range"); @@ -119,8 +119,8 @@ void SkillHandler::processPlayerSkills(Net::MessageIn &msg) PlayerInfo::setSkillLevel(skillId, level); if (skillDialog) { - if (!skillDialog->updateSkill(skillId, range, up)) - skillDialog->addSkill(skillId, name, level, range, up); + if (!skillDialog->updateSkill(skillId, range, up, inf)) + skillDialog->addSkill(skillId, name, level, range, up, inf); } } if (updateSkill && skillDialog) diff --git a/src/net/tmwa/skillhandler.cpp b/src/net/tmwa/skillhandler.cpp index b4a39d4e7..8b0d6f662 100644 --- a/src/net/tmwa/skillhandler.cpp +++ b/src/net/tmwa/skillhandler.cpp @@ -109,7 +109,7 @@ void SkillHandler::processPlayerSkills(Net::MessageIn &msg) for (int k = 0; k < skillCount; k++) { const int skillId = msg.readInt16(); - msg.readInt16(); // target type + const int inf = msg.readInt16(); msg.skip(2); // skill pool flags const int level = msg.readInt16(); msg.readInt16(); // sp @@ -122,8 +122,8 @@ void SkillHandler::processPlayerSkills(Net::MessageIn &msg) PlayerInfo::setSkillLevel(skillId, level); if (skillDialog) { - if (!skillDialog->updateSkill(skillId, range, up)) - skillDialog->addSkill(skillId, "", level, range, up); + if (!skillDialog->updateSkill(skillId, range, up, inf)) + skillDialog->addSkill(skillId, "", level, range, up, inf); } } if (updateSkill && skillDialog) |