void TradeRecv::processTradeItemAdd(Net::MessageIn &msg) { const int amount = msg.readInt32("amount"); const int type = msg.readInt16("type"); const uint8_t identify = msg.readUInt8("identify"); msg.readUInt8("attribute"); const uint8_t refine = msg.readUInt8("refine"); int cards[maxCards]; for (int f = 0; f < maxCards; f++) cards[f] = msg.readUInt16("card"); if (tradeWindow) { if (type == 0) { tradeWindow->setMoney(amount); } else { tradeWindow->addItem2(type, ItemType::Unknown, cards, 4, false, amount, refine, ItemColor_one, fromBool(identify, Identified), Damaged_false, Favorite_false, Equipm_false); } } }
void MailRecv::processReadMail(Net::MessageIn &msg) { const int sz = msg.readInt16("len") - 101; MailMessage *const mail = new MailMessage; mail->id = msg.readInt32("message id"); mail->title = msg.readString(40, "title"); mail->sender = msg.readString(24, "sender name"); msg.readInt32("unused"); mail->money = msg.readInt32("money"); mail->itemAmount = msg.readInt32("item amount"); mail->itemId = msg.readInt16("item id"); mail->itemType = msg.readInt16("item type"); mail->itemIdentify = msg.readUInt8("identify"); mail->itemAttribute = msg.readUInt8("attribute"); mail->itemRefine = msg.readUInt8("refine"); for (int f = 0; f < maxCards; f ++) mail->card[f] = msg.readUInt16("card"); const int msgLen = msg.readUInt8("msg len"); if (msgLen != sz) logger->log("error: wrong message size"); mail->text = msg.readString(sz, "message"); msg.readUInt8("zero"); mail->strTime = timeToStr(mail->time); mailWindow->showMessage(mail); }
void AuctionRecv::processAuctionResults(Net::MessageIn &msg) { UNIMPLEMENTEDPACKET; msg.readInt16("len"); msg.readInt32("pages"); const int itemCount = msg.readInt32("items count"); for (int f = 0; f < itemCount; f ++) { msg.readInt32("auction id"); msg.readString(24, "seller name"); msg.readInt16("item id"); // here item always 16 bit msg.readInt32("auction type"); msg.readInt16("item amount"); // always 1 msg.readUInt8("identify"); msg.readUInt8("attribute"); msg.readUInt8("refine"); for (int d = 0; d < maxCards; d ++) msg.readUInt16("card"); // here item always 16 bit msg.readInt32("price"); msg.readInt32("buy now"); msg.readString(24, "buyer name"); msg.readInt32("timestamp"); // +++ need use ItemColorManager for color } }