diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-09-01 18:33:19 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-09-06 01:18:54 +0300 |
commit | 217977222694d020de203c5f6700d2acf55ff7b1 (patch) | |
tree | a0db98baca6ed1621195a6bf35aefc91f06b12eb /src/net | |
parent | 85a76ba64399e558cfb6f5982ac9496fda437bf3 (diff) | |
download | manaverse-217977222694d020de203c5f6700d2acf55ff7b1.tar.gz manaverse-217977222694d020de203c5f6700d2acf55ff7b1.tar.bz2 manaverse-217977222694d020de203c5f6700d2acf55ff7b1.tar.xz manaverse-217977222694d020de203c5f6700d2acf55ff7b1.zip |
add packet comments in beinghandler.
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/ea/beinghandler.cpp | 155 | ||||
-rw-r--r-- | src/net/eathena/beinghandler.cpp | 134 | ||||
-rw-r--r-- | src/net/tmwa/beinghandler.cpp | 168 |
3 files changed, 231 insertions, 226 deletions
diff --git a/src/net/ea/beinghandler.cpp b/src/net/ea/beinghandler.cpp index cd8158781..df2cbc443 100644 --- a/src/net/ea/beinghandler.cpp +++ b/src/net/ea/beinghandler.cpp @@ -109,7 +109,7 @@ void BeingHandler::processBeingMove2(Net::MessageIn &msg) const * later versions of eAthena for both mobs and * players */ - Being *const dstBeing = actorManager->findBeing(msg.readInt32()); + Being *const dstBeing = actorManager->findBeing(msg.readInt32("being id")); /* * This packet doesn't have enough info to actually @@ -124,8 +124,8 @@ void BeingHandler::processBeingMove2(Net::MessageIn &msg) const } uint16_t srcX, srcY, dstX, dstY; - msg.readCoordinatePair(srcX, srcY, dstX, dstY); - msg.readInt32(); // Server tick + msg.readCoordinatePair(srcX, srcY, dstX, dstY, "move path"); + msg.readInt32("tick"); dstBeing->setAction(BeingAction::STAND, 0); dstBeing->setTileCoords(srcX, srcY); @@ -139,12 +139,12 @@ void BeingHandler::processBeingSpawn(Net::MessageIn &msg) { BLOCK_START("BeingHandler::processBeingSpawn") // skipping this packet - mSpawnId = msg.readInt32(); // id - msg.readInt16(); // speed - msg.readInt16(); // opt1 - msg.readInt16(); // opt2 - msg.readInt16(); // option - msg.readInt16(); // disguise + mSpawnId = msg.readInt32("being id"); + msg.readInt16("speed"); + msg.readInt16("opt1"); + msg.readInt16("opt2"); + msg.readInt16("option"); + msg.readInt16("disguise"); BLOCK_END("BeingHandler::processBeingSpawn") } @@ -159,7 +159,7 @@ void BeingHandler::processBeingRemove(Net::MessageIn &msg) const // A being should be removed or has died - const int id = msg.readInt32(); + const int id = msg.readInt32("being id"); Being *const dstBeing = actorManager->findBeing(id); if (!dstBeing) { @@ -174,7 +174,7 @@ void BeingHandler::processBeingRemove(Net::MessageIn &msg) const if (dstBeing == localPlayer->getTarget()) localPlayer->stopAttack(true); - if (msg.readUInt8() == 1U) + if (msg.readUInt8("dead flag?") == 1U) { if (dstBeing->getCurrentAction() != BeingAction::DEAD) { @@ -209,7 +209,7 @@ void BeingHandler::processBeingResurrect(Net::MessageIn &msg) const // A being changed mortality status - const int id = msg.readInt32(); + const int id = msg.readInt32("being id"); Being *const dstBeing = actorManager->findBeing(id); if (!dstBeing) { @@ -221,7 +221,7 @@ void BeingHandler::processBeingResurrect(Net::MessageIn &msg) const if (dstBeing == localPlayer->getTarget()) localPlayer->stopAttack(); - if (msg.readUInt8() == 1U) + if (msg.readUInt8("flag?") == 1U) dstBeing->setAction(BeingAction::STAND, 0); BLOCK_END("BeingHandler::processBeingResurrect") } @@ -235,16 +235,18 @@ void BeingHandler::processSkillDamage(Net::MessageIn &msg) const return; } - const int id = msg.readInt16(); // Skill Id - Being *const srcBeing = actorManager->findBeing(msg.readInt32()); - Being *const dstBeing = actorManager->findBeing(msg.readInt32()); - msg.readInt32(); // Server tick - msg.readInt32(); // src speed - msg.readInt32(); // dst speed - const int param1 = msg.readInt32(); // Damage - const int level = msg.readInt16(); // Skill level - msg.readInt16(); // Div - msg.readUInt8(); // Skill hit/type (?) + const int id = msg.readInt16("skill id"); + Being *const srcBeing = actorManager->findBeing( + msg.readInt32("src being id")); + Being *const dstBeing = actorManager->findBeing( + msg.readInt32("dst being id")); + msg.readInt32("tick"); + msg.readInt32("src speed"); + msg.readInt32("dst speed"); + const int param1 = msg.readInt32("damage"); + const int level = msg.readInt16("skill level"); + msg.readInt16("div"); + msg.readUInt8("skill hit/type?"); if (srcBeing) srcBeing->handleSkill(dstBeing, param1, id, level); if (dstBeing) @@ -261,16 +263,18 @@ void BeingHandler::processBeingAction(Net::MessageIn &msg) const return; } - Being *const srcBeing = actorManager->findBeing(msg.readInt32()); - Being *const dstBeing = actorManager->findBeing(msg.readInt32()); + Being *const srcBeing = actorManager->findBeing( + msg.readInt32("src being id")); + Being *const dstBeing = actorManager->findBeing( + msg.readInt32("dst being id")); - msg.readInt32(); // server tick - const int srcSpeed = msg.readInt32(); // src speed - msg.readInt32(); // dst speed - const int param1 = msg.readInt16(); - msg.readInt16(); // param 2 - const uint8_t type = msg.readUInt8(); - msg.readInt16(); // param 3 + msg.readInt32("tick"); + const int srcSpeed = msg.readInt32("src speed"); + msg.readInt32("dst speed"); + const int param1 = msg.readInt16("param1"); + msg.readInt16("param 2"); + const uint8_t type = msg.readUInt8("type"); + msg.readInt16("param 3"); switch (type) { @@ -350,7 +354,7 @@ void BeingHandler::processBeingSelfEffect(Net::MessageIn &msg) const return; } - const int id = static_cast<uint32_t>(msg.readInt32()); + const int id = static_cast<uint32_t>(msg.readInt32("being id")); Being *const being = actorManager->findBeing(id); if (!being) { @@ -358,7 +362,7 @@ void BeingHandler::processBeingSelfEffect(Net::MessageIn &msg) const return; } - const int effectType = msg.readInt32(); + const int effectType = msg.readInt32("effect type"); if (Particle::enabled) effectManager->trigger(effectType, being); @@ -381,7 +385,7 @@ void BeingHandler::processBeingEmotion(Net::MessageIn &msg) const return; } - Being *const dstBeing = actorManager->findBeing(msg.readInt32()); + Being *const dstBeing = actorManager->findBeing(msg.readInt32("being id")); if (!dstBeing) { BLOCK_END("BeingHandler::processBeingEmotion") @@ -390,7 +394,7 @@ void BeingHandler::processBeingEmotion(Net::MessageIn &msg) const if (player_relations.hasPermission(dstBeing, PlayerRelation::EMOTE)) { - const uint8_t emote = msg.readUInt8(); + const uint8_t emote = msg.readUInt8("emote"); if (emote) { dstBeing->setEmote(emote, 0); @@ -411,7 +415,7 @@ void BeingHandler::processNameResponse(Net::MessageIn &msg) const return; } - const int beingId = msg.readInt32(); + const int beingId = msg.readInt32("being id"); Being *const dstBeing = actorManager->findBeing(beingId); if (dstBeing) @@ -422,7 +426,7 @@ void BeingHandler::processNameResponse(Net::MessageIn &msg) const } else { - dstBeing->setName(msg.readString(24)); + dstBeing->setName(msg.readString(24, "name")); dstBeing->updateGuild(); dstBeing->addToCache(); @@ -456,9 +460,9 @@ void BeingHandler::processIpResponse(Net::MessageIn &msg) const return; } - Being *const dstBeing = actorManager->findBeing(msg.readInt32()); + Being *const dstBeing = actorManager->findBeing(msg.readInt32("being id")); if (dstBeing) - dstBeing->setIp(ipToString(msg.readInt32())); + dstBeing->setIp(ipToString(msg.readInt32("ip address"))); BLOCK_END("BeingHandler::processIpResponse") } @@ -471,22 +475,22 @@ void BeingHandler::processPlayerGuilPartyInfo(Net::MessageIn &msg) const return; } - Being *const dstBeing = actorManager->findBeing(msg.readInt32()); + Being *const dstBeing = actorManager->findBeing(msg.readInt32("being id")); if (dstBeing) { - dstBeing->setPartyName(msg.readString(24)); + dstBeing->setPartyName(msg.readString(24, "party name")); if (!guildManager || !GuildManager::getEnableGuildBot()) { - dstBeing->setGuildName(msg.readString(24)); - dstBeing->setGuildPos(msg.readString(24)); + dstBeing->setGuildName(msg.readString(24, "guild name")); + dstBeing->setGuildPos(msg.readString(24, "guild pos")); } else { msg.skip(48); } dstBeing->addToCache(); - msg.readString(24); // Discard this + msg.readString(24, "?"); } BLOCK_END("BeingHandler::processPlayerGuilPartyInfo") } @@ -500,7 +504,7 @@ void BeingHandler::processBeingChangeDirection(Net::MessageIn &msg) const return; } - Being *const dstBeing = actorManager->findBeing(msg.readInt32()); + Being *const dstBeing = actorManager->findBeing(msg.readInt32("being id")); if (!dstBeing) { @@ -508,9 +512,10 @@ void BeingHandler::processBeingChangeDirection(Net::MessageIn &msg) const return; } - msg.readInt16(); // unused + msg.readInt16("unused"); - const uint8_t dir = static_cast<uint8_t>(msg.readUInt8() & 0x0FU); + const uint8_t dir = static_cast<uint8_t>( + msg.readUInt8("direction") & 0x0FU); dstBeing->setDirection(dir); if (localPlayer) localPlayer->imitateDirection(dstBeing, dir); @@ -526,15 +531,15 @@ void BeingHandler::processPlayerStop(Net::MessageIn &msg) const return; } - const int id = msg.readInt32(); + const int id = msg.readInt32("account id"); if (mSync || id != localPlayer->getId()) { Being *const dstBeing = actorManager->findBeing(id); if (dstBeing) { - const uint16_t x = msg.readInt16(); - const uint16_t y = msg.readInt16(); + const uint16_t x = msg.readInt16("x"); + const uint16_t y = msg.readInt16("y"); dstBeing->setTileCoords(x, y); if (dstBeing->getCurrentAction() == BeingAction::MOVE) dstBeing->setAction(BeingAction::STAND, 0); @@ -568,15 +573,15 @@ void BeingHandler::processPlaterStatusChange(Net::MessageIn &msg) const } // Change in players' flags - const int id = msg.readInt32(); + const int id = msg.readInt32("account id"); Being *const dstBeing = actorManager->findBeing(id); if (!dstBeing) return; - const uint16_t stunMode = msg.readInt16(); - uint32_t statusEffects = msg.readInt16(); - statusEffects |= (static_cast<uint32_t>(msg.readInt16())) << 16; - msg.readUInt8(); // Unused? + const uint16_t stunMode = msg.readInt16("stun mode"); + uint32_t statusEffects = msg.readInt16("status effect"); + statusEffects |= (static_cast<uint32_t>(msg.readInt16("opt?"))) << 16; + msg.readUInt8("Unused?"); dstBeing->setStunMode(stunMode); dstBeing->setStatusEffectBlock(0, static_cast<uint16_t>( @@ -596,9 +601,9 @@ void BeingHandler::processBeingStatusChange(Net::MessageIn &msg) const } // Status change - const uint16_t status = msg.readInt16(); - const int id = msg.readInt32(); - const bool flag = msg.readUInt8(); // 0: stop, 1: start + const uint16_t status = msg.readInt16("status"); + const int id = msg.readInt32("being id"); + const bool flag = msg.readUInt8("flag: 0: stop, 1: start"); Being *const dstBeing = actorManager->findBeing(id); if (dstBeing) @@ -608,22 +613,22 @@ void BeingHandler::processBeingStatusChange(Net::MessageIn &msg) const void BeingHandler::processSkilCasting(Net::MessageIn &msg) const { - msg.readInt32(); // src id - msg.readInt32(); // dst id - msg.readInt16(); // dst x - msg.readInt16(); // dst y - msg.readInt16(); // skill num - msg.readInt32(); // skill get pl - msg.readInt32(); // cast time + msg.readInt32("src id"); + msg.readInt32("dst id"); + msg.readInt16("dst x"); + msg.readInt16("dst y"); + msg.readInt16("skill num"); + msg.readInt32("skill get p1"); + msg.readInt32("cast time"); } void BeingHandler::processSkillNoDamage(Net::MessageIn &msg) const { - msg.readInt16(); // skill id - msg.readInt16(); // heal - msg.readInt32(); // dst id - msg.readInt32(); // src id - msg.readUInt8(); // fail + msg.readInt16("skill id"); + msg.readInt16("heal"); + msg.readInt32("dst id"); + msg.readInt32("src id"); + msg.readUInt8("fail"); } void BeingHandler::processPvpMapMode(Net::MessageIn &msg) const @@ -638,16 +643,16 @@ void BeingHandler::processPvpMapMode(Net::MessageIn &msg) const Map *const map = game->getCurrentMap(); if (map) - map->setPvpMode(msg.readInt16()); + map->setPvpMode(msg.readInt16("pvp mode")); BLOCK_END("BeingHandler::processPvpMapMode") } void BeingHandler::processPvpSet(Net::MessageIn &msg) const { BLOCK_START("BeingHandler::processPvpSet") - const int id = msg.readInt32(); // id - const int rank = msg.readInt32(); // rank - msg.readInt32(); // num + const int id = msg.readInt32("being id"); + const int rank = msg.readInt32("rank"); + msg.readInt32("num"); if (actorManager) { Being *const dstBeing = actorManager->findBeing(id); diff --git a/src/net/eathena/beinghandler.cpp b/src/net/eathena/beinghandler.cpp index 7f42306e9..bda2ef7fc 100644 --- a/src/net/eathena/beinghandler.cpp +++ b/src/net/eathena/beinghandler.cpp @@ -199,7 +199,7 @@ void BeingHandler::handleMessage(Net::MessageIn &msg) break; case SMSG_SKILL_CAST_CANCEL: - msg.readInt32(); // id + msg.readInt32("id?"); break; case SMSG_SKILL_NO_DAMAGE: @@ -247,7 +247,7 @@ void BeingHandler::processBeingChangeLook(Net::MessageIn &msg) const */ Being *const dstBeing = actorManager->findBeing( - msg.readInt32("accound id")); + msg.readInt32("being id")); if (!dstBeing) return; @@ -259,7 +259,7 @@ void BeingHandler::processBeingChangeLook(Net::MessageIn &msg) const if (!look2) { - id = static_cast<int>(msg.readUInt8()); + id = static_cast<int>(msg.readUInt8("id")); id2 = 1U; // default color } else @@ -371,9 +371,9 @@ void BeingHandler::processNameResponse2(Net::MessageIn &msg) if (!actorManager || !localPlayer) return; - const int len = msg.readInt16(); - const int beingId = msg.readInt32(); - const std::string str = msg.readString(len - 8); + const int len = msg.readInt16("len"); + const int beingId = msg.readInt32("being id"); + const std::string str = msg.readString(len - 8, "name"); Being *const dstBeing = actorManager->findBeing(beingId); if (dstBeing) { @@ -429,13 +429,12 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg) const } // An update about a player, potentially including movement. - const int id = msg.readInt32(); - const int16_t speed = msg.readInt16(); - const uint16_t stunMode = msg.readInt16(); // opt1 - uint32_t statusEffects = msg.readInt16(); // opt2 - statusEffects |= (static_cast<uint16_t>(msg.readInt16())) - << 16U; // status.options; Aethyra uses this as misc2 - const int16_t job = msg.readInt16(); + const int id = msg.readInt32("account id"); + const int16_t speed = msg.readInt16("speed"); + const uint16_t stunMode = msg.readInt16("opt1"); + uint32_t statusEffects = msg.readInt16("opt2"); + statusEffects |= (static_cast<uint16_t>(msg.readInt16("options"))) << 16U; + const int16_t job = msg.readInt16("class"); int disguiseId = 0; if (id < 110000000 && job >= 1000) disguiseId = job; @@ -475,24 +474,24 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg) const dstBeing->setWalkSpeed(Vector(speed, speed, 0)); dstBeing->setSubtype(job, 0); - const int hairStyle = msg.readInt16(); - const uint16_t weapon = msg.readInt16(); - const uint16_t shield = msg.readInt16(); - const uint16_t headBottom = msg.readInt16(); + const int hairStyle = msg.readInt16("hair style"); + const uint16_t weapon = msg.readInt16("weapon"); + const uint16_t shield = msg.readInt16("shield"); + const uint16_t headBottom = msg.readInt16("head bottom"); if (msgType == 3) - msg.readInt32(); // server tick + msg.readInt32("tick"); - const uint16_t headTop = msg.readInt16(); - const uint16_t headMid = msg.readInt16(); - const int hairColor = msg.readInt16(); + const uint16_t headTop = msg.readInt16("head top"); + const uint16_t headMid = msg.readInt16("head mid"); + const int hairColor = msg.readInt16("hair color"); - msg.readUInt8(); - msg.readUInt8(); - msg.readUInt8(); - msg.readUInt8(); // unused + msg.readUInt8("unused?"); + msg.readUInt8("unused?"); + msg.readUInt8("unused?"); + msg.readUInt8("unused?"); - const int guild = msg.readInt32(); // guild + const int guild = msg.readInt32("guild"); if (!guildManager || !GuildManager::getEnableGuildBot()) { @@ -502,13 +501,12 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg) const dstBeing->setGuild(Guild::getGuild(static_cast<int16_t>(guild))); } - msg.readInt16(); // emblem - msg.readInt16(); // manner - dstBeing->setStatusEffectBlock(32, msg.readInt16()); // opt3 - msg.readUInt8(); // karma + msg.readInt16("emblem"); + msg.readInt16("manner"); + dstBeing->setStatusEffectBlock(32, msg.readInt16("opt3")); + msg.readUInt8("karma"); // reserving bit for future usage - dstBeing->setGender(Being::intToGender( - static_cast<uint8_t>(msg.readUInt8() & 3U))); + dstBeing->setGender(Being::intToGender(msg.readUInt8("gender"))); if (!disguiseId) { @@ -527,7 +525,7 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg) const if (msgType == 3) { uint16_t srcX, srcY, dstX, dstY; - msg.readCoordinatePair(srcX, srcY, dstX, dstY); + msg.readCoordinatePair(srcX, srcY, dstX, dstY, "move path"); localPlayer->followMoveTo(dstBeing, srcX, srcY, dstX, dstY); @@ -556,21 +554,21 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg) const else { uint16_t x, y; - msg.readCoordinates(x, y, dir); + msg.readCoordinates(x, y, dir, "position"); dstBeing->setTileCoords(x, y); dstBeing->setDirection(dir); localPlayer->imitateDirection(dstBeing, dir); } - const uint16_t gmstatus = msg.readInt16(); + const uint16_t gmstatus = msg.readInt16("gm status"); if (gmstatus & 0x80) dstBeing->setGM(true); if (msgType == 1 || msgType == 2) { - const uint8_t type = msg.readUInt8(); + const uint8_t type = msg.readUInt8("action type"); switch (type) { case 0: @@ -602,15 +600,15 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg) const } else if (msgType == 3) { - msg.readUInt8(); // unknown + msg.readUInt8("unknown?"); } - const int level = static_cast<int>(msg.readUInt8()); // Lv + const int level = static_cast<int>(msg.readUInt8("level")); if (level) dstBeing->setLevel(level); - msg.readUInt8(); // unknown + msg.readUInt8("unknown"); if (dstBeing->getType() != ActorType::PLAYER || msgType != 3) @@ -636,22 +634,22 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg) const bool visible = msg.getId() == SMSG_BEING_VISIBLE; if (visible) - msg.readUInt8(); // padding? + msg.readUInt8("padding?"); // Information about a being in range - const int id = msg.readInt32(); + const int id = msg.readInt32("being id"); int spawnId; if (id == mSpawnId) spawnId = mSpawnId; else spawnId = 0; mSpawnId = 0; - int16_t speed = msg.readInt16(); - const uint16_t stunMode = msg.readInt16(); // opt1 - uint32_t statusEffects = msg.readInt16(); // opt2 + int16_t speed = msg.readInt16("speed"); + const uint16_t stunMode = msg.readInt16("opt1"); + uint32_t statusEffects = msg.readInt16("opt2"); statusEffects |= (static_cast<uint16_t>( - msg.readInt16())) << 16U; // option - const int16_t job = msg.readInt16(); // class + msg.readInt16("option"))) << 16U; + const int16_t job = msg.readInt16("class"); Being *dstBeing = actorManager->findBeing(id); @@ -711,34 +709,34 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg) if (dstBeing->getType() == ActorType::MONSTER && localPlayer) localPlayer->checkNewName(dstBeing); - const int hairStyle = msg.readInt16(); - const uint16_t weapon = msg.readInt16(); - const uint16_t headBottom = msg.readInt16(); + const int hairStyle = msg.readInt16("hair style"); + const uint16_t weapon = msg.readInt16("weapon"); + const uint16_t headBottom = msg.readInt16("head bottom"); - const uint16_t shield = msg.readInt16(); - const uint16_t headTop = msg.readInt16(); - const uint16_t headMid = msg.readInt16(); - const int hairColor = msg.readInt16(); - const uint16_t shoes = msg.readInt16(); // clothes color + const uint16_t shield = msg.readInt16("shield"); + const uint16_t headTop = msg.readInt16("head top"); + const uint16_t headMid = msg.readInt16("head mid"); + const int hairColor = msg.readInt16("hair color"); + const uint16_t shoes = msg.readInt16("shoes or clothes color?"); uint16_t gloves; if (dstBeing->getType() == ActorType::MONSTER) { - msg.readInt32(); - msg.readInt32(); + msg.readInt32("?"); + msg.readInt32("?"); gloves = 0; } else { - gloves = msg.readInt16(); // head dir - "abused" as gloves - msg.readInt32(); // guild - msg.readInt16(); // guild emblem + gloves = msg.readInt16("head dir / gloves"); + msg.readInt32("guild"); + msg.readInt16("guild emblem"); } - msg.readInt16(); // manner - dstBeing->setStatusEffectBlock(32, msg.readInt16()); // opt3 - msg.readUInt8(); // karma - uint8_t gender = msg.readUInt8(); + msg.readInt16("manner"); + dstBeing->setStatusEffectBlock(32, msg.readInt16("opt3")); + msg.readUInt8("karma"); + uint8_t gender = msg.readUInt8("gender"); if (dstBeing->getType() == ActorType::PLAYER) { @@ -778,7 +776,7 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg) if (!visible) { uint16_t srcX, srcY, dstX, dstY; - msg.readCoordinatePair(srcX, srcY, dstX, dstY); + msg.readCoordinatePair(srcX, srcY, dstX, dstY, "move path"); dstBeing->setAction(BeingAction::STAND, 0); dstBeing->setTileCoords(srcX, srcY); dstBeing->setDestination(dstX, dstY); @@ -787,7 +785,7 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg) { uint8_t dir; uint16_t x, y; - msg.readCoordinates(x, y, dir); + msg.readCoordinates(x, y, dir, "position"); dstBeing->setTileCoords(x, y); if (job == 45 && socialWindow && outfitWindow) @@ -807,9 +805,9 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg) dstBeing->setDirection(dir); } - msg.readUInt8(); // unknown - msg.readUInt8(); // state / sit - msg.readInt16(); // level + msg.readUInt8("unknown"); + msg.readUInt8("action type?"); + msg.readInt16("level"); dstBeing->setStunMode(stunMode); dstBeing->setStatusEffectBlock(0, static_cast<uint16_t>( diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp index 0687c8e17..eb889146d 100644 --- a/src/net/tmwa/beinghandler.cpp +++ b/src/net/tmwa/beinghandler.cpp @@ -103,7 +103,7 @@ BeingHandler::BeingHandler(const bool enableSync) : void BeingHandler::requestNameById(const int id) const { MessageOut outMsg(CMSG_NAME_REQUEST); - outMsg.writeInt32(id); // readLong(2)); + outMsg.writeInt32(id, "being id"); } void BeingHandler::handleMessage(Net::MessageIn &msg) @@ -259,14 +259,15 @@ void BeingHandler::processBeingChangeLook(Net::MessageIn &msg) const * 16 bit value will be 0. */ - Being *const dstBeing = actorManager->findBeing(msg.readInt32()); + Being *const dstBeing = actorManager->findBeing( + msg.readInt32("being id")); if (!dstBeing) { BLOCK_END("BeingHandler::processBeingChangeLook") return; } - const uint8_t type = msg.readUInt8(); + const uint8_t type = msg.readUInt8("type"); int16_t id = 0; int id2 = 0; const std::string color; @@ -274,14 +275,14 @@ void BeingHandler::processBeingChangeLook(Net::MessageIn &msg) const if (!look2) { - id = static_cast<int16_t>(msg.readUInt8()); + id = static_cast<int16_t>(msg.readUInt8("id")); id2 = 1; // default color } else { // SMSG_BEING_CHANGE_LOOKS2 - id = msg.readInt16(); + id = msg.readInt16("id1"); if (type == 2 || serverVersion > 0) - id2 = msg.readInt16(); + id2 = msg.readInt16("id2"); else id2 = 1; } @@ -401,9 +402,9 @@ void BeingHandler::processNameResponse2(Net::MessageIn &msg) return; } - const int len = msg.readInt16(); - const int beingId = msg.readInt32(); - const std::string str = msg.readString(len - 8); + const int len = msg.readInt16("len"); + const int beingId = msg.readInt32("account ic"); + const std::string str = msg.readString(len - 8, "name"); Being *const dstBeing = actorManager->findBeing(beingId); if (dstBeing) { @@ -464,13 +465,13 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg) const } // An update about a player, potentially including movement. - const int id = msg.readInt32(); - const int16_t speed = msg.readInt16(); - const uint16_t stunMode = msg.readInt16(); // opt1; - uint32_t statusEffects = msg.readInt16(); // opt2; - statusEffects |= (static_cast<uint32_t>(msg.readInt16())) - << 16; // status.options; Aethyra uses this as misc2 - const int16_t job = msg.readInt16(); + const int id = msg.readInt32("account id"); + const int16_t speed = msg.readInt16("speed"); + const uint16_t stunMode = msg.readInt16("opt1"); + uint32_t statusEffects = msg.readInt16("opt2"); + statusEffects |= (static_cast<uint32_t>(msg.readInt16("options"))) + << 16; + const int16_t job = msg.readInt16("job"); int disguiseId = 0; if (id < 110000000 && job >= 1000) disguiseId = job; @@ -514,29 +515,29 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg) const dstBeing->setWalkSpeed(Vector(speed, speed, 0)); - const uint8_t hairStyle = msg.readUInt8(); - const uint8_t look = msg.readUInt8(); + const uint8_t hairStyle = msg.readUInt8("hair style"); + const uint8_t look = msg.readUInt8("look"); dstBeing->setSubtype(job, look); - const uint16_t weapon = msg.readInt16(); - const uint16_t shield = msg.readInt16(); - const uint16_t headBottom = msg.readInt16(); + const uint16_t weapon = msg.readInt16("weapon"); + const uint16_t shield = msg.readInt16("shield"); + const uint16_t headBottom = msg.readInt16("head bottom"); if (msgType == 3) - msg.readInt32(); // server tick + msg.readInt32("tick"); - const uint16_t headTop = msg.readInt16(); - const uint16_t headMid = msg.readInt16(); - const uint8_t hairColor = msg.readUInt8(); - msg.readUInt8(); // free + const uint16_t headTop = msg.readInt16("head top"); + const uint16_t headMid = msg.readInt16("head mid"); + const uint8_t hairColor = msg.readUInt8("hair color"); + msg.readUInt8("unused"); uint8_t colors[9]; - colors[0] = msg.readUInt8(); - colors[1] = msg.readUInt8(); - colors[2] = msg.readUInt8(); + colors[0] = msg.readUInt8("color 0"); + colors[1] = msg.readUInt8("color 1"); + colors[2] = msg.readUInt8("color 2"); - msg.readUInt8(); // unused + msg.readUInt8("unused"); - const int guild = msg.readInt32(); // guild + const int guild = msg.readInt32("guild"); if (!guildManager || !GuildManager::getEnableGuildBot()) { @@ -546,13 +547,13 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg) const dstBeing->setGuild(Guild::getGuild(static_cast<int16_t>(guild))); } - msg.readInt16(); // emblem - msg.readInt16(); // manner - dstBeing->setStatusEffectBlock(32, msg.readInt16()); // opt3 - msg.readUInt8(); // karma + msg.readInt16("emblem"); + msg.readInt16("manner"); + dstBeing->setStatusEffectBlock(32, msg.readInt16("opt3")); + msg.readUInt8("karma"); // reserving bit for future usage dstBeing->setGender(Being::intToGender( - static_cast<uint8_t>(msg.readUInt8() & 3))); + static_cast<uint8_t>(msg.readUInt8("gender") & 3))); if (!disguiseId) { @@ -582,7 +583,7 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg) const if (msgType == 3) { uint16_t srcX, srcY, dstX, dstY; - msg.readCoordinatePair(srcX, srcY, dstX, dstY); + msg.readCoordinatePair(srcX, srcY, dstX, dstY, "moving path"); localPlayer->followMoveTo(dstBeing, srcX, srcY, dstX, dstY); @@ -612,21 +613,21 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg) const { // uint8_t dir; uint16_t x, y; - msg.readCoordinates(x, y, dir); + msg.readCoordinates(x, y, dir, "position"); dstBeing->setTileCoords(x, y); dstBeing->setDirection(dir); localPlayer->imitateDirection(dstBeing, dir); } - const uint16_t gmstatus = msg.readInt16(); + const uint16_t gmstatus = msg.readInt16("gm status"); if (gmstatus & 0x80) dstBeing->setGM(true); if (msgType == 1 || msgType == 2) { - const uint8_t type = msg.readUInt8(); + const uint8_t type = msg.readUInt8("action type"); switch (type) { case 0: @@ -660,14 +661,14 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg) const } else if (msgType == 3) { - msg.readUInt8(); // unknown + msg.readUInt8("unused"); } - const int level = static_cast<int>(msg.readUInt8()); // Lv + const int level = static_cast<int>(msg.readUInt8("level")); if (level) dstBeing->setLevel(level); - msg.readUInt8(); // unknown + msg.readUInt8("unused"); if (dstBeing->getType() != ActorType::PLAYER || msgType != 3) @@ -698,18 +699,19 @@ void BeingHandler::processBeingMove3(Net::MessageIn &msg) static const int16_t dirx[8] = {0, -1, -1, -1, 0, 1, 1, 1}; static const int16_t diry[8] = {1, 1, 0, -1, -1, -1, 0, 1}; - const int len = msg.readInt16() - 14; - Being *const dstBeing = actorManager->findBeing(msg.readInt32()); + const int len = msg.readInt16("len") - 14; + Being *const dstBeing = actorManager->findBeing( + msg.readInt32("being id")); if (!dstBeing) { BLOCK_END("BeingHandler::processBeingMove3") return; } - const int16_t speed = msg.readInt16(); + const int16_t speed = msg.readInt16("speed"); dstBeing->setWalkSpeed(Vector(speed, speed, 0)); - int16_t x = msg.readInt16(); - int16_t y = msg.readInt16(); - const unsigned char *moves = msg.readBytes(len); + int16_t x = msg.readInt16("x"); + int16_t y = msg.readInt16("y"); + const unsigned char *moves = msg.readBytes(len, "moving path"); Path path; if (moves) { @@ -746,17 +748,17 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg) int spawnId; // Information about a being in range - const int id = msg.readInt32(); + const int id = msg.readInt32("being id"); if (id == mSpawnId) spawnId = mSpawnId; else spawnId = 0; mSpawnId = 0; int16_t speed = msg.readInt16(); - const uint16_t stunMode = msg.readInt16(); // opt1 - uint32_t statusEffects = msg.readInt16(); // opt2 - statusEffects |= (static_cast<uint32_t>(msg.readInt16())) << 16; // option - const int16_t job = msg.readInt16(); // class + const uint16_t stunMode = msg.readInt16("opt1"); + uint32_t statusEffects = msg.readInt16("opt2"); + statusEffects |= (static_cast<uint32_t>(msg.readInt16("option"))) << 16; + const int16_t job = msg.readInt16("class"); int disguiseId = 0; if (id == localPlayer->getId() && job >= 1000) disguiseId = job; @@ -826,32 +828,32 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg) if (speed == 0) speed = 150; - const uint8_t hairStyle = msg.readUInt8(); - const uint8_t look = msg.readUInt8(); + const uint8_t hairStyle = msg.readUInt8("hair style"); + const uint8_t look = msg.readUInt8("look"); dstBeing->setSubtype(job, look); if (dstBeing->getType() == ActorType::MONSTER && localPlayer) localPlayer->checkNewName(dstBeing); dstBeing->setWalkSpeed(Vector(speed, speed, 0)); - const uint16_t weapon = msg.readInt16(); - const uint16_t headBottom = msg.readInt16(); + const uint16_t weapon = msg.readInt16("weapon"); + const uint16_t headBottom = msg.readInt16("head bottom"); if (!visible) - msg.readInt32(); // server tick + msg.readInt32("tick"); - const uint16_t shield = msg.readInt16(); - const uint16_t headTop = msg.readInt16(); - const uint16_t headMid = msg.readInt16(); - const uint8_t hairColor = msg.readUInt8(); - msg.readUInt8(); // free - const uint16_t shoes = msg.readInt16(); // clothes color + const uint16_t shield = msg.readInt16("shield"); + const uint16_t headTop = msg.readInt16("head top"); + const uint16_t headMid = msg.readInt16("head mid"); + const uint8_t hairColor = msg.readUInt8("hair color"); + msg.readUInt8("unused"); + const uint16_t shoes = msg.readInt16("shoes / clothes color"); uint16_t gloves; if (dstBeing->getType() == ActorType::MONSTER) { if (serverVersion > 0 || tmwServerVersion >= 0x0E0701) { - const int hp = msg.readInt32(); - const int maxHP = msg.readInt32(); + const int hp = msg.readInt32("hp"); + const int maxHP = msg.readInt32("max hp"); if (hp && maxHP) { dstBeing->setMaxHP(maxHP); @@ -862,31 +864,31 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg) } else { - msg.readInt32(); - msg.readInt32(); + msg.readInt32("unused"); + msg.readInt32("unused"); } gloves = 0; } else { - gloves = msg.readInt16(); // head dir - "abused" as gloves - msg.readInt32(); // guild - msg.readInt16(); // guild emblem + gloves = msg.readInt16("gloves / head dir"); + msg.readInt32("guild"); + msg.readInt16("guild emblem"); } -// logger->log("being guild: " + toString(guild)); - msg.readInt16(); // manner - dstBeing->setStatusEffectBlock(32, msg.readInt16()); // opt3 + msg.readInt16("manner"); + dstBeing->setStatusEffectBlock(32, msg.readInt16("opt3")); if (serverVersion > 0 && dstBeing->getType() == ActorType::MONSTER) { - const int attackRange = static_cast<int>(msg.readUInt8()); // karma + const int attackRange = static_cast<int>( + msg.readUInt8("attack range (was karma)")); dstBeing->setAttackRange(attackRange); } else { - msg.readUInt8(); // karma + msg.readUInt8("karma"); } - uint8_t gender = msg.readUInt8(); + uint8_t gender = msg.readUInt8("gender"); if (!disguiseId && dstBeing->getType() == ActorType::PLAYER) { @@ -928,7 +930,7 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg) if (!visible) { uint16_t srcX, srcY, dstX, dstY; - msg.readCoordinatePair(srcX, srcY, dstX, dstY); + msg.readCoordinatePair(srcX, srcY, dstX, dstY, "move path"); if (!disguiseId) { dstBeing->setAction(BeingAction::STAND, 0); @@ -941,7 +943,7 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg) { uint8_t dir; uint16_t x, y; - msg.readCoordinates(x, y, dir); + msg.readCoordinates(x, y, dir, "position"); dstBeing->setTileCoords(x, y); if (job == 45 && socialWindow && outfitWindow) @@ -961,9 +963,9 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg) dstBeing->setDirection(dir); } - msg.readUInt8(); // unknown - msg.readUInt8(); // unknown - msg.readInt16(); + msg.readUInt8("unknown"); + msg.readUInt8("unknown"); + msg.readInt16("unknown"); dstBeing->setStunMode(stunMode); dstBeing->setStatusEffectBlock(0, static_cast<uint16_t>( |