Jump to content

Mail Item If No Room


Guest Peec
 Share

Recommended Posts

I just set up mangos again.

I have added alot of items in `playercreateinfo_item`...

Currently mangos will not add more than the first bag.

This patch sends the items that could not be added in mailbox.

I dont know if this is offical or not, but it is very handy.

Btw:

msg = CanStoreNewItem( NULL_BAG, NULL_SLOT, sDest, titem_id, titem_amount );

was an uneeded change.

Index: src/game/Player.cpp
===================================================================
--- src/game/Player.cpp        (revision 6572)
+++ src/game/Player.cpp        (working copy)
@@ -637,15 +637,29 @@
                // attempt store
                ItemPosCountVec sDest;
                // store in main bag to simplify second pass (special bags can be not equipped yet at this moment)
-                msg = CanStoreNewItem( INVENTORY_SLOT_BAG_0, NULL_SLOT, sDest, titem_id, titem_amount );
+                msg = CanStoreNewItem( NULL_BAG, NULL_SLOT, sDest, titem_id, titem_amount );
                if( msg == EQUIP_ERR_OK ) 
                {
                        StoreNewItem( sDest, titem_id, true, Item::GenerateItemRandomPropertyId(titem_id) );
                        continue;                                                                             // stored, to next
                }

+                // Peec edit..
+                // Yah.. Send the item in mail to the player..
+                
+                MailItemsInfo mi;                                                                     // item list preparing
+
+                if(Item* item = Item::CreateItem(item_id_itr->item_id,item_id_itr->item_amount,this))
+                {
+                        item->SaveToDB();                                             // save for prevent lost at next mail load, if send fail then item will deleted
+                        mi.AddItem(item->GetGUIDLow(), item->GetEntry(), item);
+                }
+                std::string subject = GetSession()->GetMangosString(LANG_NOT_EQUIPPED_ITEM);
+                WorldSession::SendMailTo(this, MAIL_NORMAL, MAIL_STATIONERY_NORMAL, GetGUIDLow(), GetGUIDLow(), subject, 0, &mi, 0, 0, NOT_READ);
+                // End peec EDIT
+
                // item can't be added
-                sLog.outError("STORAGE: Can't equip or store initial item %u for race %u class %u , error msg = %u",titem_id,race,class_,msg);
+                sLog.outError("STORAGE: Can't equip or store initial item %u for race %u class %u , error msg = %u. However, the item was sent to player in-mail.",titem_id,race,class_,msg);
        }

        // bags and main-hand weapon must equipped at this moment

Link to comment
Share on other sites

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use