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

Public Member Functions

bool IsMoneyEvent () const
 
 BankEventLogEntry (ObjectGuid::LowType guildId, uint32 guid, GuildBankEventLogTypes eventType, uint8 tabId, ObjectGuid::LowType playerGuid, uint64 itemOrMoney, uint16 itemStackCount, uint8 destTabId)
 
 BankEventLogEntry (ObjectGuid::LowType guildId, uint32 guid, time_t timestamp, uint8 tabId, GuildBankEventLogTypes eventType, ObjectGuid::LowType playerGuid, uint64 itemOrMoney, uint16 itemStackCount, uint8 destTabId)
 
 ~BankEventLogEntry ()
 
void SaveToDB (SQLTransaction &trans) const override
 
void WritePacket (WorldPackets::Guild::GuildBankLogQueryResults &packet) const
 
- Public Member Functions inherited from Guild::LogEntry
 LogEntry (ObjectGuid::LowType guildId, uint32 guid)
 
 LogEntry (ObjectGuid::LowType guildId, uint32 guid, time_t timestamp)
 
virtual ~LogEntry ()
 
uint32 GetGUID () const
 
uint64 GetTimestamp () const
 

Static Public Member Functions

static bool IsMoneyEvent (GuildBankEventLogTypes eventType)
 

Private Attributes

GuildBankEventLogTypes m_eventType
 
uint8 m_bankTabId
 
ObjectGuid::LowType m_playerGuid
 
uint64 m_itemOrMoney
 
uint16 m_itemStackCount
 
uint8 m_destTabId
 

Additional Inherited Members

- Protected Attributes inherited from Guild::LogEntry
ObjectGuid::LowType m_guildId
 
uint32 m_guid
 
uint64 m_timestamp
 

Constructor & Destructor Documentation

Guild::BankEventLogEntry::BankEventLogEntry ( ObjectGuid::LowType  guildId,
uint32  guid,
GuildBankEventLogTypes  eventType,
uint8  tabId,
ObjectGuid::LowType  playerGuid,
uint64  itemOrMoney,
uint16  itemStackCount,
uint8  destTabId 
)
inline
490  :
491  LogEntry(guildId, guid), m_eventType(eventType), m_bankTabId(tabId), m_playerGuid(playerGuid),
492  m_itemOrMoney(itemOrMoney), m_itemStackCount(itemStackCount), m_destTabId(destTabId) { }
uint16 m_itemStackCount
Definition: Guild.h:508
GuildBankEventLogTypes m_eventType
Definition: Guild.h:504
LogEntry(ObjectGuid::LowType guildId, uint32 guid)
Definition: Guild.h:435
ObjectGuid::LowType m_playerGuid
Definition: Guild.h:506
uint64 m_itemOrMoney
Definition: Guild.h:507
uint8 m_destTabId
Definition: Guild.h:509
uint8 m_bankTabId
Definition: Guild.h:505
Guild::BankEventLogEntry::BankEventLogEntry ( ObjectGuid::LowType  guildId,
uint32  guid,
time_t  timestamp,
uint8  tabId,
GuildBankEventLogTypes  eventType,
ObjectGuid::LowType  playerGuid,
uint64  itemOrMoney,
uint16  itemStackCount,
uint8  destTabId 
)
inline
494  :
495  LogEntry(guildId, guid, timestamp), m_eventType(eventType), m_bankTabId(tabId), m_playerGuid(playerGuid),
496  m_itemOrMoney(itemOrMoney), m_itemStackCount(itemStackCount), m_destTabId(destTabId) { }
uint16 m_itemStackCount
Definition: Guild.h:508
GuildBankEventLogTypes m_eventType
Definition: Guild.h:504
LogEntry(ObjectGuid::LowType guildId, uint32 guid)
Definition: Guild.h:435
ObjectGuid::LowType m_playerGuid
Definition: Guild.h:506
uint64 m_itemOrMoney
Definition: Guild.h:507
uint8 m_destTabId
Definition: Guild.h:509
uint8 m_bankTabId
Definition: Guild.h:505
Guild::BankEventLogEntry::~BankEventLogEntry ( )
inline
498 { }

Member Function Documentation

static bool Guild::BankEventLogEntry::IsMoneyEvent ( GuildBankEventLogTypes  eventType)
inlinestatic
477  {
478  return
479  eventType == GUILD_BANK_LOG_DEPOSIT_MONEY ||
480  eventType == GUILD_BANK_LOG_WITHDRAW_MONEY ||
481  eventType == GUILD_BANK_LOG_REPAIR_MONEY ||
483  }
Definition: Guild.h:196
Definition: Guild.h:200
Definition: Guild.h:195
Definition: Guild.h:194
bool Guild::BankEventLogEntry::IsMoneyEvent ( ) const
inline
486  {
487  return IsMoneyEvent(m_eventType);
488  }
GuildBankEventLogTypes m_eventType
Definition: Guild.h:504
bool IsMoneyEvent() const
Definition: Guild.h:485

+ Here is the caller graph for this function:

void Guild::BankEventLogEntry::SaveToDB ( SQLTransaction trans) const
overridevirtual

Implements Guild::LogEntry.

