mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 19:37:02 +00:00
[9214] Add helper function StoreNewItemInInventorySlot
Mainly function for script side store new item, but may also be used to simplify similar task in code. Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
parent
64ba6c5714
commit
cc5ed7a48b
3 changed files with 19 additions and 1 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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); }
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "9213"
|
||||
#define REVISION_NR "9214"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue