76
const uint8_t type = msg.readUInt8("type");
77
processTradeResponseContinue(type);
82
switch (msg.readUInt8())
80
void TradeHandler::processTradeResponseContinue(const uint8_t type) const
84
84
case 0: // Too far away
85
85
NotifyManager::notify(NotifyTypes::TRADE_FAIL_FAR_AWAY,
120
120
PlayerInfo::setTrading(false);
123
NotifyManager::notify(NotifyTypes::TRADE_CANCELLED_BUSY,
122
126
default: // Shouldn't happen as well, but to be sure
123
127
NotifyManager::notify(NotifyTypes::TRADE_ERROR_UNKNOWN,
124
128
tradePartnerName);
131
void TradeHandler::processTradeItemAddResponse(Net::MessageIn &msg)
133
// Trade: New Item add response (was 0x00ea, now 01b1)
134
const int index = msg.readInt16() - INVENTORY_OFFSET;
135
Item *item = nullptr;
136
if (PlayerInfo::getInventory())
137
item = PlayerInfo::getInventory()->getItem(index);
142
tradeWindow->receivedOk(true);
145
const int quantity = msg.readInt16();
147
const uint8_t res = msg.readUInt8();
151
// Successfully added item
154
tradeWindow->addItem2(item->getId(), true,
155
quantity, item->getRefine(), item->getColor(),
156
item->isEquipment());
158
item->increaseQuantity(-quantity);
161
// Add item failed - player overweighted
162
NotifyManager::notify(NotifyTypes::
163
TRADE_ADD_PARTNER_OVER_WEIGHT);
166
// Add item failed - player has no free slot
167
NotifyManager::notify(NotifyTypes::TRADE_ADD_PARTNER_NO_SLOTS);
170
// Add item failed - non tradable item
171
NotifyManager::notify(NotifyTypes::TRADE_ADD_UNTRADABLE_ITEM);
174
NotifyManager::notify(NotifyTypes::TRADE_ADD_ERROR);
175
logger->log("QQQ SMSG_TRADE_ITEM_ADD_RESPONSE: "
181
135
void TradeHandler::processTradeOk(Net::MessageIn &msg)
183
137
// 0 means ok from myself, 1 means ok from other;