52 #include "utils/timer.h"
70 msg.readUInt8(
"has new mail");
76 msg.readString(24,
"receiver");
77 msg.readUInt8(
"result");
82 const int res =
msg.readUInt8(
"result");
84 const int amount =
msg.readInt16(
"amount");
85 const int itemId =
msg.readItemId(
"item id");
87 msg.readUInt8(
"item type"));
88 const uint8_t identify =
msg.readUInt8(
"identify");
90 const uint8_t refine =
msg.readUInt8(
"refine");
93 cards[f] =
msg.readItemId(
"card");
95 for (
int f = 0; f < 5; f ++)
97 const uint16_t idx =
msg.readInt16(
"option index");
98 const uint16_t val =
msg.readInt16(
"option value");
99 msg.readUInt8(
"option param");
100 options->
add(idx, val);
102 msg.readInt16(
"weight");
104 msg.readInt32(
"location");
113 if (inventory ==
nullptr)
153 const int slot = inventory->
addItem(itemId,
170 inventory->
setTag(slot, index);
183 const int result =
msg.readUInt8(
"result");
185 const int amount =
msg.readInt16(
"count");
186 msg.readInt16(
"weight");
196 std::string itemName;
205 itemName =
_(
"Unknown item");
219 if (inventory ==
nullptr)
243 const int charId =
msg.readInt32(
"char id");
244 msg.readInt16(
"class");
245 msg.readInt16(
"level");
246 if (
msg.getVersion() >= 20160316)
247 msg.readString(24,
"name");
251 reportAlways(
"Mail2Recv::processCheckNameResult no names in queue."
252 "Char id: %d", charId)
303 const int res =
msg.readUInt8(
"result");
336 msg.readInt16(
"len");
343 const int cnt =
msg.readUInt8(
"cnt");
344 isEnd =
msg.readUInt8(
"isEnd") != 0;
345 for (
int f = 0; f < cnt; f ++)
348 mail->
id =
msg.readInt64(
"mail id");
349 mail->
read =
msg.readUInt8(
"is read") != 0U ? true :
false;
351 msg.readUInt8(
"type"));
352 mail->
sender =
msg.readString(24,
"sender name");
360 mail->
title =
msg.readString(-1,
"title");
366 isEnd =
msg.readUInt8(
"isEnd") != 0;
367 while (
msg.getUnreadLength() > 0)
371 msg.readUInt8(
"open type");
372 mail->
id =
msg.readInt64(
"mail id");
373 mail->
read =
msg.readUInt8(
"is read") != 0U ? true :
false;
375 msg.readUInt8(
"type"));
376 mail->
sender =
msg.readString(24,
"sender name");
380 mail->
title =
msg.readString(-1,
"title");
391 msg.readInt16(
"len");
393 msg.readUInt8(
"open type"));
394 const int64_t mailId =
msg.readInt64(
"mail id");
395 const int textLen =
msg.readInt16(
"text len");
396 const int64_t money =
msg.readInt64(
"money");
397 const int itemsCount =
msg.readUInt8(
"item count");
398 const std::string text =
msg.readString(textLen,
"text message");
410 for (
int f = 0; f < itemsCount; f ++)
412 msg.readInt16(
"amount");
413 msg.readItemId(
"item id");
414 msg.readUInt8(
"identify");
415 msg.readUInt8(
"damaged");
416 msg.readUInt8(
"refine");
418 msg.readItemId(
"card");
419 msg.readInt32(
"location");
420 msg.readUInt8(
"type");
421 msg.readInt16(
"view sprite");
422 msg.readInt16(
"bind on equip");
423 for (
int d = 0; d < 5; d ++)
425 msg.readInt16(
"option index");
426 msg.readInt16(
"option value");
427 msg.readUInt8(
"option param");
439 for (
int f = 0; f < itemsCount; f ++)
442 if (
msg.getUnreadLength() == 0)
444 const int amount =
msg.readInt16(
"amount");
445 const int itemId =
msg.readItemId(
"item id");
446 const uint8_t identify =
msg.readUInt8(
"identify");
448 const uint8_t refine =
msg.readUInt8(
"refine");
451 cards[d] =
msg.readItemId(
"card");
452 msg.readInt32(
"location");
454 msg.readUInt8(
"item type"));
455 msg.readInt16(
"view sprite");
456 msg.readInt16(
"bind on equip");
458 for (
int d = 0; d < 5; d ++)
460 const uint16_t idx =
msg.readInt16(
"option index");
461 const uint16_t val =
msg.readInt16(
"option value");
462 msg.readUInt8(
"option param");
463 options->
add(idx, val);
466 const int slot = inventory->
addItem(itemId,
490 msg.readUInt8(
"open type");
491 const int64_t mailId =
msg.readInt64(
"mail id");
502 const int64_t mailId =
msg.readInt64(
"mail id");
503 msg.readUInt8(
"open type");
504 const int res =
msg.readUInt8(
"result");
531 const int64_t mailId =
msg.readInt64(
"mail id");
532 msg.readUInt8(
"open type");
533 const int res =
msg.readUInt8(
"result");
#define fromBool(val, name)
#define reportAlways(...)
void setCards(const int index, const int *const cards, const int size) const
int findIndexByTag(const int tag) const
Item * getItem(const int index) const
void setTag(const int index, const int tag)
Item * findItemByTag(const int tag) const
void setOptions(const int index, const ItemOptionsList *const options)
int addItem(const int id, const ItemTypeT type, const int quantity, const uint8_t refine, const ItemColor color, const Identified identified, const Damaged damaged, const Favorite favorite, const Equipm equipment, const Equipped equipped)
static ItemColor getColorFromCards(const int *const cards)
std::string getName() const
void increaseQuantity(const int amount)
Inventory * getInventory() const
void removeItems(const int64_t mailId)
void removeMoney(const int64_t mailId)
Inventory * getInventory() const
void setOpenType(const MailOpenTypeT &type)
void removeMail(const int64_t id)
void addMail(MailMessage *const message)
MailMessage * findMail(const int64_t id)
void showMessage(MailMessage *const mail, const int itemsCount)
static void createMail(const std::string &to)
MailOpenTypeT getOpenType() const
virtual void sendMail(const std::string &to, const std::string &title, const std::string &body, const int64_t &money) const =0
static const int INVENTORY_OFFSET
const bool Equipped_false
const bool Favorite_false
#define fromInt(val, name)
#define UNIMPLEMENTEDPACKETFIELD(field)
#define UNIMPLEMENTEDPACKET
Net::Mail2Handler * mail2Handler
MailEditWindow * mailEditWindow
MailOpenType ::T MailOpenTypeT
MailViewWindow * mailViewWindow
bool msg(InputEvent &event)
void processMailDelete(Net::MessageIn &msg)
void processRequestItems(Net::MessageIn &msg)
void processAddItemResult(Net::MessageIn &msg)
void processMailIcon(Net::MessageIn &msg)
void processSendResult(Net::MessageIn &msg)
void processReadMail(Net::MessageIn &msg)
void processCheckNameResult(Net::MessageIn &msg)
void processMailListPage(Net::MessageIn &msg)
void processRequestMoney(Net::MessageIn &msg)
void processRemoveItemResult(Net::MessageIn &msg)
std::queue< MailQueue * > mMailQueue
void processOpenNewMailWindow(Net::MessageIn &msg)
void notify(const unsigned int message)
@ MAIL_SEND_RECEIVER_ERROR
@ MAIL_ATTACH_ITEM_NO_SPACE
@ MAIL_ATTACH_ITEM_WEIGHT_ERROR
@ MAIL_NAME_VALIDATION_ERROR
@ MAIL_ATTACH_ITEM_FATAL_ERROR
@ MAIL_GET_MONEY_LIMIT_ERROR
@ MAIL_GET_ATTACH_FULL_ERROR
@ MAIL_ATTACH_ITEM_NOT_TRADEABLE
@ MAIL_ATTACH_ITEM_UNKNOWN_ERROR
Inventory * getInventory()
std::string timeToStr(const uint32_t time)
void add(const uint16_t index, const uint16_t value)
MailMessageType::Type type