154 {
155  uint8 index = 0;
156 
158  stmt->setUInt64( index, m_guildId);
159  stmt->setUInt32(++index, m_guid);
160  stmt->setUInt8 (++index, m_bankTabId);
161  CharacterDatabase.ExecuteOrAppend(trans, stmt);
162 
163  index = 0;
165  stmt->setUInt64( index, m_guildId);
166  stmt->setUInt32(++index, m_guid);
167  stmt->setUInt8 (++index, m_bankTabId);
168  stmt->setUInt8 (++index, uint8(m_eventType));
169  stmt->setUInt64(++index, m_playerGuid);
170  stmt->setUInt32(++index, m_itemOrMoney);
171  stmt->setUInt16(++index, m_itemStackCount);
172  stmt->setUInt8 (++index, m_destTabId);
173  stmt->setUInt64(++index, m_timestamp);
174  CharacterDatabase.ExecuteOrAppend(trans, stmt);
175 }
uint16 m_itemStackCount
Definition: Guild.h:508
Definition: CharacterDatabase.h:177
void ExecuteOrAppend(SQLTransaction &trans, PreparedStatement *stmt)
Definition: DatabaseWorkerPool.h:236
uint32 m_guid
Definition: Guild.h:446
GuildBankEventLogTypes m_eventType
Definition: Guild.h:504
void setUInt8(const uint8 index, const uint8 value)
Definition: PreparedStatement.cpp:97
Definition: CharacterDatabase.h:178
Definition: PreparedStatement.h:74
void setUInt16(const uint8 index, const uint16 value)
Definition: PreparedStatement.cpp:106
ObjectGuid::LowType m_playerGuid
Definition: Guild.h:506
uint64 m_itemOrMoney
Definition: Guild.h:507
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
uint8_t uint8
Definition: g3dmath.h:164
ObjectGuid::LowType m_guildId
Definition: Guild.h:445
uint8 m_destTabId
Definition: Guild.h:509
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
uint8_t uint8
Definition: Define.h:152
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
uint64 m_timestamp
Definition: Guild.h:447
uint8 m_bankTabId
Definition: Guild.h:505

+ Here is the call graph for this function:

void Guild::BankEventLogEntry::WritePacket ( WorldPackets::Guild::GuildBankLogQueryResults packet) const
178 {
179  ObjectGuid logGuid = ObjectGuid::Create<HighGuid::Player>(m_playerGuid);
180 
183 
185 
186  bool hasStack = (hasItem && m_itemStackCount > 1) || itemMoved;
187 
189  bankLogEntry.PlayerGUID = logGuid;
190  bankLogEntry.TimeOffset = int32(time(NULL) - m_timestamp);
191  bankLogEntry.EntryType = int8(m_eventType);
192 
193  if (hasStack)
194  bankLogEntry.Count = int32(m_itemStackCount);
195 
196  if (IsMoneyEvent())
197  bankLogEntry.Money = uint64(m_itemOrMoney);
198 
199  if (hasItem)
200  bankLogEntry.ItemID = int32(m_itemOrMoney);
201 
202  if (itemMoved)
203  bankLogEntry.OtherTab = int8(m_destTabId);
204 
205  packet.Entry.push_back(bankLogEntry);
206 }
Optional< int8 > OtherTab
Definition: GuildPackets.h:863
int8 EntryType
Definition: GuildPackets.h:859
Definition: Guild.h:192
uint16 m_itemStackCount
Definition: Guild.h:508
Definition: Guild.h:193
GuildBankEventLogTypes m_eventType
Definition: Guild.h:504
int8_t int8
Definition: g3dmath.h:163
arena_t NULL
Definition: jemalloc_internal.h:624
uint64_t uint64
Definition: g3dmath.h:170
Optional< int32 > ItemID
Definition: GuildPackets.h:861
Definition: Guild.h:191
bool IsMoneyEvent() const
Definition: Guild.h:485
Definition: GuildPackets.h:855
ObjectGuid::LowType m_playerGuid
Definition: Guild.h:506
uint64 m_itemOrMoney
Definition: Guild.h:507
Optional< uint64 > Money
Definition: GuildPackets.h:860
std::vector< GuildBankLogEntry > Entry
Definition: GuildPackets.h:874
Definition: Guild.h:197
uint8 m_destTabId
Definition: Guild.h:509
ObjectGuid PlayerGUID
Definition: GuildPackets.h:857
uint32 TimeOffset
Definition: GuildPackets.h:858
int32_t int32
Definition: g3dmath.h:167
uint64 m_timestamp
Definition: Guild.h:447
Definition: ObjectGuid.h:189
Optional< int32 > Count
Definition: GuildPackets.h:862

+ Here is the caller graph for this function:

Member Data Documentation

uint8 Guild::BankEventLogEntry::m_bankTabId
private
uint8 Guild::BankEventLogEntry::m_destTabId
private
GuildBankEventLogTypes Guild::BankEventLogEntry::m_eventType
private
uint64 Guild::BankEventLogEntry::m_itemOrMoney
private
uint16 Guild::BankEventLogEntry::m_itemStackCount
private
ObjectGuid::LowType Guild::BankEventLogEntry::m_playerGuid
private

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