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

Public Member Functions

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

Static Public Member Functions

static bool IsMoneyEvent (GuildBankEventLogTypes eventType)
 

Private Attributes

GuildBankEventLogTypes m_eventType
 
uint8 m_bankTabId
 
ObjectGuid m_playerGuid
 
uint32 m_itemOrMoney
 
uint16 m_itemStackCount
 
uint8 m_destTabId
 

Additional Inherited Members

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

Detailed Description

Constructor & Destructor Documentation

◆ BankEventLogEntry() [1/2]

Guild::BankEventLogEntry::BankEventLogEntry ( uint32  guildId,
ObjectGuid::LowType  guid,
GuildBankEventLogTypes  eventType,
uint8  tabId,
ObjectGuid  playerGuid,
uint32  itemOrMoney,
uint16  itemStackCount,
uint8  destTabId 
)
inline
459 :
460 LogEntry(guildId, guid), m_eventType(eventType), m_bankTabId(tabId), m_playerGuid(playerGuid),
461 m_itemOrMoney(itemOrMoney), m_itemStackCount(itemStackCount), m_destTabId(destTabId) { }
LogEntry(uint32 guildId, ObjectGuid::LowType guid)
Definition: Guild.cpp:175
GuildBankEventLogTypes m_eventType
Definition: Guild.h:473
ObjectGuid m_playerGuid
Definition: Guild.h:475
uint8 m_destTabId
Definition: Guild.h:478
uint32 m_itemOrMoney
Definition: Guild.h:476
uint8 m_bankTabId
Definition: Guild.h:474
uint16 m_itemStackCount
Definition: Guild.h:477

◆ BankEventLogEntry() [2/2]

Guild::BankEventLogEntry::BankEventLogEntry ( uint32  guildId,
ObjectGuid::LowType  guid,
time_t  timestamp,
uint8  tabId,
GuildBankEventLogTypes  eventType,
ObjectGuid  playerGuid,
uint32  itemOrMoney,
uint16  itemStackCount,
uint8  destTabId 
)
inline
463 :
464 LogEntry(guildId, guid, timestamp), m_eventType(eventType), m_bankTabId(tabId), m_playerGuid(playerGuid),
465 m_itemOrMoney(itemOrMoney), m_itemStackCount(itemStackCount), m_destTabId(destTabId) { }

◆ ~BankEventLogEntry()

Guild::BankEventLogEntry::~BankEventLogEntry ( )
inlineoverride
467{ }

Member Function Documentation

◆ IsMoneyEvent() [1/2]

bool Guild::BankEventLogEntry::IsMoneyEvent ( ) const
inline
455 {
457 }
bool IsMoneyEvent() const
Definition: Guild.h:454

References IsMoneyEvent(), and m_eventType.

Referenced by Guild::_LogBankEvent(), IsMoneyEvent(), and Guild::LoadBankEventLogFromDB().

◆ IsMoneyEvent() [2/2]

static bool Guild::BankEventLogEntry::IsMoneyEvent ( GuildBankEventLogTypes  eventType)
inlinestatic
447 {
448 return
449 eventType == GUILD_BANK_LOG_DEPOSIT_MONEY ||
450 eventType == GUILD_BANK_LOG_WITHDRAW_MONEY ||
451 eventType == GUILD_BANK_LOG_REPAIR_MONEY;
452 }
@ GUILD_BANK_LOG_DEPOSIT_MONEY
Definition: Guild.h:200
@ GUILD_BANK_LOG_WITHDRAW_MONEY
Definition: Guild.h:201
@ GUILD_BANK_LOG_REPAIR_MONEY
Definition: Guild.h:202

References GUILD_BANK_LOG_DEPOSIT_MONEY, GUILD_BANK_LOG_REPAIR_MONEY, and GUILD_BANK_LOG_WITHDRAW_MONEY.

◆ SaveToDB()

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

Implements Guild::LogEntry.

214{
215 uint8 index = 0;
216
218 stmt->SetData( index, m_guildId);
219 stmt->SetData(++index, m_guid);
220 stmt->SetData (++index, m_bankTabId);
221 CharacterDatabase.ExecuteOrAppend(trans, stmt);
222
223 index = 0;
224 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GUILD_BANK_EVENTLOG);
225 stmt->SetData( index, m_guildId);
226 stmt->SetData(++index, m_guid);
227 stmt->SetData (++index, m_bankTabId);
228 stmt->SetData (++index, uint8(m_eventType));
229 stmt->SetData(++index, m_playerGuid.GetCounter());
230 stmt->SetData(++index, m_itemOrMoney);
231 stmt->SetData(++index, m_itemStackCount);
232 stmt->SetData (++index, m_destTabId);
233 stmt->SetData(++index, m_timestamp);
234 CharacterDatabase.ExecuteOrAppend(trans, stmt);
235}
std::uint8_t uint8
Definition: Define.h:109
@ CHAR_DEL_GUILD_BANK_EVENTLOG
Definition: CharacterDatabase.h:160
@ CHAR_INS_GUILD_BANK_EVENTLOG
Definition: CharacterDatabase.h:159
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
Definition: PreparedStatement.h:157
Acore::Types::is_default< T > SetData(const uint8 index, T value)
Definition: PreparedStatement.h:77
LowType GetCounter() const
Definition: ObjectGuid.h:145
ObjectGuid::LowType m_guid
Definition: Guild.h:416
uint32 m_guildId
Definition: Guild.h:415
uint64 m_timestamp
Definition: Guild.h:417

References CHAR_DEL_GUILD_BANK_EVENTLOG, CHAR_INS_GUILD_BANK_EVENTLOG, CharacterDatabase, and PreparedStatementBase::SetData().

◆ WritePacket()

void Guild::BankEventLogEntry::WritePacket ( WorldPackets::Guild::GuildBankLogQueryResults packet) const
238{
240 bankLogEntry.PlayerGUID = ObjectGuid::Create<HighGuid::Player>(m_playerGuid.GetCounter());
241 bankLogEntry.TimeOffset = int32(GameTime::GetGameTime().count() - m_timestamp);
242 bankLogEntry.EntryType = int8(m_eventType);
243
244 switch (m_eventType)
245 {
248 bankLogEntry.ItemID = int32(m_itemOrMoney);
249 bankLogEntry.Count = int32(m_itemStackCount);
250 break;
253 bankLogEntry.ItemID = int32(m_itemOrMoney);
254 bankLogEntry.Count = int32(m_itemStackCount);
255 bankLogEntry.OtherTab = int8(m_destTabId);
256 break;
257 default:
258 bankLogEntry.Money = uint32(m_itemOrMoney);
259 }
260
261 packet.Entry.push_back(bankLogEntry);
262}
std::int32_t int32
Definition: Define.h:103
std::uint32_t uint32
Definition: Define.h:107
std::int8_t int8
Definition: Define.h:105
@ GUILD_BANK_LOG_MOVE_ITEM
Definition: Guild.h:199
@ GUILD_BANK_LOG_WITHDRAW_ITEM
Definition: Guild.h:198
@ GUILD_BANK_LOG_DEPOSIT_ITEM
Definition: Guild.h:197
@ GUILD_BANK_LOG_MOVE_ITEM2
Definition: Guild.h:203
Seconds GetGameTime()
Definition: GameTime.cpp:38
Definition: GuildPackets.h:535
uint32 TimeOffset
Definition: GuildPackets.h:537
int32 ItemID
Definition: GuildPackets.h:540
int8 OtherTab
Definition: GuildPackets.h:542
int8 EntryType
Definition: GuildPackets.h:538
uint32 Money
Definition: GuildPackets.h:539
ObjectGuid PlayerGUID
Definition: GuildPackets.h:536
int32 Count
Definition: GuildPackets.h:541
std::vector< GuildBankLogEntry > Entry
Definition: GuildPackets.h:553

References WorldPackets::Guild::GuildBankLogEntry::Count, WorldPackets::Guild::GuildBankLogQueryResults::Entry, WorldPackets::Guild::GuildBankLogEntry::EntryType, GameTime::GetGameTime(), GUILD_BANK_LOG_DEPOSIT_ITEM, GUILD_BANK_LOG_MOVE_ITEM, GUILD_BANK_LOG_MOVE_ITEM2, GUILD_BANK_LOG_WITHDRAW_ITEM, WorldPackets::Guild::GuildBankLogEntry::ItemID, WorldPackets::Guild::GuildBankLogEntry::Money, WorldPackets::Guild::GuildBankLogEntry::OtherTab, WorldPackets::Guild::GuildBankLogEntry::PlayerGUID, and WorldPackets::Guild::GuildBankLogEntry::TimeOffset.

Member Data Documentation

◆ m_bankTabId

uint8 Guild::BankEventLogEntry::m_bankTabId
private

◆ m_destTabId

uint8 Guild::BankEventLogEntry::m_destTabId
private

◆ m_eventType

GuildBankEventLogTypes Guild::BankEventLogEntry::m_eventType
private

Referenced by IsMoneyEvent().

◆ m_itemOrMoney

uint32 Guild::BankEventLogEntry::m_itemOrMoney
private

◆ m_itemStackCount

uint16 Guild::BankEventLogEntry::m_itemStackCount
private

◆ m_playerGuid

ObjectGuid Guild::BankEventLogEntry::m_playerGuid
private