diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-09-06 13:29:42 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-09-06 13:29:42 +0300 |
commit | 83a6463a88b4b5eda003f55b419995c13476d917 (patch) | |
tree | 94df4a85319146e17ebe89ce82c6c3a0e1d9b138 | |
parent | 8a23a928d99d79b0d48961a225c3656ca42f34f0 (diff) | |
download | manaplus-83a6463a88b4b5eda003f55b419995c13476d917.tar.gz manaplus-83a6463a88b4b5eda003f55b419995c13476d917.tar.bz2 manaplus-83a6463a88b4b5eda003f55b419995c13476d917.tar.xz manaplus-83a6463a88b4b5eda003f55b419995c13476d917.zip |
In skills add support for reading mana cost from server.
-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 | 8 | ||||
-rw-r--r-- | src/gui/windows/skilldialog.h | 6 | ||||
-rw-r--r-- | src/net/ea/skillhandler.cpp | 7 | ||||
-rw-r--r-- | src/net/eathena/skillhandler.cpp | 6 | ||||
-rw-r--r-- | src/net/tmwa/skillhandler.cpp | 6 |
7 files changed, 22 insertions, 13 deletions
diff --git a/src/gui/widgets/skillinfo.cpp b/src/gui/widgets/skillinfo.cpp index bd889865d..29b9510ee 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), + sp(0), type(SkillType::Unknown), modifiable(false), visible(false) diff --git a/src/gui/widgets/skillinfo.h b/src/gui/widgets/skillinfo.h index 1d9dfeacd..bdeac330d 100644 --- a/src/gui/widgets/skillinfo.h +++ b/src/gui/widgets/skillinfo.h @@ -55,6 +55,7 @@ struct SkillInfo final int skillLevelWidth; unsigned int id; int range; + int sp; SkillType::SkillType type; bool modifiable; bool visible; diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp index 35f33f63d..842292e2e 100644 --- a/src/gui/windows/skilldialog.cpp +++ b/src/gui/windows/skilldialog.cpp @@ -346,7 +346,8 @@ void SkillDialog::loadXmlFile(const std::string &fileName) bool SkillDialog::updateSkill(const int id, const int range, const bool modifiable, - const SkillType::SkillType type) + const SkillType::SkillType type, + const int sp) { const SkillMap::const_iterator it = mSkills.find(id); @@ -358,6 +359,7 @@ bool SkillDialog::updateSkill(const int id, info->modifiable = modifiable; info->range = range; info->type = type; + info->sp = sp; info->update(); } return true; @@ -370,7 +372,8 @@ void SkillDialog::addSkill(const int id, const int level, const int range, const bool modifiable, - const SkillType::SkillType type) + const SkillType::SkillType type, + const int sp) { if (mDefaultModel) { @@ -398,6 +401,7 @@ void SkillDialog::addSkill(const int id, // TRANSLATORS: skills dialog. skill level skill->skillLevel = strprintf(_("Lvl: %d"), level); skill->range = range; + skill->sp = sp; skill->update(); skill->useButton = _("Use"); mDefaultModel->addSkill(skill); diff --git a/src/gui/windows/skilldialog.h b/src/gui/windows/skilldialog.h index c67d69b10..17641cd0f 100644 --- a/src/gui/windows/skilldialog.h +++ b/src/gui/windows/skilldialog.h @@ -80,14 +80,16 @@ class SkillDialog final : public Window, bool updateSkill(const int id, const int range, const bool modifiable, - const SkillType::SkillType type); + const SkillType::SkillType type, + const int sp); void addSkill(const int id, const std::string &name, const int level, const int range, const bool modifiable, - const SkillType::SkillType type); + const SkillType::SkillType type, + const int sp); SkillInfo* getSkill(const int id) const A_WARN_UNUSED; diff --git a/src/net/ea/skillhandler.cpp b/src/net/ea/skillhandler.cpp index 8a7f42d82..19f7d4d63 100644 --- a/src/net/ea/skillhandler.cpp +++ b/src/net/ea/skillhandler.cpp @@ -79,7 +79,7 @@ void SkillHandler::processPlayerSkillUp(Net::MessageIn &msg) { const int skillId = msg.readInt16(); const int level = msg.readInt16(); - msg.readInt16(); // sp + const int sp = msg.readInt16(); const int range = msg.readInt16(); const int up = msg.readUInt8(); @@ -88,10 +88,11 @@ void SkillHandler::processPlayerSkillUp(Net::MessageIn &msg) PlayerInfo::setSkillLevel(skillId, level); if (skillDialog) { - if (!skillDialog->updateSkill(skillId, range, up, SkillType::Unknown)) + if (!skillDialog->updateSkill(skillId, range, + up, SkillType::Unknown, sp)) { skillDialog->addSkill(skillId, "", level, - range, up, SkillType::Unknown); + range, up, SkillType::Unknown, sp); } } } diff --git a/src/net/eathena/skillhandler.cpp b/src/net/eathena/skillhandler.cpp index a66987f71..ef0b7d399 100644 --- a/src/net/eathena/skillhandler.cpp +++ b/src/net/eathena/skillhandler.cpp @@ -112,7 +112,7 @@ void SkillHandler::processPlayerSkills(Net::MessageIn &msg) const SkillType::SkillType inf = static_cast<SkillType::SkillType>( msg.readInt32("inf")); const int level = msg.readInt16("skill level"); - msg.readInt16("sp"); + const int sp = msg.readInt16("sp"); const int range = msg.readInt16("range"); const std::string name = msg.readString(24, "skill name"); const int up = msg.readUInt8("up flag"); @@ -122,8 +122,8 @@ void SkillHandler::processPlayerSkills(Net::MessageIn &msg) PlayerInfo::setSkillLevel(skillId, level); if (skillDialog) { - if (!skillDialog->updateSkill(skillId, range, up, inf)) - skillDialog->addSkill(skillId, name, level, range, up, inf); + if (!skillDialog->updateSkill(skillId, range, up, inf, sp)) + skillDialog->addSkill(skillId, name, level, range, up, inf, sp); } } if (updateSkill && skillDialog) diff --git a/src/net/tmwa/skillhandler.cpp b/src/net/tmwa/skillhandler.cpp index 65f86d4bc..da6a04b7e 100644 --- a/src/net/tmwa/skillhandler.cpp +++ b/src/net/tmwa/skillhandler.cpp @@ -113,7 +113,7 @@ void SkillHandler::processPlayerSkills(Net::MessageIn &msg) msg.readInt16()); msg.skip(2); // skill pool flags const int level = msg.readInt16(); - msg.readInt16(); // sp + const int sp = msg.readInt16(); const int range = msg.readInt16(); msg.skip(24); // 0 unused const int up = msg.readUInt8(); @@ -123,8 +123,8 @@ void SkillHandler::processPlayerSkills(Net::MessageIn &msg) PlayerInfo::setSkillLevel(skillId, level); if (skillDialog) { - if (!skillDialog->updateSkill(skillId, range, up, inf)) - skillDialog->addSkill(skillId, "", level, range, up, inf); + if (!skillDialog->updateSkill(skillId, range, up, inf, sp)) + skillDialog->addSkill(skillId, "", level, range, up, inf, sp); } } if (updateSkill && skillDialog) |