AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
Guild::PlayerMoveItemData Class Reference
Inheritance diagram for Guild::PlayerMoveItemData:
Guild::MoveItemData

Public Member Functions

 PlayerMoveItemData (Guild *guild, Player *player, uint8 container, uint8 slotId)
 
bool IsBank () const override
 
bool InitItem () override
 
void RemoveItem (CharacterDatabaseTransaction trans, MoveItemData *pOther, uint32 splitedAmount=0) override
 
ItemStoreItem (CharacterDatabaseTransaction trans, Item *pItem) override
 
void LogBankEvent (CharacterDatabaseTransaction trans, MoveItemData *pFrom, uint32 count) const override
 
- Public Member Functions inherited from Guild::MoveItemData
 MoveItemData (Guild *guild, Player *player, uint8 container, uint8 slotId)
 
virtual ~MoveItemData ()
 
virtual bool IsBank () const =0
 
virtual bool InitItem ()=0
 
virtual bool CheckItem (uint32 &splitedAmount)
 
virtual bool HasStoreRights (MoveItemData *) const
 
virtual bool HasWithdrawRights (MoveItemData *) const
 
bool CanStore (Item *pItem, bool swap, bool sendError)
 
bool CloneItem (uint32 count)
 
virtual void RemoveItem (CharacterDatabaseTransaction trans, MoveItemData *pOther, uint32 splitedAmount=0)=0
 
virtual ItemStoreItem (CharacterDatabaseTransaction trans, Item *pItem)=0
 
virtual void LogBankEvent (CharacterDatabaseTransaction trans, MoveItemData *pFrom, uint32 count) const =0
 
virtual void LogAction (MoveItemData *pFrom) const
 
void CopySlots (SlotIds &ids) const
 
ItemGetItem (bool isCloned=false) const
 
uint8 GetContainer () const
 
uint8 GetSlotId () const
 

Protected Member Functions

InventoryResult CanStore (Item *pItem, bool swap) override
 
virtual InventoryResult CanStore (Item *pItem, bool swap)=0
 

Additional Inherited Members

- Protected Attributes inherited from Guild::MoveItemData
Guildm_pGuild
 
Playerm_pPlayer
 
uint8 m_container
 
uint8 m_slotId
 
Itemm_pItem
 
Itemm_pClonedItem
 
ItemPosCountVec m_vec
 

Detailed Description

Constructor & Destructor Documentation

◆ PlayerMoveItemData()

Guild::PlayerMoveItemData::PlayerMoveItemData ( Guild guild,
Player player,
uint8  container,
uint8  slotId 
)
inline
640 :
641 MoveItemData(guild, player, container, slotId) { }
MoveItemData(Guild *guild, Player *player, uint8 container, uint8 slotId)
Definition: Guild.h:593

Member Function Documentation

◆ CanStore()

InventoryResult Guild::PlayerMoveItemData::CanStore ( Item pItem,
bool  swap 
)
inlineoverrideprotectedvirtual

Implements Guild::MoveItemData.

815{
816 return m_pPlayer->CanStoreItem(m_container, m_slotId, m_vec, pItem, swap);
817}
InventoryResult CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *pItem, bool swap=false) const
Definition: Player.h:1278
ItemPosCountVec m_vec
Definition: Guild.h:634
Player * m_pPlayer
Definition: Guild.h:629
uint8 m_slotId
Definition: Guild.h:631
uint8 m_container
Definition: Guild.h:630

◆ InitItem()

bool Guild::PlayerMoveItemData::InitItem ( )
overridevirtual

Implements Guild::MoveItemData.

