From 0d18f85ec3a2b3ded337863ff1bb7ae51fd62658 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 23 Oct 2014 14:51:50 +0300 Subject: Add packet fields comments in playerhandler. --- src/net/ea/playerhandler.cpp | 14 ++++++------- src/net/eathena/playerhandler.cpp | 24 ++++++++++----------- src/net/tmwa/playerhandler.cpp | 44 +++++++++++++++++++-------------------- 3 files changed, 41 insertions(+), 41 deletions(-) diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp index 3d25c83d0..82d9139ee 100644 --- a/src/net/ea/playerhandler.cpp +++ b/src/net/ea/playerhandler.cpp @@ -102,9 +102,9 @@ Vector PlayerHandler::getDefaultWalkSpeed() const void PlayerHandler::processPlayerWarp(Net::MessageIn &msg) { BLOCK_START("PlayerHandler::processPlayerWarp") - std::string mapPath = msg.readString(16); - int x = msg.readInt16(); - int y = msg.readInt16(); + std::string mapPath = msg.readString(16, "map name"); + int x = msg.readInt16("x"); + int y = msg.readInt16("y"); logger->log("Warping to %s (%d, %d)", mapPath.c_str(), x, y); @@ -228,9 +228,9 @@ void PlayerHandler::processPlayerStatUpdate3(Net::MessageIn &msg) void PlayerHandler::processPlayerStatUpdate4(Net::MessageIn &msg) { BLOCK_START("PlayerHandler::processPlayerStatUpdate4") - const int type = msg.readInt16(); - const uint8_t ok = msg.readUInt8(); - const int value = msg.readUInt8(); + const int type = msg.readInt16("type"); + const uint8_t ok = msg.readUInt8("flag"); + const int value = msg.readUInt8("value"); if (ok != 1) { @@ -258,7 +258,7 @@ void PlayerHandler::processPlayerStatUpdate6(Net::MessageIn &msg) void PlayerHandler::processPlayerArrowMessage(Net::MessageIn &msg) { BLOCK_START("PlayerHandler::processPlayerArrowMessage") - const int type = msg.readInt16(); + const int type = msg.readInt16("type"); switch (type) { case 0: diff --git a/src/net/eathena/playerhandler.cpp b/src/net/eathena/playerhandler.cpp index 92ce69f4f..4f4e21e5b 100644 --- a/src/net/eathena/playerhandler.cpp +++ b/src/net/eathena/playerhandler.cpp @@ -138,11 +138,11 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg) void PlayerHandler::attack(const int id, const bool keep) const { createOutPacket(CMSG_PLAYER_CHANGE_ACT); - outMsg.writeInt32(id); + outMsg.writeInt32(id, "target id"); if (keep) - outMsg.writeInt8(7); + outMsg.writeInt8(7, "action"); else - outMsg.writeInt8(0); + outMsg.writeInt8(0, "action"); } void PlayerHandler::stopAttack() const @@ -153,7 +153,7 @@ void PlayerHandler::stopAttack() const void PlayerHandler::emote(const uint8_t emoteId) const { createOutPacket(CMSG_PLAYER_EMOTE); - outMsg.writeInt8(emoteId); + outMsg.writeInt8(emoteId, "emote id"); } void PlayerHandler::increaseAttribute(const int attr) const @@ -161,8 +161,8 @@ void PlayerHandler::increaseAttribute(const int attr) const if (attr >= Attributes::STR && attr <= Attributes::LUK) { createOutPacket(CMSG_STAT_UPDATE_REQUEST); - outMsg.writeInt16(static_cast(attr)); - outMsg.writeInt8(1); + outMsg.writeInt16(static_cast(attr), "attribute id"); + outMsg.writeInt8(1, "increase"); } } @@ -172,7 +172,7 @@ void PlayerHandler::increaseSkill(const uint16_t skillId) const return; createOutPacket(CMSG_SKILL_LEVELUP_REQUEST); - outMsg.writeInt16(skillId); + outMsg.writeInt16(skillId, "skill id"); } void PlayerHandler::pickUp(const FloorItem *const floorItem) const @@ -181,7 +181,7 @@ void PlayerHandler::pickUp(const FloorItem *const floorItem) const return; createOutPacket(CMSG_ITEM_PICKUP); - outMsg.writeInt32(floorItem->getId()); + outMsg.writeInt32(floorItem->getId(), "object id"); EAthena::InventoryHandler *const handler = static_cast(inventoryHandler); if (handler) @@ -202,7 +202,7 @@ void PlayerHandler::setDestination(const int x, const int y, createOutPacket(CMSG_PLAYER_CHANGE_DEST); outMsg.writeCoordinates(static_cast(x), static_cast(y), - static_cast(direction)); + static_cast(direction), "destination"); } void PlayerHandler::changeAction(const BeingAction::Action &action) const @@ -226,14 +226,14 @@ void PlayerHandler::changeAction(const BeingAction::Action &action) const } createOutPacket(CMSG_PLAYER_CHANGE_ACT); - outMsg.writeInt32(0); - outMsg.writeInt8(type); + outMsg.writeInt32(0, "unused"); + outMsg.writeInt8(type, "action"); } void PlayerHandler::respawn() const { createOutPacket(CMSG_PLAYER_RESTART); - outMsg.writeInt8(0); + outMsg.writeInt8(0, "action"); } void PlayerHandler::requestOnlineList() const diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp index 8d332016e..a73c4c28b 100644 --- a/src/net/tmwa/playerhandler.cpp +++ b/src/net/tmwa/playerhandler.cpp @@ -138,11 +138,11 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg) void PlayerHandler::attack(const int id, const bool keep) const { createOutPacket(CMSG_PLAYER_CHANGE_ACT); - outMsg.writeInt32(id); + outMsg.writeInt32(id, "target id"); if (keep) - outMsg.writeInt8(7); + outMsg.writeInt8(7, "action"); else - outMsg.writeInt8(0); + outMsg.writeInt8(0, "action"); } void PlayerHandler::stopAttack() const @@ -153,7 +153,7 @@ void PlayerHandler::stopAttack() const void PlayerHandler::emote(const uint8_t emoteId) const { createOutPacket(CMSG_PLAYER_EMOTE); - outMsg.writeInt8(emoteId); + outMsg.writeInt8(emoteId, "emote id"); } void PlayerHandler::increaseAttribute(const int attr) const @@ -161,8 +161,8 @@ void PlayerHandler::increaseAttribute(const int attr) const if (attr >= Attributes::STR && attr <= Attributes::LUK) { createOutPacket(CMSG_STAT_UPDATE_REQUEST); - outMsg.writeInt16(static_cast(attr)); - outMsg.writeInt8(1); + outMsg.writeInt16(static_cast(attr), "attribute id"); + outMsg.writeInt8(1, "increment"); } } @@ -172,7 +172,7 @@ void PlayerHandler::increaseSkill(const uint16_t skillId) const return; createOutPacket(CMSG_SKILL_LEVELUP_REQUEST); - outMsg.writeInt16(skillId); + outMsg.writeInt16(skillId, "skill id"); } void PlayerHandler::pickUp(const FloorItem *const floorItem) const @@ -181,7 +181,7 @@ void PlayerHandler::pickUp(const FloorItem *const floorItem) const return; createOutPacket(CMSG_ITEM_PICKUP); - outMsg.writeInt32(floorItem->getId()); + outMsg.writeInt32(floorItem->getId(), "object id"); TmwAthena::InventoryHandler *const handler = static_cast(inventoryHandler); if (handler) @@ -191,8 +191,8 @@ void PlayerHandler::pickUp(const FloorItem *const floorItem) const void PlayerHandler::setDirection(const unsigned char direction) const { createOutPacket(CMSG_PLAYER_CHANGE_DIR); - outMsg.writeInt16(0); - outMsg.writeInt8(direction); + outMsg.writeInt16(0, "unused"); + outMsg.writeInt8(direction, "direction"); } void PlayerHandler::setDestination(const int x, const int y, @@ -201,7 +201,7 @@ void PlayerHandler::setDestination(const int x, const int y, createOutPacket(CMSG_PLAYER_CHANGE_DEST); outMsg.writeCoordinates(static_cast(x), static_cast(y), - static_cast(direction)); + static_cast(direction), "destination"); } void PlayerHandler::changeAction(const BeingAction::Action &action) const @@ -225,14 +225,14 @@ void PlayerHandler::changeAction(const BeingAction::Action &action) const } createOutPacket(CMSG_PLAYER_CHANGE_ACT); - outMsg.writeInt32(0); - outMsg.writeInt8(type); + outMsg.writeInt32(0, "unused"); + outMsg.writeInt8(type, "action"); } void PlayerHandler::respawn() const { createOutPacket(CMSG_PLAYER_RESTART); - outMsg.writeInt8(0); + outMsg.writeInt8(0, "action"); } void PlayerHandler::requestOnlineList() const @@ -258,7 +258,7 @@ void PlayerHandler::processOnlineList(Net::MessageIn &msg) return; BLOCK_START("PlayerHandler::processOnlineList") - const int size = msg.readInt16() - 4; + const int size = msg.readInt16("len") - 4; std::vector arr; if (!size) @@ -269,7 +269,7 @@ void PlayerHandler::processOnlineList(Net::MessageIn &msg) return; } - char *const start = reinterpret_cast(msg.readBytes(size)); + char *const start = reinterpret_cast(msg.readBytes(size, "nicks")); if (!start) { BLOCK_END("PlayerHandler::processOnlineList") @@ -325,14 +325,14 @@ void PlayerHandler::processOnlineList(Net::MessageIn &msg) void PlayerHandler::updateStatus(const uint8_t status) const { createOutPacket(CMSG_SET_STATUS); - outMsg.writeInt8(status); - outMsg.writeInt8(0); + outMsg.writeInt8(status, "status"); + outMsg.writeInt8(0, "unused"); } void PlayerHandler::processMapMask(Net::MessageIn &msg) { - const int mask = msg.readInt32(); - msg.readInt32(); // unused + const int mask = msg.readInt32("mask"); + msg.readInt32("unused"); Map *const map = Game::instance()->getCurrentMap(); if (map) map->setMask(mask); @@ -340,8 +340,8 @@ void PlayerHandler::processMapMask(Net::MessageIn &msg) void PlayerHandler::processMapMusic(Net::MessageIn &msg) { - const int size = msg.readInt16() - 5; - const std::string music = msg.readString(size); + const int size = msg.readInt16("len") - 5; + const std::string music = msg.readString(size, "name"); soundManager.playMusic(music); Map *const map = viewport->getMap(); -- cgit v1.2.3-70-g09d2