Advertisement
jackpoz

mail insertion queue

Oct 15th, 2011
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 7.29 KB | None | 0 0
  1. Index: sql/character_updates/4636_mail_instert_queue.sql
  2. ===================================================================
  3. --- sql/character_updates/4636_mail_instert_queue.sql   (revision 0)
  4. +++ sql/character_updates/4636_mail_instert_queue.sql   (working copy)
  5. @@ -0,0 +1,12 @@
  6. +ALTER TABLE `mailbox_insert_queue` ADD COLUMN `item_id2` INT(30) DEFAULT '0' NOT NULL AFTER `item_stack`, ADD COLUMN `item_stack2` INT(30) DEFAULT '0' NOT NULL AFTER `item_id2`;
  7. +ALTER TABLE `mailbox_insert_queue` ADD COLUMN `item_id3` INT(30) DEFAULT '0' NOT NULL AFTER `item_stack2`, ADD COLUMN `item_stack3` INT(30) DEFAULT '0' NOT NULL AFTER `item_id3`;
  8. +ALTER TABLE `mailbox_insert_queue` ADD COLUMN `item_id4` INT(30) DEFAULT '0' NOT NULL AFTER `item_stack3`, ADD COLUMN `item_stack4` INT(30) DEFAULT '0' NOT NULL AFTER `item_id4`;
  9. +ALTER TABLE `mailbox_insert_queue` ADD COLUMN `item_id5` INT(30) DEFAULT '0' NOT NULL AFTER `item_stack4`, ADD COLUMN `item_stack5` INT(30) DEFAULT '0' NOT NULL AFTER `item_id5`;
  10. +ALTER TABLE `mailbox_insert_queue` ADD COLUMN `item_id6` INT(30) DEFAULT '0' NOT NULL AFTER `item_stack5`, ADD COLUMN `item_stack6` INT(30) DEFAULT '0' NOT NULL AFTER `item_id6`;
  11. +ALTER TABLE `mailbox_insert_queue` ADD COLUMN `item_id7` INT(30) DEFAULT '0' NOT NULL AFTER `item_stack6`, ADD COLUMN `item_stack7` INT(30) DEFAULT '0' NOT NULL AFTER `item_id7`;
  12. +ALTER TABLE `mailbox_insert_queue` ADD COLUMN `item_id8` INT(30) DEFAULT '0' NOT NULL AFTER `item_stack7`, ADD COLUMN `item_stack8` INT(30) DEFAULT '0' NOT NULL AFTER `item_id8`;
  13. +ALTER TABLE `mailbox_insert_queue` ADD COLUMN `item_id9` INT(30) DEFAULT '0' NOT NULL AFTER `item_stack8`, ADD COLUMN `item_stack9` INT(30) DEFAULT '0' NOT NULL AFTER `item_id9`;
  14. +ALTER TABLE `mailbox_insert_queue` ADD COLUMN `item_id10` INT(30) DEFAULT '0' NOT NULL AFTER `item_stack9`, ADD COLUMN `item_stack10` INT(30) DEFAULT '0' NOT NULL AFTER `item_id10`;
  15. +ALTER TABLE `mailbox_insert_queue` ADD COLUMN `item_id11` INT(30) DEFAULT '0' NOT NULL AFTER `item_stack10`, ADD COLUMN `item_stack11` INT(30) DEFAULT '0' NOT NULL AFTER `item_id11`;
  16. +ALTER TABLE `mailbox_insert_queue` ADD COLUMN `item_id12` INT(30) DEFAULT '0' NOT NULL AFTER `item_stack11`, ADD COLUMN `item_stack12` INT(30) DEFAULT '0' NOT NULL AFTER `item_id12`;
  17. +UPDATE `arcemu_db_version` SET `LastUpdate` = '4636';
  18. \ No newline at end of file
  19. Index: src/arcemu-world/MailSystem.cpp
  20. ===================================================================
  21. --- src/arcemu-world/MailSystem.cpp (revision 4634)
  22. +++ src/arcemu-world/MailSystem.cpp (working copy)
  23. @@ -258,9 +258,8 @@
  24.     recv_data >> msg.subject >> msg.body >> msg.stationery;
  25.     recv_data >> unk2 >> itemcount;
  26.  
  27. -   if(itemcount > 12 || msg.body.find("%") != string::npos || msg.subject.find("%") != string::npos)
  28. +   if(itemcount > MAIL_MAX_ITEM_SLOT || msg.body.find("%") != string::npos || msg.subject.find("%") != string::npos)
  29.     {
  30. -       //SystemMessage("Sorry, Ascent does not support sending multiple items at this time. (don't want to lose your item do you) Remove some items, and try again.");
  31.         SendMailError(MAIL_ERR_INTERNAL_ERROR);
  32.         return;
  33.     }
  34. @@ -835,7 +834,7 @@
  35.  }
  36.  
  37.  void MailSystem::SendAutomatedMessage(uint32 type, uint64 sender, uint64 receiver, string subject, string body,
  38. -                                      uint32 money, uint32 cod, uint64 item_guid, uint32 stationery, uint32 deliverdelay)
  39. +                                      uint32 money, uint32 cod, vector<uint64> &item_guids, uint32 stationery, uint32 deliverdelay)
  40.  {
  41.     // This is for sending automated messages, for example from an auction house.
  42.     MailMessage msg;
  43. @@ -846,8 +845,8 @@
  44.     msg.body = body;
  45.     msg.money = money;
  46.     msg.cod = cod;
  47. -   if(Arcemu::Util::GUID_LOPART(item_guid) != 0)
  48. -       msg.items.push_back(Arcemu::Util::GUID_LOPART(item_guid));
  49. +   for(vector<uint64>::iterator itr = item_guids.begin(); itr != item_guids.end(); ++itr)
  50. +       msg.items.push_back(Arcemu::Util::GUID_LOPART(*itr));
  51.  
  52.     msg.stationery = stationery;
  53.     msg.delivery_time = (uint32)UNIXTIME + deliverdelay;
  54. Index: src/arcemu-world/MailSystem.h
  55. ===================================================================
  56. --- src/arcemu-world/MailSystem.h   (revision 4634)
  57. +++ src/arcemu-world/MailSystem.h   (working copy)
  58. @@ -74,6 +74,8 @@
  59.      MAIL_STATIONERY_CHR            = 65    // 34171, Winter
  60.  };
  61.  
  62. +#define MAIL_MAX_ITEM_SLOT 12
  63. +
  64.  struct MailMessage
  65.  {
  66.     uint32 message_id;
  67. @@ -134,8 +136,15 @@
  68.         void RemoveMessageIfDeleted(uint32 message_id, Player* plr);
  69.         void SaveMessageToSQL(MailMessage* message);
  70.         void SendAutomatedMessage(uint32 type, uint64 sender, uint64 receiver, string subject, string body, uint32 money,
  71. -                                 uint32 cod, uint64 item_guid, uint32 stationery, uint32 deliverdelay = 0);
  72. +                                 uint32 cod, vector<uint64> &item_guids, uint32 stationery, uint32 deliverdelay = 0);
  73.  
  74. +       //overload to keep backward compatibility (passing just 1 item guid instead of a vector)
  75. +       void SendAutomatedMessage(uint32 type, uint64 sender, uint64 receiver, string subject, string body, uint32 money,
  76. +                           uint32 cod, uint64 item_guid, uint32 stationery, uint32 deliverdelay = 0)
  77. +       {
  78. +           SendAutomatedMessage(type, sender, receiver, subject, body, money, cod, vector<uint64>(1, item_guid), stationery, deliverdelay);
  79. +       }
  80. +
  81.         ARCEMU_INLINE bool MailOption(uint32 flag)
  82.         {
  83.             return (config_flags & flag) ? true : false;
  84. Index: src/arcemu-world/Master.h
  85. ===================================================================
  86. --- src/arcemu-world/Master.h   (revision 4634)
  87. +++ src/arcemu-world/Master.h   (working copy)
  88. @@ -44,7 +44,7 @@
  89.  #endif
  90.  
  91.  #define REQUIRED_WORLD_DB_VERSION 4630
  92. -#define REQUIRED_CHAR_DB_VERSION 4633
  93. +#define REQUIRED_CHAR_DB_VERSION 4636
  94.  
  95.  #define DEFAULT_LOOP_TIME 0 /* 0 milliseconds - instant */
  96.  #define DEFAULT_LOG_LEVEL 0
  97. Index: src/arcemu-world/World.cpp
  98. ===================================================================
  99. --- src/arcemu-world/World.cpp  (revision 4634)
  100. +++ src/arcemu-world/World.cpp  (working copy)
  101. @@ -1801,7 +1801,6 @@
  102.  {
  103.     QueryResult* result;
  104.     Field* f;
  105. -   Item* pItem;
  106.     uint32 itemid;
  107.     uint32 stackcount;
  108.  
  109. @@ -1812,28 +1811,30 @@
  110.         do
  111.         {
  112.             f = result->Fetch();
  113. -           itemid = f[6].GetUInt32();
  114. -           stackcount = f[7].GetUInt32();
  115. +           vector<uint64> itemGuids;
  116.  
  117. -           if(itemid != 0)
  118. +           for(int itemSlot = 0; itemSlot < MAIL_MAX_ITEM_SLOT; itemSlot++)
  119.             {
  120. -               pItem = objmgr.CreateItem(itemid, NULL);
  121. +               itemid = f[6].GetUInt32();
  122. +               stackcount = f[7].GetUInt32();
  123. +
  124. +               if(itemid == 0)
  125. +                   break;
  126. +
  127. +               Item* pItem = objmgr.CreateItem(itemid, NULL);
  128.                 if(pItem != NULL)
  129.                 {
  130.                     pItem->SetStackCount(stackcount);
  131.                     pItem->SaveToDB(0, 0, true, NULL);
  132. +                   itemGuids.push_back(pItem->GetGUID());
  133. +                   pItem->DeleteMe();
  134.                 }
  135.             }
  136. -           else
  137. -               pItem = NULL;
  138.  
  139.             Log.Notice("MailboxQueue", "Sending message to %u (item: %u)...", f[1].GetUInt32(), itemid);
  140.             sMailSystem.SendAutomatedMessage(0, f[0].GetUInt64(), f[1].GetUInt64(), f[2].GetString(), f[3].GetString(), f[5].GetUInt32(),
  141. -                                            0, pItem ? pItem->GetGUID() : 0, f[4].GetUInt32());
  142. +                                            0, itemGuids, f[4].GetUInt32());
  143.  
  144. -           if(pItem != NULL)
  145. -               pItem->DeleteMe();
  146. -
  147.         }
  148.         while(result->NextRow());
  149.         delete result;
  150.  
  151.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement