TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Guild::PlayerMoveItemData Class Reference

Public Member Functions

 PlayerMoveItemData (Guild *guild, Player *player, uint8 container, uint8 slotId)
 
bool IsBank () const override
 
bool InitItem () override
 
void RemoveItem (SQLTransaction &trans, MoveItemData *pOther, uint32 splitedAmount=0) override
 
ItemStoreItem (SQLTransaction &trans, Item *pItem) override
 
void LogBankEvent (SQLTransaction &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 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 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
 

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
 

Constructor & Destructor Documentation

Guild::PlayerMoveItemData::PlayerMoveItemData ( Guild guild,
Player player,
uint8  container,
uint8  slotId 
)
inline
710  :
711  MoveItemData(guild, player, container, slotId) { }
MoveItemData(Guild *guild, Player *player, uint8 container, uint8 slotId)
Definition: Guild.h:663

Member Function Documentation

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 }
Player * m_pPlayer
Definition: Guild.h:699
uint8 m_slotId
Definition: Guild.h:701
ItemPosCountVec m_vec
Definition: Guild.h:704
uint8 m_container
Definition: Guild.h:700
bool Guild::PlayerMoveItemData::InitItem ( )
overridevirtual

Implements Guild::MoveItemData.

762 {
763  m_pItem = m_pPlayer->GetItemByPos(m_container, m_slotId);
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 = NULL;
771  }
772  // Bound items cannot be put into bank.
773  else if (!m_pItem->CanBeTraded())
774  {
775  m_pPlayer->SendEquipError(EQUIP_ERR_CANT_SWAP, m_pItem);
776  m_pItem = NULL;
777  }
778  }
779  return (m_pItem != NULL);
780 }
Definition: Item.h:69
arena_t NULL
Definition: jemalloc_internal.h:624
bool CanBeTraded(bool mail=false, bool trade=false) const
Definition: Item.cpp:769
bool IsNotEmptyBag() const
Definition: Item.cpp:286
Item * m_pItem
Definition: Guild.h:702
Player * m_pPlayer
Definition: Guild.h:699
Definition: Item.h:79
uint8 m_slotId
Definition: Guild.h:701
uint8 m_container
Definition: Guild.h:700
bool Guild::PlayerMoveItemData::IsBank ( ) const
inlineoverridevirtual

Implements Guild::MoveItemData.

713 { return false; }
void Guild::PlayerMoveItemData::LogBankEvent ( SQLTransaction 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().GetCounter(),
811  pFrom->GetItem()->GetEntry(), count);
812 }
Definition: Guild.h:192
Player * m_pPlayer
Definition: Guild.h:699
#define ASSERT
Definition: Errors.h:55
void _LogBankEvent(SQLTransaction &trans, GuildBankEventLogTypes eventType, uint8 tabId, ObjectGuid::LowType playerGuid, uint64 itemOrMoney, uint16 itemStackCount=0, uint8 destTabId=0)
Definition: Guild.cpp:3023
Guild * m_pGuild
Definition: Guild.h:698

+ Here is the call graph for this function:

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

Implements Guild::MoveItemData.

783 {
784  if (splitedAmount)
785  {
786  m_pItem->SetCount(m_pItem->GetCount() - splitedAmount);
788  m_pPlayer->SaveInventoryAndGoldToDB(trans);
789  }
790  else
791  {
792  m_pPlayer->MoveItemFromInventory(m_container, m_slotId, true);
794  m_pItem = NULL;
795  }
796 }
uint32 GetCount() const
Definition: Item.h:322
void SetState(ItemUpdateState state, Player *forplayer=NULL)
Definition: Item.cpp:686
static void DeleteFromInventoryDB(SQLTransaction &trans, ObjectGuid::LowType itemGuid)
Definition: Item.cpp:535
arena_t NULL
Definition: jemalloc_internal.h:624
void SetCount(uint32 value)
Definition: Item.cpp:794
Item * m_pItem
Definition: Guild.h:702
Player * m_pPlayer
Definition: Guild.h:699
uint8 m_slotId
Definition: Guild.h:701
Definition: Item.h:217
uint8 m_container
Definition: Guild.h:700
Item * Guild::PlayerMoveItemData::StoreItem ( SQLTransaction trans,
Item pItem 
)
overridevirtual

Implements Guild::MoveItemData.

799 {
800  ASSERT(pItem);
801  m_pPlayer->MoveItemToInventory(m_vec, pItem, true);
802  m_pPlayer->SaveInventoryAndGoldToDB(trans);
803  return pItem;
804 }
Player * m_pPlayer
Definition: Guild.h:699
ItemPosCountVec m_vec
Definition: Guild.h:704
#define ASSERT
Definition: Errors.h:55

The documentation for this class was generated from the following files: