From 7976202af5db10450d111d7e204b68bb40c1a489 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 2 Sep 2014 16:48:18 +0300 Subject: add packet comments in buysellhandler. --- src/net/ea/buysellhandler.cpp | 12 ++++++------ src/net/eathena/buysellhandler.cpp | 12 ++++++------ src/net/tmwa/buysellhandler.cpp | 14 +++++++------- 3 files changed, 19 insertions(+), 19 deletions(-) (limited to 'src/net') diff --git a/src/net/ea/buysellhandler.cpp b/src/net/ea/buysellhandler.cpp index e9c34ac7d..0e3687aa3 100644 --- a/src/net/ea/buysellhandler.cpp +++ b/src/net/ea/buysellhandler.cpp @@ -135,14 +135,14 @@ void BuySellHandler::processNpcBuySellChoice(Net::MessageIn &msg) { if (!BuySellDialog::isActive()) { - mNpcId = msg.readInt32(); + mNpcId = msg.readInt32("npc id"); new BuySellDialog(mNpcId); } } void BuySellHandler::processNpcSell(Net::MessageIn &msg) const { - msg.readInt16(); // length + msg.readInt16("len"); const int n_items = (msg.getLength() - 4) / 10; if (n_items > 0) { @@ -151,9 +151,9 @@ void BuySellHandler::processNpcSell(Net::MessageIn &msg) const for (int k = 0; k < n_items; k++) { - const int index = msg.readInt16() - INVENTORY_OFFSET; - const int value = msg.readInt32(); - msg.readInt32(); // value + const int index = msg.readInt16("index") - INVENTORY_OFFSET; + const int value = msg.readInt32("value"); + msg.readInt32("value?"); const Item *const item = PlayerInfo::getInventory() ->getItem(index); @@ -170,7 +170,7 @@ void BuySellHandler::processNpcSell(Net::MessageIn &msg) const void BuySellHandler::processNpcBuyResponse(Net::MessageIn &msg) const { - if (msg.readUInt8() == 0U) + if (msg.readUInt8("response") == 0U) { NotifyManager::notify(NotifyTypes::BUY_DONE); } diff --git a/src/net/eathena/buysellhandler.cpp b/src/net/eathena/buysellhandler.cpp index f881738c9..a20663ea7 100644 --- a/src/net/eathena/buysellhandler.cpp +++ b/src/net/eathena/buysellhandler.cpp @@ -91,7 +91,7 @@ void BuySellHandler::handleMessage(Net::MessageIn &msg) void BuySellHandler::processNpcBuy(Net::MessageIn &msg) { - msg.readInt16(); // length + msg.readInt16("len"); const int sz = 11; const int n_items = (msg.getLength() - 4) / sz; mBuyDialog = new BuyDialog(mNpcId); @@ -99,10 +99,10 @@ void BuySellHandler::processNpcBuy(Net::MessageIn &msg) for (int k = 0; k < n_items; k++) { - const int value = msg.readInt32(); - msg.readInt32(); // DCvalue - msg.readUInt8(); // type - const int itemId = msg.readInt16(); + const int value = msg.readInt32("price"); + msg.readInt32("dc value?"); + msg.readUInt8("type"); + const int itemId = msg.readInt16("item id"); const unsigned char color = 1; mBuyDialog->addItem(itemId, color, 0, value); } @@ -111,7 +111,7 @@ void BuySellHandler::processNpcBuy(Net::MessageIn &msg) void BuySellHandler::processNpcSellResponse(Net::MessageIn &msg) { - switch (msg.readUInt8()) + switch (msg.readUInt8("result")) { case 0: NotifyManager::notify(NotifyTypes::SOLD); diff --git a/src/net/tmwa/buysellhandler.cpp b/src/net/tmwa/buysellhandler.cpp index 4668c1829..fdb8f86ba 100644 --- a/src/net/tmwa/buysellhandler.cpp +++ b/src/net/tmwa/buysellhandler.cpp @@ -94,7 +94,7 @@ void BuySellHandler::handleMessage(Net::MessageIn &msg) void BuySellHandler::processNpcBuy(Net::MessageIn &msg) { - msg.readInt16(); // length + msg.readInt16("len"); unsigned int sz = 11; if (serverVersion > 0) sz += 1; @@ -104,13 +104,13 @@ void BuySellHandler::processNpcBuy(Net::MessageIn &msg) for (unsigned int k = 0; k < n_items; k++) { - const int value = msg.readInt32(); - msg.readInt32(); // DCvalue - msg.readUInt8(); // type - const int itemId = msg.readInt16(); + const int value = msg.readInt32("price"); + msg.readInt32("dc value?"); + msg.readUInt8("type"); + const int itemId = msg.readInt16("item id"); uint8_t color = 1; if (serverVersion > 0) - color = msg.readUInt8(); + color = msg.readUInt8("item color"); mBuyDialog->addItem(itemId, color, 0, value); } mBuyDialog->sort(); @@ -118,7 +118,7 @@ void BuySellHandler::processNpcBuy(Net::MessageIn &msg) void BuySellHandler::processNpcSellResponse(Net::MessageIn &msg) { - switch (msg.readUInt8()) + switch (msg.readUInt8("result")) { case 0: NotifyManager::notify(NotifyTypes::SOLD); -- cgit v1.2.3-70-g09d2