762{
764 if (m_pItem)
765 {
766 // Anti-WPE protection. Do not move non-empty bags to bank.
767 if (m_pItem->IsNotEmptyBag())
768 {
770 m_pItem = nullptr;
771 }
772 // Bound items cannot be put into bank.
773 else if (!m_pItem->CanBeTraded())
774 {
776 m_pItem = nullptr;
777 }
778 }
779 return (m_pItem != nullptr);
780}
@ EQUIP_ERR_CAN_ONLY_DO_WITH_EMPTY_BAGS
Definition: Item.h:78
@ EQUIP_ERR_ITEMS_CANT_BE_SWAPPED
Definition: Item.h:68
bool CanBeTraded(bool mail=false, bool trade=false) const
Definition: Item.cpp:794
bool IsNotEmptyBag() const
Definition: Item.cpp:311
Item * GetItemByPos(uint16 pos) const
Definition: PlayerStorage.cpp:441
void SendEquipError(InventoryResult msg, Item *pItem, Item *pItem2=nullptr, uint32 itemid=0)
Definition: PlayerStorage.cpp:4021
Item * m_pItem
Definition: Guild.h:632

References EQUIP_ERR_CAN_ONLY_DO_WITH_EMPTY_BAGS, and EQUIP_ERR_ITEMS_CANT_BE_SWAPPED.

◆ IsBank()

bool Guild::PlayerMoveItemData::IsBank ( ) const
inlineoverridevirtual

Implements Guild::MoveItemData.

643{ return false; }

◆ LogBankEvent()

void Guild::PlayerMoveItemData::LogBankEvent ( CharacterDatabaseTransaction  trans,
MoveItemData pFrom,
uint32  count 
) const
overridevirtual

Implements Guild::MoveItemData.

807{
808 ASSERT(pFrom);
809 // Bank -> Char
810 m_pGuild->_LogBankEvent(trans, GUILD_BANK_LOG_WITHDRAW_ITEM, pFrom->GetContainer(), m_pPlayer->GetGUID(),
811 pFrom->GetItem()->GetEntry(), count);
812}
#define ASSERT
Definition: Errors.h:68
@ GUILD_BANK_LOG_WITHDRAW_ITEM
Definition: Guild.h:199
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:109
uint32 GetEntry() const
Definition: ObjectGuid.h:144
void _LogBankEvent(CharacterDatabaseTransaction trans, GuildBankEventLogTypes eventType, uint8 tabId, ObjectGuid playerGuid, uint32 itemOrMoney, uint16 itemStackCount=0, uint8 destTabId=0)
Definition: Guild.cpp:2617
Guild * m_pGuild
Definition: Guild.h:628

References ASSERT, Guild::MoveItemData::GetContainer(), Object::GetEntry(), Guild::MoveItemData::GetItem(), and GUILD_BANK_LOG_WITHDRAW_ITEM.

◆ RemoveItem()

void Guild::PlayerMoveItemData::RemoveItem ( CharacterDatabaseTransaction  trans,
MoveItemData pOther,
uint32  splitedAmount = 0 
)
overridevirtual

Implements Guild::MoveItemData.

783{
784 if (splitedAmount)
785 {
786 m_pItem->SetCount(m_pItem->GetCount() - splitedAmount);
789 }
790 else
791 {
794 m_pItem = nullptr;
795 }
796}
@ ITEM_CHANGED
Definition: Item.h:210
static void DeleteFromInventoryDB(CharacterDatabaseTransaction trans, ObjectGuid::LowType itemGuid)
Definition: Item.cpp:532
void SetState(ItemUpdateState state, Player *forplayer=nullptr)
Definition: Item.cpp:714
void SetCount(uint32 value)
Definition: Item.h:273
uint32 GetCount() const
Definition: Item.h:272
void SaveInventoryAndGoldToDB(CharacterDatabaseTransaction trans)
Definition: PlayerStorage.cpp:7120
void MoveItemFromInventory(uint8 bag, uint8 slot, bool update)
Definition: PlayerStorage.cpp:2978

References ITEM_CHANGED.

◆ StoreItem()

Item * Guild::PlayerMoveItemData::StoreItem ( CharacterDatabaseTransaction  trans,
Item pItem 
)
overridevirtual

Implements Guild::MoveItemData.

799{
800 ASSERT(pItem);
801 m_pPlayer->MoveItemToInventory(m_vec, pItem, true);
803 return pItem;
804}
void MoveItemToInventory(ItemPosCountVec const &dest, Item *pItem, bool update, bool in_characterInventoryDB=false)
Definition: PlayerStorage.cpp:2998

References ASSERT.