From ca342d3fbdc5796c80452bd0a1abbe1ecc7937f0 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 23 Oct 2014 22:27:50 +0300 Subject: Add packet fields comments in skillhandler. --- src/net/ea/skillhandler.cpp | 10 ++++---- src/net/eathena/skillhandler.cpp | 18 +++++++-------- src/net/tmwa/skillhandler.cpp | 50 ++++++++++++++++++++-------------------- 3 files changed, 39 insertions(+), 39 deletions(-) diff --git a/src/net/ea/skillhandler.cpp b/src/net/ea/skillhandler.cpp index 5f26a5203..d55404e50 100644 --- a/src/net/ea/skillhandler.cpp +++ b/src/net/ea/skillhandler.cpp @@ -39,11 +39,11 @@ SkillHandler::SkillHandler() void SkillHandler::processPlayerSkillUp(Net::MessageIn &msg) { - const int skillId = msg.readInt16(); - const int level = msg.readInt16(); - const int sp = msg.readInt16(); - const int range = msg.readInt16(); - const int up = msg.readUInt8(); + const int skillId = msg.readInt16("skill id"); + const int level = msg.readInt16("skill level"); + const int sp = msg.readInt16("sp"); + const int range = msg.readInt16("range"); + const int up = msg.readUInt8("up flag"); if (skillDialog && PlayerInfo::getSkillLevel(skillId) != level) skillDialog->playUpdateEffect(skillId); diff --git a/src/net/eathena/skillhandler.cpp b/src/net/eathena/skillhandler.cpp index 73a3793ef..b62f04440 100644 --- a/src/net/eathena/skillhandler.cpp +++ b/src/net/eathena/skillhandler.cpp @@ -116,19 +116,19 @@ void SkillHandler::useBeing(const int id, const int level, const int beingId) const { createOutPacket(CMSG_SKILL_USE_BEING); - outMsg.writeInt16(static_cast(id)); - outMsg.writeInt16(static_cast(level)); - outMsg.writeInt32(beingId); + outMsg.writeInt16(static_cast(id), "skill id"); + outMsg.writeInt16(static_cast(level), "skill level"); + outMsg.writeInt32(beingId, "target id"); } void SkillHandler::usePos(const int id, const int level, const int x, const int y) const { createOutPacket(CMSG_SKILL_USE_POSITION); - outMsg.writeInt16(static_cast(level)); - outMsg.writeInt16(static_cast(id)); - outMsg.writeInt16(static_cast(x)); - outMsg.writeInt16(static_cast(y)); + outMsg.writeInt16(static_cast(level), "skill level"); + outMsg.writeInt16(static_cast(id), "skill id"); + outMsg.writeInt16(static_cast(x), "x"); + outMsg.writeInt16(static_cast(y), "y"); } void SkillHandler::usePos(const int id, const int level, @@ -146,8 +146,8 @@ void SkillHandler::usePos(const int id, const int level, void SkillHandler::useMap(const int id, const std::string &map) const { createOutPacket(CMSG_SKILL_USE_MAP); - outMsg.writeInt16(static_cast(id)); - outMsg.writeString(map, 16); + outMsg.writeInt16(static_cast(id), "skill id"); + outMsg.writeString(map, 16, "map name"); } void SkillHandler::processPlayerSkills(Net::MessageIn &msg) diff --git a/src/net/tmwa/skillhandler.cpp b/src/net/tmwa/skillhandler.cpp index 344664d36..13e5984cf 100644 --- a/src/net/tmwa/skillhandler.cpp +++ b/src/net/tmwa/skillhandler.cpp @@ -86,19 +86,19 @@ void SkillHandler::useBeing(const int id, const int level, const int beingId) const { createOutPacket(CMSG_SKILL_USE_BEING); - outMsg.writeInt16(static_cast(id)); - outMsg.writeInt16(static_cast(level)); - outMsg.writeInt32(beingId); + outMsg.writeInt16(static_cast(id), "skill id"); + outMsg.writeInt16(static_cast(level), "level"); + outMsg.writeInt32(beingId, "target id"); } void SkillHandler::usePos(const int id, const int level, const int x, const int y) const { createOutPacket(CMSG_SKILL_USE_POSITION); - outMsg.writeInt16(static_cast(level)); - outMsg.writeInt16(static_cast(id)); - outMsg.writeInt16(static_cast(x)); - outMsg.writeInt16(static_cast(y)); + outMsg.writeInt16(static_cast(level), "skill level"); + outMsg.writeInt16(static_cast(id), "skill id"); + outMsg.writeInt16(static_cast(x), "x"); + outMsg.writeInt16(static_cast(y), "y"); } void SkillHandler::usePos(const int id, const int level, @@ -106,8 +106,8 @@ void SkillHandler::usePos(const int id, const int level, const std::string &text) const { createOutPacket(CMSG_SKILL_USE_POSITION_MORE); - outMsg.writeInt16(static_cast(level), "level"); - outMsg.writeInt16(static_cast(id), "id"); + outMsg.writeInt16(static_cast(level), "skill level"); + outMsg.writeInt16(static_cast(id), "skill id"); outMsg.writeInt16(static_cast(x), "x"); outMsg.writeInt16(static_cast(y), "y"); outMsg.writeString(text, 80, "text"); @@ -116,27 +116,27 @@ void SkillHandler::usePos(const int id, const int level, void SkillHandler::useMap(const int id, const std::string &map) const { createOutPacket(CMSG_SKILL_USE_MAP); - outMsg.writeInt16(static_cast(id)); - outMsg.writeString(map, 16); + outMsg.writeInt16(static_cast(id), "skill id"); + outMsg.writeString(map, 16, "map name"); } void SkillHandler::processPlayerSkills(Net::MessageIn &msg) { - msg.readInt16(); // length + msg.readInt16("len"); const int skillCount = (msg.getLength() - 4) / 37; int updateSkill = 0; for (int k = 0; k < skillCount; k++) { - const int skillId = msg.readInt16(); + const int skillId = msg.readInt16("skill id"); const SkillType::SkillType inf = static_cast( - msg.readInt16()); - msg.skip(2); // skill pool flags - const int level = msg.readInt16(); - const int sp = msg.readInt16(); - const int range = msg.readInt16(); - msg.skip(24); // 0 unused - const int up = msg.readUInt8(); + msg.readInt16("inf")); + msg.readInt16("skill pool flags"); + const int level = msg.readInt16("skill level"); + const int sp = msg.readInt16("sp"); + const int range = msg.readInt16("range"); + msg.skip(24, "unused"); + const int up = msg.readUInt8("up flag"); const int oldLevel = PlayerInfo::getSkillLevel(skillId); if (oldLevel && oldLevel != level) updateSkill = skillId; @@ -162,11 +162,11 @@ void SkillHandler::processSkillFailed(Net::MessageIn &msg) { // Action failed (ex. sit because you have not reached the // right level) - const int skillId = msg.readInt16(); - const int16_t bskill = msg.readInt16(); - msg.readInt16(); // btype - const signed char success = msg.readUInt8(); - const signed char reason = msg.readUInt8(); + const int skillId = msg.readInt16("skill id"); + const int16_t bskill = msg.readInt16("bskill"); + msg.readInt16("btype"); + const signed char success = msg.readUInt8("success"); + const signed char reason = msg.readUInt8("reason"); if (success != static_cast(SKILL_FAILED) && bskill == static_cast(BSKILL_EMOTE)) { -- cgit v1.2.3-70-g09d2