diff --git a/src/game/Player.cpp b/src/game/Player.cpp index ed9e795cf..3e6900450 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -805,6 +805,22 @@ bool Player::StoreNewItemInBestSlots(uint32 titem_id, uint32 titem_amount) return false; } +// helper function, mainly for script side, but can be used for simple task in mangos also. +Item* Player::StoreNewItemInInventorySlot(uint32 itemEntry, uint32 amount) +{ + ItemPosCountVec vDest; + + uint8 msg = CanStoreNewItem(INVENTORY_SLOT_BAG_0, NULL_SLOT, vDest, itemEntry, amount); + + if (msg == EQUIP_ERR_OK) + { + if (Item* pItem = StoreNewItem(vDest, itemEntry, true, Item::GenerateItemRandomPropertyId(itemEntry))) + return pItem; + } + + return NULL; +} + void Player::SendMirrorTimer(MirrorTimerType Type, uint32 MaxValue, uint32 CurrentValue, int32 Regen) { if (int(MaxValue) == DISABLED_MIRROR_TIMER) diff --git a/src/game/Player.h b/src/game/Player.h index 849df7a49..f0edc3901 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1243,6 +1243,8 @@ class MANGOS_DLL_SPEC Player : public Unit Item* EquipItem( uint16 pos, Item *pItem, bool update ); void AutoUnequipOffhandIfNeed(); bool StoreNewItemInBestSlots(uint32 item_id, uint32 item_count); + Item* StoreNewItemInInventorySlot(uint32 itemEntry, uint32 amount); + void AutoStoreLoot(uint8 bag, uint8 slot, uint32 loot_id, LootStore const& store, bool broadcast = false); void AutoStoreLoot(uint32 loot_id, LootStore const& store, bool broadcast = false) { AutoStoreLoot(NULL_BAG,NULL_SLOT,loot_id,store,broadcast); } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 7868abfa6..849471d9d 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9213" + #define REVISION_NR "9214" #endif // __REVISION_NR_H__