summaryrefslogtreecommitdiff
path: root/src/net/tmwa
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-09-19 17:33:16 +0300
committerAndrei Karas <akaras@inbox.ru>2014-09-19 17:33:16 +0300
commitb7addc0a9a519cf9dcc3e804d9918ce4934a3e83 (patch)
treeeed5cd349f7e9db512fd1e940ed7b070df1c6a35 /src/net/tmwa
parent403792db7d005066273bcbe138afcd1a98b3144c (diff)
downloadmanaverse-b7addc0a9a519cf9dcc3e804d9918ce4934a3e83.tar.gz
manaverse-b7addc0a9a519cf9dcc3e804d9918ce4934a3e83.tar.bz2
manaverse-b7addc0a9a519cf9dcc3e804d9918ce4934a3e83.tar.xz
manaverse-b7addc0a9a519cf9dcc3e804d9918ce4934a3e83.zip
Add comments for all output packets header.
Diffstat (limited to 'src/net/tmwa')
-rw-r--r--src/net/tmwa/adminhandler.cpp8
-rw-r--r--src/net/tmwa/beinghandler.cpp2
-rw-r--r--src/net/tmwa/charserverhandler.cpp10
-rw-r--r--src/net/tmwa/chathandler.cpp18
-rw-r--r--src/net/tmwa/gamehandler.cpp8
-rw-r--r--src/net/tmwa/inventoryhandler.cpp14
-rw-r--r--src/net/tmwa/loginhandler.cpp10
-rw-r--r--src/net/tmwa/npchandler.cpp20
-rw-r--r--src/net/tmwa/partyhandler.cpp18
-rw-r--r--src/net/tmwa/playerhandler.cpp24
-rw-r--r--src/net/tmwa/skillhandler.cpp8
-rw-r--r--src/net/tmwa/tradehandler.cpp14
12 files changed, 77 insertions, 77 deletions
diff --git a/src/net/tmwa/adminhandler.cpp b/src/net/tmwa/adminhandler.cpp
index 44b6f9038..5a35ed3c4 100644
--- a/src/net/tmwa/adminhandler.cpp
+++ b/src/net/tmwa/adminhandler.cpp
@@ -76,27 +76,27 @@ void AdminHandler::handleMessage(Net::MessageIn &msg)
void AdminHandler::announce(const std::string &text) const
{
- MessageOut outMsg(CMSG_ADMIN_ANNOUNCE);
+ createOutPacket(CMSG_ADMIN_ANNOUNCE);
outMsg.writeInt16(static_cast<int16_t>(text.length() + 4), "len");
outMsg.writeString(text, static_cast<int>(text.length()), "message");
}
void AdminHandler::localAnnounce(const std::string &text) const
{
- MessageOut outMsg(CMSG_ADMIN_LOCAL_ANNOUNCE);
+ createOutPacket(CMSG_ADMIN_LOCAL_ANNOUNCE);
outMsg.writeInt16(static_cast<int16_t>(text.length() + 4), "len");
outMsg.writeString(text, static_cast<int>(text.length()), "message");
}
void AdminHandler::hide(const bool h A_UNUSED) const
{
- MessageOut outMsg(CMSG_ADMIN_HIDE);
+ createOutPacket(CMSG_ADMIN_HIDE);
outMsg.writeInt32(0, "unused");
}
void AdminHandler::kick(const int playerId) const
{
- MessageOut outMsg(CMSG_ADMIN_KICK);
+ createOutPacket(CMSG_ADMIN_KICK);
outMsg.writeInt32(playerId, "account id");
}
diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp
index 5160930a2..7108f8ac8 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);
+ createOutPacket(CMSG_NAME_REQUEST);
outMsg.writeInt32(id, "being id");
}
diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp
index a6c7ab178..512ef6e44 100644
--- a/src/net/tmwa/charserverhandler.cpp
+++ b/src/net/tmwa/charserverhandler.cpp
@@ -258,7 +258,7 @@ void CharServerHandler::chooseCharacter(Net::Character *const character)
mSelectedCharacter = character;
mCharSelectDialog = nullptr;
- MessageOut outMsg(CMSG_CHAR_SELECT);
+ createOutPacket(CMSG_CHAR_SELECT);
outMsg.writeInt8(static_cast<unsigned char>(mSelectedCharacter->slot),
"slot");
}
@@ -271,7 +271,7 @@ void CharServerHandler::newCharacter(const std::string &name, const int slot,
const unsigned char look,
const std::vector<int> &stats) const
{
- MessageOut outMsg(CMSG_CHAR_CREATE);
+ createOutPacket(CMSG_CHAR_CREATE);
outMsg.writeString(name, 24, "name");
for (int i = 0; i < 6; i++)
outMsg.writeInt8(static_cast<unsigned char>(stats[i]), "stat");
@@ -295,7 +295,7 @@ void CharServerHandler::deleteCharacter(Net::Character *const character)
mSelectedCharacter = character;
- MessageOut outMsg(CMSG_CHAR_DELETE);
+ createOutPacket(CMSG_CHAR_DELETE);
outMsg.writeInt32(mSelectedCharacter->dummy->getId(), "id?");
outMsg.writeString("a@a.com", 40, "email");
}
@@ -303,7 +303,7 @@ void CharServerHandler::deleteCharacter(Net::Character *const character)
void CharServerHandler::switchCharacter() const
{
// This is really a map-server packet
- MessageOut outMsg(CMSG_PLAYER_RESTART);
+ createOutPacket(CMSG_PLAYER_RESTART);
outMsg.writeInt8(1, "flag");
}
@@ -317,7 +317,7 @@ void CharServerHandler::connect()
mNetwork->disconnect();
mNetwork->connect(charServer);
- MessageOut outMsg(CMSG_CHAR_SERVER_CONNECT);
+ createOutPacket(CMSG_CHAR_SERVER_CONNECT);
outMsg.writeInt32(token.account_ID, "account id");
outMsg.writeInt32(token.session_ID1, "session id1");
outMsg.writeInt32(token.session_ID2, "session id2");
diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp
index 52089d365..c2ffca0e3 100644
--- a/src/net/tmwa/chathandler.cpp
+++ b/src/net/tmwa/chathandler.cpp
@@ -129,7 +129,7 @@ void ChatHandler::talk(const std::string &restrict text,
if (serverFeatures->haveChatChannels() && channel.size() == 3)
{
- MessageOut outMsg(CMSG_CHAT_MESSAGE2);
+ createOutPacket(CMSG_CHAT_MESSAGE2);
// Added + 1 in order to let eAthena parse admin commands correctly
outMsg.writeInt16(static_cast<int16_t>(mes.length() + 4 + 3 + 1),
"len");
@@ -140,7 +140,7 @@ void ChatHandler::talk(const std::string &restrict text,
}
else
{
- MessageOut outMsg(CMSG_CHAT_MESSAGE);
+ createOutPacket(CMSG_CHAT_MESSAGE);
// Added + 1 in order to let eAthena parse admin commands correctly
outMsg.writeInt16(static_cast<int16_t>(mes.length() + 4 + 1), "len");
outMsg.writeString(mes, static_cast<int>(mes.length() + 1), "message");
@@ -149,7 +149,7 @@ void ChatHandler::talk(const std::string &restrict text,
void ChatHandler::talkRaw(const std::string &mes) const
{
- MessageOut outMsg(CMSG_CHAT_MESSAGE);
+ createOutPacket(CMSG_CHAT_MESSAGE);
outMsg.writeInt16(static_cast<int16_t>(mes.length() + 4), "len");
outMsg.writeString(mes, static_cast<int>(mes.length()), "message");
}
@@ -157,7 +157,7 @@ void ChatHandler::talkRaw(const std::string &mes) const
void ChatHandler::privateMessage(const std::string &restrict recipient,
const std::string &restrict text)
{
- MessageOut outMsg(CMSG_CHAT_WHISPER);
+ createOutPacket(CMSG_CHAT_WHISPER);
outMsg.writeInt16(static_cast<int16_t>(text.length() + 28), "len");
outMsg.writeString(recipient, 24, "recipient nick");
outMsg.writeString(text, static_cast<int>(text.length()), "message");
@@ -166,7 +166,7 @@ void ChatHandler::privateMessage(const std::string &restrict recipient,
void ChatHandler::who() const
{
- MessageOut outMsg(CMSG_WHO_REQUEST);
+ createOutPacket(CMSG_WHO_REQUEST);
}
void ChatHandler::sendRaw(const std::string &args) const
@@ -238,7 +238,7 @@ void ChatHandler::ignoreAll() const
{
if (!serverFeatures->haveServerIgnore())
return;
- MessageOut outMsg(CMSG_IGNORE_ALL);
+ createOutPacket(CMSG_IGNORE_ALL);
outMsg.writeInt8(0, "flag");
}
@@ -246,20 +246,20 @@ void ChatHandler::unIgnoreAll() const
{
if (!serverFeatures->haveServerIgnore())
return;
- MessageOut outMsg(CMSG_IGNORE_ALL);
+ createOutPacket(CMSG_IGNORE_ALL);
outMsg.writeInt8(1, "flag");
}
void ChatHandler::ignore(const std::string &nick) const
{
- MessageOut outMsg(CMSG_IGNORE_NICK);
+ createOutPacket(CMSG_IGNORE_NICK);
outMsg.writeString(nick, 24, "nick");
outMsg.writeInt8(0, "flag");
}
void ChatHandler::unIgnore(const std::string &nick) const
{
- MessageOut outMsg(CMSG_IGNORE_NICK);
+ createOutPacket(CMSG_IGNORE_NICK);
outMsg.writeString(nick, 24, "nick");
outMsg.writeInt8(1, "flag");
}
diff --git a/src/net/tmwa/gamehandler.cpp b/src/net/tmwa/gamehandler.cpp
index 8815803c6..cad7a12dc 100644
--- a/src/net/tmwa/gamehandler.cpp
+++ b/src/net/tmwa/gamehandler.cpp
@@ -93,7 +93,7 @@ void GameHandler::handleMessage(Net::MessageIn &msg)
void GameHandler::mapLoadedEvent() const
{
- MessageOut outMsg(CMSG_MAP_LOADED);
+ createOutPacket(CMSG_MAP_LOADED);
}
void GameHandler::connect()
@@ -120,7 +120,7 @@ void GameHandler::connect()
}
// Send login infos
- MessageOut outMsg(CMSG_MAP_SERVER_CONNECT);
+ createOutPacket(CMSG_MAP_SERVER_CONNECT);
outMsg.writeInt32(token.account_ID, "account id");
outMsg.writeInt32(mCharID, "char id");
outMsg.writeInt32(token.session_ID1, "session id1");
@@ -156,7 +156,7 @@ void GameHandler::disconnect()
void GameHandler::quit() const
{
- MessageOut outMsg(CMSG_CLIENT_QUIT);
+ createOutPacket(CMSG_CLIENT_QUIT);
}
void GameHandler::ping(const int tick) const
@@ -167,7 +167,7 @@ void GameHandler::ping(const int tick) const
void GameHandler::disconnect2() const
{
- MessageOut outMsg(CMSG_CLIENT_DISCONNECT);
+ createOutPacket(CMSG_CLIENT_DISCONNECT);
}
void GameHandler::processMapLogin(Net::MessageIn &msg) const
diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp
index 359326e31..f222b3349 100644
--- a/src/net/tmwa/inventoryhandler.cpp
+++ b/src/net/tmwa/inventoryhandler.cpp
@@ -158,7 +158,7 @@ void InventoryHandler::equipItem(const Item *const item) const
if (!item)
return;
- MessageOut outMsg(CMSG_PLAYER_EQUIP);
+ createOutPacket(CMSG_PLAYER_EQUIP);
outMsg.writeInt16(static_cast<int16_t>(
item->getInvIndex() + INVENTORY_OFFSET));
outMsg.writeInt16(0);
@@ -169,7 +169,7 @@ void InventoryHandler::unequipItem(const Item *const item) const
if (!item)
return;
- MessageOut outMsg(CMSG_PLAYER_UNEQUIP);
+ createOutPacket(CMSG_PLAYER_UNEQUIP);
outMsg.writeInt16(static_cast<int16_t>(
item->getInvIndex() + INVENTORY_OFFSET));
}
@@ -179,7 +179,7 @@ void InventoryHandler::useItem(const Item *const item) const
if (!item)
return;
- MessageOut outMsg(CMSG_PLAYER_INVENTORY_USE);
+ createOutPacket(CMSG_PLAYER_INVENTORY_USE);
outMsg.writeInt16(static_cast<int16_t>(
item->getInvIndex() + INVENTORY_OFFSET));
outMsg.writeInt32(item->getId()); // unused
@@ -190,7 +190,7 @@ void InventoryHandler::dropItem(const Item *const item, const int amount) const
if (!item)
return;
- MessageOut outMsg(CMSG_PLAYER_INVENTORY_DROP);
+ createOutPacket(CMSG_PLAYER_INVENTORY_DROP);
outMsg.writeInt16(static_cast<int16_t>(
item->getInvIndex() + INVENTORY_OFFSET));
outMsg.writeInt16(static_cast<int16_t>(amount));
@@ -198,7 +198,7 @@ void InventoryHandler::dropItem(const Item *const item, const int amount) const
void InventoryHandler::closeStorage(const int type A_UNUSED) const
{
- MessageOut outMsg(CMSG_CLOSE_STORAGE);
+ createOutPacket(CMSG_CLOSE_STORAGE);
}
void InventoryHandler::moveItem2(const int source, const int slot,
@@ -206,14 +206,14 @@ void InventoryHandler::moveItem2(const int source, const int slot,
{
if (source == Inventory::INVENTORY && destination == Inventory::STORAGE)
{
- MessageOut outMsg(CMSG_MOVE_TO_STORAGE);
+ createOutPacket(CMSG_MOVE_TO_STORAGE);
outMsg.writeInt16(static_cast<int16_t>(slot + INVENTORY_OFFSET));
outMsg.writeInt32(amount);
}
else if (source == Inventory::STORAGE
&& destination == Inventory::INVENTORY)
{
- MessageOut outMsg(CSMG_MOVE_FROM_STORAGE);
+ createOutPacket(CSMG_MOVE_FROM_STORAGE);
outMsg.writeInt16(static_cast<int16_t>(slot + STORAGE_OFFSET));
outMsg.writeInt32(amount);
}
diff --git a/src/net/tmwa/loginhandler.cpp b/src/net/tmwa/loginhandler.cpp
index bcf0e6c2b..4e9120eae 100644
--- a/src/net/tmwa/loginhandler.cpp
+++ b/src/net/tmwa/loginhandler.cpp
@@ -111,7 +111,7 @@ void LoginHandler::connect()
return;
mNetwork->connect(mServer);
- MessageOut outMsg(CMSG_SERVER_VERSION_REQUEST);
+ createOutPacket(CMSG_SERVER_VERSION_REQUEST);
}
bool LoginHandler::isConnected() const
@@ -134,7 +134,7 @@ void LoginHandler::changePassword(const std::string &restrict username
const std::string &restrict newPassword)
const
{
- MessageOut outMsg(CMSG_CHAR_PASSWORD_CHANGE);
+ createOutPacket(CMSG_CHAR_PASSWORD_CHANGE);
outMsg.writeStringNoLog(oldPassword, 24, "old password");
outMsg.writeStringNoLog(newPassword, 24, "new password");
}
@@ -145,7 +145,7 @@ void LoginHandler::sendLoginRegister(const std::string &restrict username,
{
if (email.empty())
{
- MessageOut outMsg(CMSG_LOGIN_REGISTER);
+ createOutPacket(CMSG_LOGIN_REGISTER);
outMsg.writeInt32(0, "client version");
outMsg.writeString(username, 24, "login");
outMsg.writeStringNoLog(password, 24, "password");
@@ -160,7 +160,7 @@ void LoginHandler::sendLoginRegister(const std::string &restrict username,
}
else
{
- MessageOut outMsg(CMSG_LOGIN_REGISTER2);
+ createOutPacket(CMSG_LOGIN_REGISTER2);
outMsg.writeInt32(0, "client version");
outMsg.writeString(username, 24, "login");
outMsg.writeStringNoLog(password, 24, "password");
@@ -183,7 +183,7 @@ ServerInfo *LoginHandler::getCharServer() const
void LoginHandler::requestUpdateHosts()
{
- MessageOut outMsg(CMSG_SEND_CLIENT_INFO);
+ createOutPacket(CMSG_SEND_CLIENT_INFO);
outMsg.writeInt8(CLIENT_PROTOCOL_VERSION);
outMsg.writeInt8(0, "unused");
}
diff --git a/src/net/tmwa/npchandler.cpp b/src/net/tmwa/npchandler.cpp
index 5437d6920..d7b453058 100644
--- a/src/net/tmwa/npchandler.cpp
+++ b/src/net/tmwa/npchandler.cpp
@@ -111,20 +111,20 @@ void NpcHandler::handleMessage(Net::MessageIn &msg)
void NpcHandler::talk(const int npcId) const
{
- MessageOut outMsg(CMSG_NPC_TALK);
+ createOutPacket(CMSG_NPC_TALK);
outMsg.writeInt32(npcId);
outMsg.writeInt8(0); // unused
}
void NpcHandler::nextDialog(const int npcId) const
{
- MessageOut outMsg(CMSG_NPC_NEXT_REQUEST);
+ createOutPacket(CMSG_NPC_NEXT_REQUEST);
outMsg.writeInt32(npcId);
}
void NpcHandler::closeDialog(const int npcId)
{
- MessageOut outMsg(CMSG_NPC_CLOSE);
+ createOutPacket(CMSG_NPC_CLOSE);
outMsg.writeInt32(npcId);
const NpcDialogs::iterator it = NpcDialog::mNpcDialogs.find(npcId);
@@ -141,21 +141,21 @@ void NpcHandler::closeDialog(const int npcId)
void NpcHandler::listInput(const int npcId, const unsigned char value) const
{
- MessageOut outMsg(CMSG_NPC_LIST_CHOICE);
+ createOutPacket(CMSG_NPC_LIST_CHOICE);
outMsg.writeInt32(npcId);
outMsg.writeInt8(value);
}
void NpcHandler::integerInput(const int npcId, const int value) const
{
- MessageOut outMsg(CMSG_NPC_INT_RESPONSE);
+ createOutPacket(CMSG_NPC_INT_RESPONSE);
outMsg.writeInt32(npcId);
outMsg.writeInt32(value);
}
void NpcHandler::stringInput(const int npcId, const std::string &value) const
{
- MessageOut outMsg(CMSG_NPC_STR_RESPONSE);
+ createOutPacket(CMSG_NPC_STR_RESPONSE);
outMsg.writeInt16(static_cast<int16_t>(value.length() + 9));
outMsg.writeInt32(npcId);
outMsg.writeString(value, static_cast<int>(value.length()));
@@ -164,14 +164,14 @@ void NpcHandler::stringInput(const int npcId, const std::string &value) const
void NpcHandler::buy(const int beingId) const
{
- MessageOut outMsg(CMSG_NPC_BUY_SELL_REQUEST);
+ createOutPacket(CMSG_NPC_BUY_SELL_REQUEST);
outMsg.writeInt32(beingId);
outMsg.writeInt8(0); // Buy
}
void NpcHandler::sell(const int beingId) const
{
- MessageOut outMsg(CMSG_NPC_BUY_SELL_REQUEST);
+ createOutPacket(CMSG_NPC_BUY_SELL_REQUEST);
outMsg.writeInt32(beingId);
outMsg.writeInt8(1); // Sell
}
@@ -179,7 +179,7 @@ void NpcHandler::sell(const int beingId) const
void NpcHandler::buyItem(const int beingId A_UNUSED, const int itemId,
const unsigned char color, const int amount) const
{
- MessageOut outMsg(CMSG_NPC_BUY_REQUEST);
+ createOutPacket(CMSG_NPC_BUY_REQUEST);
if (serverFeatures->haveItemColors())
{
outMsg.writeInt16(10); // One item (length of packet)
@@ -199,7 +199,7 @@ void NpcHandler::buyItem(const int beingId A_UNUSED, const int itemId,
void NpcHandler::sellItem(const int beingId A_UNUSED,
const int itemId, const int amount) const
{
- MessageOut outMsg(CMSG_NPC_SELL_REQUEST);
+ createOutPacket(CMSG_NPC_SELL_REQUEST);
outMsg.writeInt16(8); // One item (length of packet)
outMsg.writeInt16(static_cast<int16_t>(itemId + INVENTORY_OFFSET));
outMsg.writeInt16(static_cast<int16_t>(amount));
diff --git a/src/net/tmwa/partyhandler.cpp b/src/net/tmwa/partyhandler.cpp
index 701fb9bff..6d59cd0ce 100644
--- a/src/net/tmwa/partyhandler.cpp
+++ b/src/net/tmwa/partyhandler.cpp
@@ -114,7 +114,7 @@ void PartyHandler::handleMessage(Net::MessageIn &msg)
void PartyHandler::create(const std::string &name) const
{
- MessageOut outMsg(CMSG_PARTY_CREATE);
+ createOutPacket(CMSG_PARTY_CREATE);
outMsg.writeString(name.substr(0, 23), 24);
}
@@ -127,7 +127,7 @@ void PartyHandler::invite(const std::string &name) const
name, ActorType::Player);
if (being)
{
- MessageOut outMsg(CMSG_PARTY_INVITE);
+ createOutPacket(CMSG_PARTY_INVITE);
outMsg.writeInt32(being->getId());
}
}
@@ -137,7 +137,7 @@ void PartyHandler::inviteResponse(const std::string &inviter A_UNUSED,
{
if (localPlayer)
{
- MessageOut outMsg(CMSG_PARTY_INVITED);
+ createOutPacket(CMSG_PARTY_INVITED);
outMsg.writeInt32(localPlayer->getId());
outMsg.writeInt32(accept ? 1 : 0);
}
@@ -145,14 +145,14 @@ void PartyHandler::inviteResponse(const std::string &inviter A_UNUSED,
void PartyHandler::leave() const
{
- MessageOut outMsg(CMSG_PARTY_LEAVE);
+ createOutPacket(CMSG_PARTY_LEAVE);
}
void PartyHandler::kick(const Being *const being) const
{
if (being)
{
- MessageOut outMsg(CMSG_PARTY_KICK);
+ createOutPacket(CMSG_PARTY_KICK);
outMsg.writeInt32(being->getId());
outMsg.writeString("", 24); // unused
}
@@ -170,14 +170,14 @@ void PartyHandler::kick(const std::string &name) const
return;
}
- MessageOut outMsg(CMSG_PARTY_KICK);
+ createOutPacket(CMSG_PARTY_KICK);
outMsg.writeInt32(m->getID());
outMsg.writeString(name, 24); // unused
}
void PartyHandler::chat(const std::string &text) const
{
- MessageOut outMsg(CMSG_PARTY_MESSAGE);
+ createOutPacket(CMSG_PARTY_MESSAGE);
outMsg.writeInt16(static_cast<int16_t>(text.length() + 4));
outMsg.writeString(text, static_cast<int>(text.length()));
}
@@ -187,7 +187,7 @@ void PartyHandler::setShareExperience(const Net::PartyShare::Type share) const
if (share == Net::PartyShare::NOT_POSSIBLE)
return;
- MessageOut outMsg(CMSG_PARTY_SETTINGS);
+ createOutPacket(CMSG_PARTY_SETTINGS);
outMsg.writeInt16(static_cast<int16_t>(share));
outMsg.writeInt16(static_cast<int16_t>(mShareItems));
}
@@ -197,7 +197,7 @@ void PartyHandler::setShareItems(const Net::PartyShare::Type share) const
if (share == Net::PartyShare::NOT_POSSIBLE)
return;
- MessageOut outMsg(CMSG_PARTY_SETTINGS);
+ createOutPacket(CMSG_PARTY_SETTINGS);
outMsg.writeInt16(static_cast<int16_t>(mShareExp));
outMsg.writeInt16(static_cast<int16_t>(share));
}
diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp
index baf8e43a4..08be2f53a 100644
--- a/src/net/tmwa/playerhandler.cpp
+++ b/src/net/tmwa/playerhandler.cpp
@@ -140,7 +140,7 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg)
void PlayerHandler::attack(const int id, const bool keep) const
{
- MessageOut outMsg(CMSG_PLAYER_CHANGE_ACT);
+ createOutPacket(CMSG_PLAYER_CHANGE_ACT);
outMsg.writeInt32(id);
if (keep)
outMsg.writeInt8(7);
@@ -150,12 +150,12 @@ void PlayerHandler::attack(const int id, const bool keep) const
void PlayerHandler::stopAttack() const
{
- MessageOut outMsg(CMSG_PLAYER_STOP_ATTACK);
+ createOutPacket(CMSG_PLAYER_STOP_ATTACK);
}
void PlayerHandler::emote(const uint8_t emoteId) const
{
- MessageOut outMsg(CMSG_PLAYER_EMOTE);
+ createOutPacket(CMSG_PLAYER_EMOTE);
outMsg.writeInt8(emoteId);
}
@@ -163,7 +163,7 @@ void PlayerHandler::increaseAttribute(const int attr) const
{
if (attr >= STR && attr <= LUK)
{
- MessageOut outMsg(CMSG_STAT_UPDATE_REQUEST);
+ createOutPacket(CMSG_STAT_UPDATE_REQUEST);
outMsg.writeInt16(static_cast<int16_t>(attr));
outMsg.writeInt8(1);
}
@@ -174,7 +174,7 @@ void PlayerHandler::increaseSkill(const uint16_t skillId) const
if (PlayerInfo::getAttribute(Attributes::SKILL_POINTS) <= 0)
return;
- MessageOut outMsg(CMSG_SKILL_LEVELUP_REQUEST);
+ createOutPacket(CMSG_SKILL_LEVELUP_REQUEST);
outMsg.writeInt16(skillId);
}
@@ -183,7 +183,7 @@ void PlayerHandler::pickUp(const FloorItem *const floorItem) const
if (!floorItem)
return;
- MessageOut outMsg(CMSG_ITEM_PICKUP);
+ createOutPacket(CMSG_ITEM_PICKUP);
outMsg.writeInt32(floorItem->getId());
TmwAthena::InventoryHandler *const handler =
static_cast<TmwAthena::InventoryHandler*>(inventoryHandler);
@@ -193,7 +193,7 @@ void PlayerHandler::pickUp(const FloorItem *const floorItem) const
void PlayerHandler::setDirection(const unsigned char direction) const
{
- MessageOut outMsg(CMSG_PLAYER_CHANGE_DIR);
+ createOutPacket(CMSG_PLAYER_CHANGE_DIR);
outMsg.writeInt16(0);
outMsg.writeInt8(direction);
}
@@ -201,7 +201,7 @@ void PlayerHandler::setDirection(const unsigned char direction) const
void PlayerHandler::setDestination(const int x, const int y,
const int direction) const
{
- MessageOut outMsg(CMSG_PLAYER_CHANGE_DEST);
+ createOutPacket(CMSG_PLAYER_CHANGE_DEST);
outMsg.writeCoordinates(static_cast<uint16_t>(x),
static_cast<uint16_t>(y),
static_cast<unsigned char>(direction));
@@ -227,20 +227,20 @@ void PlayerHandler::changeAction(const BeingAction::Action &action) const
return;
}
- MessageOut outMsg(CMSG_PLAYER_CHANGE_ACT);
+ createOutPacket(CMSG_PLAYER_CHANGE_ACT);
outMsg.writeInt32(0);
outMsg.writeInt8(type);
}
void PlayerHandler::respawn() const
{
- MessageOut outMsg(CMSG_PLAYER_RESTART);
+ createOutPacket(CMSG_PLAYER_RESTART);
outMsg.writeInt8(0);
}
void PlayerHandler::requestOnlineList() const
{
- MessageOut outMsg(CMSG_ONLINE_LIST);
+ createOutPacket(CMSG_ONLINE_LIST);
}
void PlayerHandler::removeOption() const
@@ -327,7 +327,7 @@ void PlayerHandler::processOnlineList(Net::MessageIn &msg)
void PlayerHandler::updateStatus(const uint8_t status) const
{
- MessageOut outMsg(CMSG_SET_STATUS);
+ createOutPacket(CMSG_SET_STATUS);
outMsg.writeInt8(status);
outMsg.writeInt8(0);
}
diff --git a/src/net/tmwa/skillhandler.cpp b/src/net/tmwa/skillhandler.cpp
index 26902f18e..05f7b0d90 100644
--- a/src/net/tmwa/skillhandler.cpp
+++ b/src/net/tmwa/skillhandler.cpp
@@ -77,7 +77,7 @@ void SkillHandler::handleMessage(Net::MessageIn &msg)
void SkillHandler::useBeing(const int id, const int level,
const int beingId) const
{
- MessageOut outMsg(CMSG_SKILL_USE_BEING);
+ createOutPacket(CMSG_SKILL_USE_BEING);
outMsg.writeInt16(static_cast<int16_t>(id));
outMsg.writeInt16(static_cast<int16_t>(level));
outMsg.writeInt32(beingId);
@@ -86,7 +86,7 @@ void SkillHandler::useBeing(const int id, const int level,
void SkillHandler::usePos(const int id, const int level,
const int x, const int y) const
{
- MessageOut outMsg(CMSG_SKILL_USE_POSITION);
+ createOutPacket(CMSG_SKILL_USE_POSITION);
outMsg.writeInt16(static_cast<int16_t>(level));
outMsg.writeInt16(static_cast<int16_t>(id));
outMsg.writeInt16(static_cast<int16_t>(x));
@@ -97,7 +97,7 @@ void SkillHandler::usePos(const int id, const int level,
const int x, const int y,
const std::string &text) const
{
- MessageOut outMsg(CMSG_SKILL_USE_POSITION_MORE);
+ createOutPacket(CMSG_SKILL_USE_POSITION_MORE);
outMsg.writeInt16(static_cast<int16_t>(level), "level");
outMsg.writeInt16(static_cast<int16_t>(id), "id");
outMsg.writeInt16(static_cast<int16_t>(x), "x");
@@ -107,7 +107,7 @@ void SkillHandler::usePos(const int id, const int level,
void SkillHandler::useMap(const int id, const std::string &map) const
{
- MessageOut outMsg(CMSG_SKILL_USE_MAP);
+ createOutPacket(CMSG_SKILL_USE_MAP);
outMsg.writeInt16(static_cast<int16_t>(id));
outMsg.writeString(map, 16);
}
diff --git a/src/net/tmwa/tradehandler.cpp b/src/net/tmwa/tradehandler.cpp
index 073fe78ed..a07b58c15 100644
--- a/src/net/tmwa/tradehandler.cpp
+++ b/src/net/tmwa/tradehandler.cpp
@@ -104,7 +104,7 @@ void TradeHandler::request(const Being *const being) const
if (!being)
return;
- MessageOut outMsg(CMSG_TRADE_REQUEST);
+ createOutPacket(CMSG_TRADE_REQUEST);
outMsg.writeInt32(being->getId());
}
@@ -113,7 +113,7 @@ void TradeHandler::respond(const bool accept) const
if (!accept)
PlayerInfo::setTrading(false);
- MessageOut outMsg(CMSG_TRADE_RESPONSE);
+ createOutPacket(CMSG_TRADE_RESPONSE);
outMsg.writeInt8(static_cast<int8_t>(accept ? 3 : 4));
}
@@ -122,7 +122,7 @@ void TradeHandler::addItem(const Item *const item, const int amount) const
if (!item)
return;
- MessageOut outMsg(CMSG_TRADE_ITEM_ADD_REQUEST);
+ createOutPacket(CMSG_TRADE_ITEM_ADD_REQUEST);
outMsg.writeInt16(static_cast<int16_t>(
item->getInvIndex() + INVENTORY_OFFSET));
outMsg.writeInt32(amount);
@@ -130,24 +130,24 @@ void TradeHandler::addItem(const Item *const item, const int amount) const
void TradeHandler::setMoney(const int amount) const
{
- MessageOut outMsg(CMSG_TRADE_ITEM_ADD_REQUEST);
+ createOutPacket(CMSG_TRADE_ITEM_ADD_REQUEST);
outMsg.writeInt16(0);
outMsg.writeInt32(amount);
}
void TradeHandler::confirm() const
{
- MessageOut outMsg(CMSG_TRADE_ADD_COMPLETE);
+ createOutPacket(CMSG_TRADE_ADD_COMPLETE);
}
void TradeHandler::finish() const
{
- MessageOut outMsg(CMSG_TRADE_OK);
+ createOutPacket(CMSG_TRADE_OK);
}
void TradeHandler::cancel() const
{
- MessageOut outMsg(CMSG_TRADE_CANCEL_REQUEST);
+ createOutPacket(CMSG_TRADE_CANCEL_REQUEST);
}
void TradeHandler::processTradeRequest(Net::MessageIn &msg) const