diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-10-07 13:22:17 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-10-07 13:22:17 +0300 |
commit | ffff40ebf2296b68794172c86d0e0115a3c102d8 (patch) | |
tree | bc0cb5fd5b7e98e234cb193a57832406b19b3d9b | |
parent | 561146476411a5df4610427123d3bdbd2c006515 (diff) | |
download | manaplus-ffff40ebf2296b68794172c86d0e0115a3c102d8.tar.gz manaplus-ffff40ebf2296b68794172c86d0e0115a3c102d8.tar.bz2 manaplus-ffff40ebf2296b68794172c86d0e0115a3c102d8.tar.xz manaplus-ffff40ebf2296b68794172c86d0e0115a3c102d8.zip |
Add reading guild skills in processGuildSkillInfo.
-rw-r--r-- | src/net/ea/guildhandler.cpp | 39 | ||||
-rw-r--r-- | src/resources/skillowner.h | 3 |
2 files changed, 27 insertions, 15 deletions
diff --git a/src/net/ea/guildhandler.cpp b/src/net/ea/guildhandler.cpp index 04b602c63..2364cfa9a 100644 --- a/src/net/ea/guildhandler.cpp +++ b/src/net/ea/guildhandler.cpp @@ -26,8 +26,10 @@ #include "notifymanager.h" #include "being/localplayer.h" +#include "being/playerinfo.h" #include "gui/windows/chatwindow.h" +#include "gui/windows/skilldialog.h" #include "gui/windows/socialwindow.h" #include "net/messagein.h" @@ -325,24 +327,33 @@ void GuildHandler::processGuildEmblem(Net::MessageIn &msg) const void GuildHandler::processGuildSkillInfo(Net::MessageIn &msg) const { - const int length = msg.readInt16(); - const int count = (length - 6) / 37; - - msg.readInt16(); // 'Skill point' + const int count = (msg.readInt16("len") - 6) / 37; + msg.readInt16("skill points"); - if (length < 6) - return; + if (skillDialog) + skillDialog->hideSkills(SkillOwner::Guild); for (int i = 0; i < count; i++) { - msg.readInt16(); // ID - msg.readInt16(); // 'Info' (unknown atm) - msg.readInt16(); // 0 unused - msg.readInt16(); // Level - msg.readInt16(); // SP - msg.readInt16(); // 'Range' - msg.skip(24); // 0 unused - msg.readUInt8(); // Can be increased + const int skillId = msg.readInt16("skill id"); + const SkillType::SkillType inf = static_cast<SkillType::SkillType>( + msg.readInt32("inf")); + const int level = msg.readInt16("skill level"); + 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"); + PlayerInfo::setSkillLevel(skillId, level); + if (skillDialog) + { + if (!skillDialog->updateSkill(skillId, range, up, inf, sp)) + { + skillDialog->addSkill(SkillOwner::Guild, + skillId, name, level, range, up, inf, sp); + } + } } + if (skillDialog) + skillDialog->updateModels(); } void GuildHandler::processGuildNotice(Net::MessageIn &msg) const diff --git a/src/resources/skillowner.h b/src/resources/skillowner.h index 7820bba64..55473ae40 100644 --- a/src/resources/skillowner.h +++ b/src/resources/skillowner.h @@ -27,7 +27,8 @@ namespace SkillOwner { Player = 0, Mercenary = 1, - Homunculus = 2 + Homunculus = 2, + Guild = 3 }; } |