TrinityCore
Loading...
Searching...
No Matches
TradeData Class Reference

#include <TradeData.h>

Public Member Functions

 TradeData (Player *player, Player *trader)
 
Player * GetTrader () const
 
TradeData * GetTraderData () const
 
Item * GetItem (TradeSlots slot) const
 
bool HasItem (ObjectGuid itemGuid) const
 
TradeSlots GetTradeSlotForItem (ObjectGuid itemGuid) const
 
void SetItem (TradeSlots slot, Item *item, bool update=false)
 
uint32 GetSpell () const
 
void SetSpell (uint32 spell_id, Item *castItem=nullptr)
 
Item * GetSpellCastItem () const
 
bool HasSpellCastItem () const
 
uint32 GetMoney () const
 
void SetMoney (uint32 money)
 
bool IsAccepted () const
 
void SetAccepted (bool state, bool forTrader=false)
 
bool IsInAcceptProcess () const
 
void SetInAcceptProcess (bool state)
 

Private Member Functions

void Update (bool for_trader=true) const
 

Private Attributes

Player * _player
 
Player * _trader
 
bool _accepted
 
bool _acceptProccess
 
uint32 _money
 
uint32 _spell
 
ObjectGuid _spellCastItem
 
ObjectGuid _items [TRADE_SLOT_COUNT]
 

Detailed Description

Definition at line 34 of file TradeData.h.

Constructor & Destructor Documentation

◆ TradeData()

TradeData::TradeData ( Player *  player,
Player *  trader 
)
inline

Definition at line 37 of file TradeData.h.

Member Function Documentation

◆ GetItem()

◆ GetMoney()

uint32 TradeData::GetMoney ( ) const
inline

◆ GetSpell()

uint32 TradeData::GetSpell ( ) const
inline

◆ GetSpellCastItem()

Item * TradeData::GetSpellCastItem ( ) const

◆ GetTrader()

◆ GetTraderData()

TradeData * TradeData::GetTraderData ( ) const

Definition at line 23 of file TradeData.cpp.

References _trader, and Player::GetTradeData().

Referenced by WorldSession::SendUpdateTrade(), SetItem(), SetMoney(), and SetSpell().

◆ GetTradeSlotForItem()

TradeSlots TradeData::GetTradeSlotForItem ( ObjectGuid  itemGuid) const

Definition at line 42 of file TradeData.cpp.

References _items, TRADE_SLOT_COUNT, and TRADE_SLOT_INVALID.

◆ HasItem()

bool TradeData::HasItem ( ObjectGuid  itemGuid) const

Definition at line 33 of file TradeData.cpp.

References _items, and TRADE_SLOT_COUNT.

Referenced by WorldSession::HandleSetTradeItemOpcode().

◆ HasSpellCastItem()

bool TradeData::HasSpellCastItem ( ) const
inline

Definition at line 53 of file TradeData.h.

Referenced by WorldSession::HandleAcceptTradeOpcode().

◆ IsAccepted()

bool TradeData::IsAccepted ( ) const
inline

Definition at line 58 of file TradeData.h.

Referenced by WorldSession::HandleAcceptTradeOpcode().

◆ IsInAcceptProcess()

bool TradeData::IsInAcceptProcess ( ) const
inline

Definition at line 61 of file TradeData.h.

◆ SetAccepted()

◆ SetInAcceptProcess()

void TradeData::SetInAcceptProcess ( bool  state)
inline

Definition at line 62 of file TradeData.h.

Referenced by clearAcceptTradeMode(), and setAcceptTradeMode().

◆ SetItem()

void TradeData::SetItem ( TradeSlots  slot,
Item *  item,
bool  update = false 
)

◆ SetMoney()

◆ SetSpell()

void TradeData::SetSpell ( uint32  spell_id,
Item *  castItem = nullptr 
)

◆ Update()

void TradeData::Update ( bool  for_trader = true) const
private

Definition at line 119 of file TradeData.cpp.

References _player, _trader, Player::GetSession(), and WorldSession::SendUpdateTrade().

Referenced by SetItem(), SetMoney(), and SetSpell().

Member Data Documentation

◆ _accepted

bool TradeData::_accepted
private

Definition at line 70 of file TradeData.h.

Referenced by SetAccepted().

◆ _acceptProccess

bool TradeData::_acceptProccess
private

Definition at line 71 of file TradeData.h.

◆ _items

ObjectGuid TradeData::_items[TRADE_SLOT_COUNT]
private

Definition at line 78 of file TradeData.h.

Referenced by GetItem(), GetTradeSlotForItem(), HasItem(), and SetItem().

◆ _money

uint32 TradeData::_money
private

Definition at line 73 of file TradeData.h.

Referenced by SetMoney().

◆ _player

Player* TradeData::_player
private

Definition at line 67 of file TradeData.h.

Referenced by GetItem(), GetSpellCastItem(), SetAccepted(), SetMoney(), and Update().

◆ _spell

uint32 TradeData::_spell
private

Definition at line 75 of file TradeData.h.

Referenced by SetSpell().

◆ _spellCastItem

ObjectGuid TradeData::_spellCastItem
private

Definition at line 76 of file TradeData.h.

Referenced by GetSpellCastItem(), and SetSpell().

◆ _trader

Player* TradeData::_trader
private

Definition at line 68 of file TradeData.h.

Referenced by GetTraderData(), SetAccepted(), and Update().


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