summaryrefslogtreecommitdiff
path: root/src/net
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
parent403792db7d005066273bcbe138afcd1a98b3144c (diff)
downloadmv-b7addc0a9a519cf9dcc3e804d9918ce4934a3e83.tar.gz
mv-b7addc0a9a519cf9dcc3e804d9918ce4934a3e83.tar.bz2
mv-b7addc0a9a519cf9dcc3e804d9918ce4934a3e83.tar.xz
mv-b7addc0a9a519cf9dcc3e804d9918ce4934a3e83.zip
Add comments for all output packets header.
Diffstat (limited to 'src/net')
-rw-r--r--src/net/eathena/adminhandler.cpp32
-rw-r--r--src/net/eathena/bankhandler.cpp6
-rw-r--r--src/net/eathena/beinghandler.cpp6
-rw-r--r--src/net/eathena/charserverhandler.cpp12
-rw-r--r--src/net/eathena/chathandler.cpp24
-rw-r--r--src/net/eathena/familyhandler.cpp4
-rw-r--r--src/net/eathena/gamehandler.cpp6
-rw-r--r--src/net/eathena/inventoryhandler.cpp18
-rw-r--r--src/net/eathena/loginhandler.cpp4
-rw-r--r--src/net/eathena/mailhandler.cpp16
-rw-r--r--src/net/eathena/npchandler.cpp36
-rw-r--r--src/net/eathena/partyhandler.cpp24
-rw-r--r--src/net/eathena/pethandler.cpp6
-rw-r--r--src/net/eathena/playerhandler.cpp38
-rw-r--r--src/net/eathena/questhandler.cpp2
-rw-r--r--src/net/eathena/skillhandler.cpp8
-rw-r--r--src/net/eathena/tradehandler.cpp14
-rw-r--r--src/net/messageout.h2
-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
30 files changed, 207 insertions, 205 deletions
diff --git a/src/net/eathena/adminhandler.cpp b/src/net/eathena/adminhandler.cpp
index 009a596e6..605a73c6d 100644
--- a/src/net/eathena/adminhandler.cpp
+++ b/src/net/eathena/adminhandler.cpp
@@ -81,38 +81,38 @@ 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");
}
void AdminHandler::kickAll() const
{
- MessageOut outMsg(CMSG_ADMIN_KICK_ALL);
+ createOutPacket(CMSG_ADMIN_KICK_ALL);
}
void AdminHandler::warp(const std::string &map, const int x, const int y) const
{
- MessageOut outMsg(CMSG_PLAYER_MAPMOVE);
+ createOutPacket(CMSG_PLAYER_MAPMOVE);
outMsg.writeString(map, 16, "map");
outMsg.writeInt16(static_cast<int16_t>(x), "x");
outMsg.writeInt16(static_cast<int16_t>(y), "y");
@@ -120,25 +120,25 @@ void AdminHandler::warp(const std::string &map, const int x, const int y) const
void AdminHandler::resetStats() const
{
- MessageOut outMsg(CMSG_ADMIN_RESET_PLAYER);
+ createOutPacket(CMSG_ADMIN_RESET_PLAYER);
outMsg.writeInt16(0, "flag");
}
void AdminHandler::resetSkills() const
{
- MessageOut outMsg(CMSG_ADMIN_RESET_PLAYER);
+ createOutPacket(CMSG_ADMIN_RESET_PLAYER);
outMsg.writeInt16(1, "flag");
}
void AdminHandler::gotoName(const std::string &name) const
{
- MessageOut outMsg(CMSG_ADMIN_GOTO);
+ createOutPacket(CMSG_ADMIN_GOTO);
outMsg.writeString(name, 24, "name");
}
void AdminHandler::recallName(const std::string &name) const
{
- MessageOut outMsg(CMSG_ADMIN_RECALL);
+ createOutPacket(CMSG_ADMIN_RECALL);
outMsg.writeString(name, 24, "name");
}
@@ -149,7 +149,7 @@ void AdminHandler::mute(const Being *const being,
if (!being)
return;
- MessageOut outMsg(CMSG_ADMIN_MUTE);
+ createOutPacket(CMSG_ADMIN_MUTE);
outMsg.writeInt32(being->getId(), "account id");
outMsg.writeInt8(static_cast<int8_t>(type), "type");
outMsg.writeInt16(static_cast<int16_t>(limit), "value");
@@ -157,7 +157,7 @@ void AdminHandler::mute(const Being *const being,
void AdminHandler::muteName(const std::string &name) const
{
- MessageOut outMsg(CMSG_ADMIN_MUTE_NAME);
+ createOutPacket(CMSG_ADMIN_MUTE_NAME);
outMsg.writeString(name, 24, "name");
}
@@ -166,14 +166,14 @@ void AdminHandler::requestLogin(const Being *const being) const
if (!being)
return;
- MessageOut outMsg(CMSG_ADMIN_ID_TO_LOGIN);
+ createOutPacket(CMSG_ADMIN_ID_TO_LOGIN);
outMsg.writeInt32(being->getId(), "account id");
}
void AdminHandler::setTileType(const int x, const int y,
const int type) const
{
- MessageOut outMsg(CMSG_ADMIN_SET_TILE_TYPE);
+ createOutPacket(CMSG_ADMIN_SET_TILE_TYPE);
outMsg.writeInt16(static_cast<int16_t>(x), "x");
outMsg.writeInt16(static_cast<int16_t>(y), "y");
outMsg.writeInt16(static_cast<int16_t>(type), "type");
@@ -184,7 +184,7 @@ void AdminHandler::unequipAll(const Being *const being) const
if (!being)
return;
- MessageOut outMsg(CMSG_ADMIN_UNEQUIP_ALL);
+ createOutPacket(CMSG_ADMIN_UNEQUIP_ALL);
outMsg.writeInt32(being->getId(), "account id");
}
@@ -206,7 +206,7 @@ void AdminHandler::processSetTileType(Net::MessageIn &msg)
void AdminHandler::requestStats(const std::string &name)
{
mStatsName = name;
- MessageOut outMsg(CMSG_ADMIN_REQUEST_STATS);
+ createOutPacket(CMSG_ADMIN_REQUEST_STATS);
outMsg.writeString(name, 24);
}
diff --git a/src/net/eathena/bankhandler.cpp b/src/net/eathena/bankhandler.cpp
index 7b4d849dd..352aca54e 100644
--- a/src/net/eathena/bankhandler.cpp
+++ b/src/net/eathena/bankhandler.cpp
@@ -61,21 +61,21 @@ void BankHandler::handleMessage(Net::MessageIn &msg)
void BankHandler::deposit(const int money) const
{
- MessageOut outMsg(CMSG_BANK_DEPOSIT);
+ createOutPacket(CMSG_BANK_DEPOSIT);
outMsg.writeInt32(0, "account id");
outMsg.writeInt32(money, "money");
}
void BankHandler::withdraw(const int money) const
{
- MessageOut outMsg(CMSG_BANK_WITHDRAW);
+ createOutPacket(CMSG_BANK_WITHDRAW);
outMsg.writeInt32(0, "account id");
outMsg.writeInt32(money, "money");
}
void BankHandler::check() const
{
- MessageOut outMsg(CMSG_BANK_CHECK);
+ createOutPacket(CMSG_BANK_CHECK);
outMsg.writeInt32(0, "account id");
}
diff --git a/src/net/eathena/beinghandler.cpp b/src/net/eathena/beinghandler.cpp
index a3c40ab68..a4e934af2 100644
--- a/src/net/eathena/beinghandler.cpp
+++ b/src/net/eathena/beinghandler.cpp
@@ -111,7 +111,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); // readLong(2));
}
@@ -297,7 +297,7 @@ void BeingHandler::undress(Being *const being) const
void BeingHandler::requestRanks(const Rank::Rank rank) const
{
- MessageOut outMsg(CMSG_REQUEST_RANKS);
+ createOutPacket(CMSG_REQUEST_RANKS);
outMsg.writeInt16(static_cast<int16_t>(rank), "type");
}
@@ -1689,7 +1689,7 @@ void BeingHandler::viewPlayerEquipment(const Being *const being)
if (!being)
return;
- MessageOut outMsg(CMSG_PLAYER_VIEW_EQUIPMENT);
+ createOutPacket(CMSG_PLAYER_VIEW_EQUIPMENT);
outMsg.writeInt32(being->getId(), "account id");
}
diff --git a/src/net/eathena/charserverhandler.cpp b/src/net/eathena/charserverhandler.cpp
index bf1f18004..d0c0247ca 100644
--- a/src/net/eathena/charserverhandler.cpp
+++ b/src/net/eathena/charserverhandler.cpp
@@ -232,7 +232,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));
}
@@ -244,7 +244,7 @@ void CharServerHandler::newCharacter(const std::string &name, const int slot,
const std::vector<int> &stats A_UNUSED)
const
{
- MessageOut outMsg(CMSG_CHAR_CREATE);
+ createOutPacket(CMSG_CHAR_CREATE);
outMsg.writeString(name, 24, "login");
outMsg.writeInt8(static_cast<unsigned char>(slot), "slot");
@@ -259,7 +259,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");
}
@@ -267,7 +267,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");
}
@@ -281,7 +281,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");
@@ -449,7 +449,7 @@ void CharServerHandler::setNewPincode(const std::string &pin A_UNUSED)
{
// here need ecript pin with mPinSeed and pin values.
-// MessageOut outMsg(CMSG_CHAR_CREATE_PIN);
+// createOutPacket(CMSG_CHAR_CREATE_PIN);
// outMsg.writeInt32(mPinAccountId, "account id");
// outMsg.writeString(pin, 4, "encrypted pin");
}
diff --git a/src/net/eathena/chathandler.cpp b/src/net/eathena/chathandler.cpp
index d03e3b304..028cc68a8 100644
--- a/src/net/eathena/chathandler.cpp
+++ b/src/net/eathena/chathandler.cpp
@@ -160,7 +160,7 @@ void ChatHandler::talk(const std::string &restrict text,
const std::string mes = std::string(localPlayer->getName()).append(
" : ").append(text);
- 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");
@@ -168,7 +168,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");
}
@@ -176,7 +176,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 + 1), "len");
outMsg.writeString(recipient, 24, "recipient nick");
outMsg.writeString(text, static_cast<int>(text.length()), "message");
@@ -186,7 +186,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
@@ -256,34 +256,34 @@ void ChatHandler::processRaw(MessageOut &restrict outMsg,
void ChatHandler::ignoreAll() const
{
- MessageOut outMsg(CMSG_IGNORE_ALL);
+ createOutPacket(CMSG_IGNORE_ALL);
outMsg.writeInt8(0, "flag");
}
void ChatHandler::unIgnoreAll() const
{
- 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");
}
void ChatHandler::requestIgnoreList() const
{
- MessageOut outMsg(CMSG_REQUEST_IGNORE_LIST);
+ createOutPacket(CMSG_REQUEST_IGNORE_LIST);
}
void ChatHandler::createChatRoom(const std::string &title,
@@ -291,7 +291,7 @@ void ChatHandler::createChatRoom(const std::string &title,
const int limit,
const bool isPublic)
{
- MessageOut outMsg(CMSG_CREAYE_CHAT_ROOM);
+ createOutPacket(CMSG_CREAYE_CHAT_ROOM);
outMsg.writeInt16(static_cast<int16_t>(
password.size() + title.size() + 5), "len");
outMsg.writeInt16(static_cast<int16_t>(limit), "limit");
@@ -308,7 +308,7 @@ void ChatHandler::battleTalk(const std::string &text) const
const std::string mes = std::string(localPlayer->getName()).append(
" : ").append(text);
- MessageOut outMsg(CMSG_BATTLE_CHAT_MESSAGE);
+ createOutPacket(CMSG_BATTLE_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");
@@ -485,7 +485,7 @@ void ChatHandler::joinChat(const ChatObject *const chat,
if (!chat)
return;
- MessageOut outMsg(CMSG_CHAT_JOIN);
+ createOutPacket(CMSG_CHAT_JOIN);
outMsg.writeInt32(chat->chatId, "chat id");
outMsg.writeString(password, 8, "password");
}
diff --git a/src/net/eathena/familyhandler.cpp b/src/net/eathena/familyhandler.cpp
index b0135a4f3..543870328 100644
--- a/src/net/eathena/familyhandler.cpp
+++ b/src/net/eathena/familyhandler.cpp
@@ -68,7 +68,7 @@ void FamilyHandler::askForChild(const Being *const being)
if (!being)
return;
- MessageOut outMsg(CMSG_ASK_FOR_CHILD);
+ createOutPacket(CMSG_ASK_FOR_CHILD);
outMsg.writeInt32(being->getId());
}
@@ -81,7 +81,7 @@ void FamilyHandler::processAskForChild(Net::MessageIn &msg)
void FamilyHandler::askForChildReply(const bool accept)
{
- MessageOut outMsg(CMSG_ASK_FOR_CHILD_REPLY);
+ createOutPacket(CMSG_ASK_FOR_CHILD_REPLY);
outMsg.writeInt32(mParent1, "parent1");
outMsg.writeInt32(mParent2, "parent2");
outMsg.writeInt32(accept ? 0: 1, "result");
diff --git a/src/net/eathena/gamehandler.cpp b/src/net/eathena/gamehandler.cpp
index 381131fbc..d8f3f5c0e 100644
--- a/src/net/eathena/gamehandler.cpp
+++ b/src/net/eathena/gamehandler.cpp
@@ -97,7 +97,7 @@ void GameHandler::handleMessage(Net::MessageIn &msg)
void GameHandler::mapLoadedEvent() const
{
- MessageOut outMsg(CMSG_MAP_LOADED);
+ createOutPacket(CMSG_MAP_LOADED);
}
void GameHandler::connect()
@@ -125,7 +125,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 key1");
@@ -157,7 +157,7 @@ void GameHandler::disconnect()
void GameHandler::quit() const
{
- MessageOut outMsg(CMSG_CLIENT_QUIT);
+ createOutPacket(CMSG_CLIENT_QUIT);
}
void GameHandler::ping(const int tick) const
diff --git a/src/net/eathena/inventoryhandler.cpp b/src/net/eathena/inventoryhandler.cpp
index 65e92ed7c..1e3a80ffe 100644
--- a/src/net/eathena/inventoryhandler.cpp
+++ b/src/net/eathena/inventoryhandler.cpp
@@ -161,7 +161,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), "index");
// here we set flag for any slots,
@@ -174,7 +174,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));
}
@@ -184,7 +184,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
@@ -195,7 +195,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));
@@ -203,7 +203,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,
@@ -238,7 +238,7 @@ void InventoryHandler::moveItem2(const int source,
if (packet)
{
- MessageOut outMsg(packet);
+ createOutPacket(packet);
outMsg.writeInt16(static_cast<int16_t>(slot + offset));
outMsg.writeInt32(amount);
}
@@ -246,14 +246,14 @@ void InventoryHandler::moveItem2(const int source,
void InventoryHandler::useCard(const int index) const
{
- MessageOut outMsg(CMSG_PLAYER_USE_CARD);
+ createOutPacket(CMSG_PLAYER_USE_CARD);
outMsg.writeInt16(static_cast<int16_t>(index + INVENTORY_OFFSET), "index");
}
void InventoryHandler::insertCard(const int cardIndex,
const int itemIndex) const
{
- MessageOut outMsg(CMSG_PLAYER_INSERT_CARD);
+ createOutPacket(CMSG_PLAYER_INSERT_CARD);
outMsg.writeInt16(static_cast<int16_t>(cardIndex + INVENTORY_OFFSET),
"card index");
outMsg.writeInt16(static_cast<int16_t>(itemIndex + INVENTORY_OFFSET),
@@ -263,7 +263,7 @@ void InventoryHandler::insertCard(const int cardIndex,
void InventoryHandler::favoriteItem(const Item *const item,
const bool favorite) const
{
- MessageOut outMsg(CMSG_PLAYER_FAVORITE_ITEM);
+ createOutPacket(CMSG_PLAYER_FAVORITE_ITEM);
outMsg.writeInt16(static_cast<int16_t>(item->getInvIndex()
+ INVENTORY_OFFSET),
"item index");
diff --git a/src/net/eathena/loginhandler.cpp b/src/net/eathena/loginhandler.cpp
index 6441bf351..b5f2ed07d 100644
--- a/src/net/eathena/loginhandler.cpp
+++ b/src/net/eathena/loginhandler.cpp
@@ -118,7 +118,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);
outMsg.writeStringNoLog(newPassword, 24);
}
@@ -128,7 +128,7 @@ void LoginHandler::sendLoginRegister(const std::string &restrict username,
const std::string &restrict email
A_UNUSED) const
{
- MessageOut outMsg(CMSG_LOGIN_REGISTER);
+ createOutPacket(CMSG_LOGIN_REGISTER);
outMsg.writeInt32(20, "client version");
outMsg.writeString(username, 24, "login");
outMsg.writeStringNoLog(password, 24, "password");
diff --git a/src/net/eathena/mailhandler.cpp b/src/net/eathena/mailhandler.cpp
index af7a07e7b..00fa5fac5 100644
--- a/src/net/eathena/mailhandler.cpp
+++ b/src/net/eathena/mailhandler.cpp
@@ -78,44 +78,44 @@ void MailHandler::processMailOpen(Net::MessageIn &msg) const
void MailHandler::refresh()
{
- MessageOut outMsg(CMSG_MAIL_REFRESH_INBOX);
+ createOutPacket(CMSG_MAIL_REFRESH_INBOX);
}
void MailHandler::readMessage(const int msgId)
{
- MessageOut outMsg(CMSG_MAIL_READ_MESSAGE);
+ createOutPacket(CMSG_MAIL_READ_MESSAGE);
outMsg.writeInt32(msgId, "message id");
}
void MailHandler::getAttach(const int msgId)
{
- MessageOut outMsg(CMSG_MAIL_GET_ATTACH);
+ createOutPacket(CMSG_MAIL_GET_ATTACH);
outMsg.writeInt32(msgId, "message id");
}
void MailHandler::deleteMessage(const int msgId)
{
- MessageOut outMsg(CMSG_MAIL_DELETE_MESSAGE);
+ createOutPacket(CMSG_MAIL_DELETE_MESSAGE);
outMsg.writeInt32(msgId, "message id");
}
void MailHandler::returnMessage(const int msgId)
{
- MessageOut outMsg(CMSG_MAIL_RETURN_MESSAGE);
+ createOutPacket(CMSG_MAIL_RETURN_MESSAGE);
outMsg.writeInt32(msgId, "message id");
outMsg.writeString("", 24, "unused");
}
void MailHandler::setAttach(const int index, const int amount)
{
- MessageOut outMsg(CMSG_MAIL_SET_ATTACH);
+ createOutPacket(CMSG_MAIL_SET_ATTACH);
outMsg.writeInt16(static_cast<int16_t>(index + INVENTORY_OFFSET), "index");
outMsg.writeInt32(amount, "amount");
}
void MailHandler::resetAttach(const int flag)
{
- MessageOut outMsg(CMSG_MAIL_RESET_ATTACH);
+ createOutPacket(CMSG_MAIL_RESET_ATTACH);
outMsg.writeInt16(static_cast<int16_t>(flag), "flag");
}
@@ -127,7 +127,7 @@ void MailHandler::send(const std::string &name,
message = message.substr(0, 255);
const int sz = static_cast<int>(message.size());
- MessageOut outMsg(CMSG_MAIL_SEND);
+ createOutPacket(CMSG_MAIL_SEND);
outMsg.writeInt16(69 + sz);
outMsg.writeString(name, 24, "name");
outMsg.writeString(title, 40, "title");
diff --git a/src/net/eathena/npchandler.cpp b/src/net/eathena/npchandler.cpp
index 90a441d0a..a71283863 100644
--- a/src/net/eathena/npchandler.cpp
+++ b/src/net/eathena/npchandler.cpp
@@ -108,20 +108,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);
@@ -138,21 +138,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()));
@@ -161,14 +161,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
}
@@ -177,7 +177,7 @@ void NpcHandler::buyItem(const int beingId A_UNUSED, const int itemId,
const unsigned char color A_UNUSED,
const int amount) const
{
- MessageOut outMsg(CMSG_NPC_BUY_REQUEST);
+ createOutPacket(CMSG_NPC_BUY_REQUEST);
outMsg.writeInt16(8); // One item (length of packet)
outMsg.writeInt16(static_cast<int16_t>(amount));
outMsg.writeInt16(static_cast<int16_t>(itemId));
@@ -186,7 +186,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));
@@ -194,7 +194,7 @@ void NpcHandler::sellItem(const int beingId A_UNUSED,
void NpcHandler::completeProgressBar() const
{
- MessageOut outMsg(CMSG_NPC_COMPLETE_PROGRESS_BAR);
+ createOutPacket(CMSG_NPC_COMPLETE_PROGRESS_BAR);
}
void NpcHandler::produceMix(const int nameId,
@@ -202,7 +202,7 @@ void NpcHandler::produceMix(const int nameId,
const int materialId2,
const int materialId3) const
{
- MessageOut outMsg(CMSG_NPC_PRODUCE_MIX);
+ createOutPacket(CMSG_NPC_PRODUCE_MIX);
outMsg.writeInt16(static_cast<int16_t>(nameId), "name id");
outMsg.writeInt16(static_cast<int16_t>(materialId1), "material 1");
outMsg.writeInt16(static_cast<int16_t>(materialId2), "material 2");
@@ -212,38 +212,38 @@ void NpcHandler::produceMix(const int nameId,
void NpcHandler::cooking(const CookingType::Type type,
const int nameId) const
{
- MessageOut outMsg(CMSG_NPC_COOKING);
+ createOutPacket(CMSG_NPC_COOKING);
outMsg.writeInt16(static_cast<int16_t>(type), "type");
outMsg.writeInt16(static_cast<int16_t>(nameId), "name id");
}
void NpcHandler::repair(const int index) const
{
- MessageOut outMsg(CMSG_NPC_REPAIR);
+ createOutPacket(CMSG_NPC_REPAIR);
outMsg.writeInt16(static_cast<int16_t>(index), "index");
}
void NpcHandler::refine(const int index) const
{
- MessageOut outMsg(CMSG_NPC_REFINE);
+ createOutPacket(CMSG_NPC_REFINE);
outMsg.writeInt32(index, "index");
}
void NpcHandler::identify(const int index) const
{
- MessageOut outMsg(CMSG_NPC_IDENTIFY);
+ createOutPacket(CMSG_NPC_IDENTIFY);
outMsg.writeInt16(static_cast<int16_t>(index), "index");
}
void NpcHandler::selectArrow(const int nameId) const
{
- MessageOut outMsg(CMSG_NPC_SELECT_ARROW);
+ createOutPacket(CMSG_NPC_SELECT_ARROW);
outMsg.writeInt16(static_cast<int16_t>(nameId), "name id");
}
void NpcHandler::selectAutoSpell(const int skillId) const
{
- MessageOut outMsg(CMSG_NPC_SELECT_AUTO_SPELL);
+ createOutPacket(CMSG_NPC_SELECT_AUTO_SPELL);
outMsg.writeInt32(static_cast<int16_t>(skillId), "skill id");
}
diff --git a/src/net/eathena/partyhandler.cpp b/src/net/eathena/partyhandler.cpp
index 47260cc2b..d90b82248 100644
--- a/src/net/eathena/partyhandler.cpp
+++ b/src/net/eathena/partyhandler.cpp
@@ -120,7 +120,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);
}
@@ -133,12 +133,12 @@ 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(), "account id");
}
else
{
- MessageOut outMsg(CMSG_PARTY_INVITE2);
+ createOutPacket(CMSG_PARTY_INVITE2);
outMsg.writeString(name, 24, "nick");
}
}
@@ -148,7 +148,7 @@ void PartyHandler::inviteResponse(const std::string &inviter A_UNUSED,
{
if (localPlayer)
{
- MessageOut outMsg(CMSG_PARTY_INVITED2);
+ createOutPacket(CMSG_PARTY_INVITED2);
outMsg.writeInt32(localPlayer->getId());
outMsg.writeInt8(static_cast<int8_t>(accept ? 1 : 0));
}
@@ -156,14 +156,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
}
@@ -181,14 +181,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);
const std::string mes = std::string(localPlayer->getName()).append(
" : ").append(text);
@@ -203,7 +203,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));
}
@@ -214,7 +214,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));
}
@@ -452,13 +452,13 @@ void PartyHandler::changeLeader(const std::string &name) const
name, ActorType::Player);
if (!being)
return;
- MessageOut outMsg(CMSG_PARTY_CHANGE_LEADER);
+ createOutPacket(CMSG_PARTY_CHANGE_LEADER);
outMsg.writeInt32(being->getId());
}
void PartyHandler::allowInvite(const bool allow) const
{
- MessageOut outMsg(CMSG_PARTY_ALLOW_INVITES);
+ createOutPacket(CMSG_PARTY_ALLOW_INVITES);
outMsg.writeInt8(allow ? 1 : 0);
}
diff --git a/src/net/eathena/pethandler.cpp b/src/net/eathena/pethandler.cpp
index d801c422c..7ccc57283 100644
--- a/src/net/eathena/pethandler.cpp
+++ b/src/net/eathena/pethandler.cpp
@@ -100,19 +100,19 @@ void PetHandler::catchPet(const Being *const being) const
if (!being)
return;
- MessageOut outMsg(CMSG_PET_CATCH);
+ createOutPacket(CMSG_PET_CATCH);
outMsg.writeInt32(being->getId(), "monster id");
}
void PetHandler::requestPetState(const int data) const
{
- MessageOut outMsg(CMSG_PET_REQUEST_STATE);
+ createOutPacket(CMSG_PET_REQUEST_STATE);
outMsg.writeInt32(data, "param");
}
void PetHandler::setName(const std::string &name) const
{
- MessageOut outMsg(CMSG_PET_SET_NAME);
+ createOutPacket(CMSG_PET_SET_NAME);
outMsg.writeString(name, 24, "name");
}
diff --git a/src/net/eathena/playerhandler.cpp b/src/net/eathena/playerhandler.cpp
index 0a75e7066..209284504 100644
--- a/src/net/eathena/playerhandler.cpp
+++ b/src/net/eathena/playerhandler.cpp
@@ -135,7 +135,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);
@@ -145,12 +145,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);
}
@@ -158,7 +158,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);
}
@@ -169,7 +169,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);
}
@@ -178,7 +178,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());
EAthena::InventoryHandler *const handler =
static_cast<EAthena::InventoryHandler*>(inventoryHandler);
@@ -188,7 +188,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.writeInt8(0, "head direction");
outMsg.writeInt8(0, "unused");
outMsg.writeInt8(direction, "player direction");
@@ -197,7 +197,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));
@@ -223,14 +223,14 @@ 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);
}
@@ -247,7 +247,7 @@ void PlayerHandler::setShortcut(const int idx,
const int id,
const int level) const
{
- MessageOut outMsg(CMSG_SET_SHORTCUTS);
+ createOutPacket(CMSG_SET_SHORTCUTS);
outMsg.writeInt16(static_cast<int16_t>(idx), "index");
outMsg.writeInt8(static_cast<int8_t>(type), "type");
outMsg.writeInt32(id, "id");
@@ -256,18 +256,18 @@ void PlayerHandler::setShortcut(const int idx,
void PlayerHandler::removeOption() const
{
- MessageOut outMsg(CMSG_REMOVE_OPTION);
+ createOutPacket(CMSG_REMOVE_OPTION);
}
void PlayerHandler::changeCart(const int type) const
{
- MessageOut outMsg(CMSG_CHANGE_CART);
+ createOutPacket(CMSG_CHANGE_CART);
outMsg.writeInt16(static_cast<int16_t>(type), "type");
}
void PlayerHandler::setMemo() const
{
- MessageOut outMsg(CMSG_PLAYER_SET_MEMO);
+ createOutPacket(CMSG_PLAYER_SET_MEMO);
}
void PlayerHandler::processPlayerShortcuts(Net::MessageIn &msg)
@@ -393,17 +393,17 @@ void PlayerHandler::processWalkResponse(Net::MessageIn &msg)
void PlayerHandler::doriDori() const
{
- MessageOut outMsg(CMSG_DORI_DORI);
+ createOutPacket(CMSG_DORI_DORI);
}
void PlayerHandler::explosionSpirits() const
{
- MessageOut outMsg(CMSG_EXPLOSION_SPIRITS);
+ createOutPacket(CMSG_EXPLOSION_SPIRITS);
}
void PlayerHandler::requestPvpInfo() const
{
- MessageOut outMsg(CMSG_PVP_INFO);
+ createOutPacket(CMSG_PVP_INFO);
outMsg.writeInt32(0, "char id");
outMsg.writeInt32(0, "account id");
}
@@ -419,12 +419,12 @@ void PlayerHandler::processPvpInfo(Net::MessageIn &msg)
void PlayerHandler::revive() const
{
- MessageOut outMsg(CMSG_PLAYER_AUTO_REVIVE);
+ createOutPacket(CMSG_PLAYER_AUTO_REVIVE);
}
void PlayerHandler::setViewEquipment(const bool allow) const
{
- MessageOut outMsg(CMSG_PLAYER_SET_EQUIPMENT_VISIBLE);
+ createOutPacket(CMSG_PLAYER_SET_EQUIPMENT_VISIBLE);
outMsg.writeInt32(0, "unused");
outMsg.writeInt32(allow ? 1 : 0);
}
diff --git a/src/net/eathena/questhandler.cpp b/src/net/eathena/questhandler.cpp
index 76dad59a9..87a84d5ee 100644
--- a/src/net/eathena/questhandler.cpp
+++ b/src/net/eathena/questhandler.cpp
@@ -185,7 +185,7 @@ void QuestHandler::processRemoveQuest(Net::MessageIn &msg)
void QuestHandler::setQeustActiveState(const int questId,
const bool active) const
{
- MessageOut outMsg(CMSG_QUEST_ACTIVATE);
+ createOutPacket(CMSG_QUEST_ACTIVATE);
outMsg.writeInt32(questId, "quest id");
outMsg.writeInt8(active ? 1 : 0, "activate");
}
diff --git a/src/net/eathena/skillhandler.cpp b/src/net/eathena/skillhandler.cpp
index 9846a6c2a..77e87d64a 100644
--- a/src/net/eathena/skillhandler.cpp
+++ b/src/net/eathena/skillhandler.cpp
@@ -85,7 +85,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);
@@ -94,7 +94,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));
@@ -105,7 +105,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");
@@ -115,7 +115,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/eathena/tradehandler.cpp b/src/net/eathena/tradehandler.cpp
index f81d80e24..02968fa5b 100644
--- a/src/net/eathena/tradehandler.cpp
+++ b/src/net/eathena/tradehandler.cpp
@@ -107,7 +107,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());
}
@@ -116,7 +116,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));
}
@@ -125,7 +125,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);
@@ -133,24 +133,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
diff --git a/src/net/messageout.h b/src/net/messageout.h
index 9238e2c55..758a4a966 100644
--- a/src/net/messageout.h
+++ b/src/net/messageout.h
@@ -27,6 +27,8 @@
#include "localconsts.h"
+#define createOutPacket(name) MessageOut outMsg(name, #name)
+
namespace Net
{
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