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

Public Member Functions

 RankInfo ()
 
 RankInfo (ObjectGuid::LowType guildId)
 
 RankInfo (ObjectGuid::LowType guildId, uint8 rankId, std::string const &name, uint32 rights, uint32 money)
 
void LoadFromDB (Field *fields)
 
void SaveToDB (SQLTransaction &trans) const
 
uint8 GetId () const
 
std::string constGetName () const
 
void SetName (std::string const &name)
 
uint32 GetRights () const
 
void SetRights (uint32 rights)
 
int32 GetBankMoneyPerDay () const
 
void SetBankMoneyPerDay (uint32 money)
 
int8 GetBankTabRights (uint8 tabId) const
 
int32 GetBankTabSlotsPerDay (uint8 tabId) const
 
void SetBankTabSlotsAndRights (GuildBankRightsAndSlots rightsAndSlots, bool saveToDB)
 
void CreateMissingTabsIfNeeded (uint8 ranks, SQLTransaction &trans, bool logOnCreate=false)
 

Private Attributes

ObjectGuid::LowType m_guildId
 
uint8 m_rankId
 
std::string m_name
 
uint32 m_rights
 
uint32 m_bankMoneyPerDay
 
GuildBankRightsAndSlots m_bankTabRightsAndSlots [GUILD_BANK_MAX_TABS]
 

Constructor & Destructor Documentation

Guild::RankInfo::RankInfo ( )
inline
ObjectGuid::LowType m_guildId
Definition: Guild.h:610
#define UI64LIT(N)
Definition: Define.h:138
uint8 m_rankId
Definition: Guild.h:611
uint32 m_rights
Definition: Guild.h:613
Definition: Guild.h:49
Definition: Guild.h:77
uint32 m_bankMoneyPerDay
Definition: Guild.h:614
Guild::RankInfo::RankInfo ( ObjectGuid::LowType  guildId)
inline
ObjectGuid::LowType m_guildId
Definition: Guild.h:610
uint8 m_rankId
Definition: Guild.h:611
uint32 m_rights
Definition: Guild.h:613
Definition: Guild.h:49
Definition: Guild.h:77
uint32 m_bankMoneyPerDay
Definition: Guild.h:614
Guild::RankInfo::RankInfo ( ObjectGuid::LowType  guildId,
uint8  rankId,
std::string const name,
uint32  rights,
uint32  money 
)
inline
577  :
578  m_guildId(guildId), m_rankId(rankId), m_name(name), m_rights(rights),
Definition: Guild.h:66
ObjectGuid::LowType m_guildId
Definition: Guild.h:610
uint8 m_rankId
Definition: Guild.h:611
uint32 m_rights
Definition: Guild.h:613
std::string m_name
Definition: Guild.h:612
uint32 m_bankMoneyPerDay
Definition: Guild.h:614
Definition: Guild.h:50

Member Function Documentation

void Guild::RankInfo::CreateMissingTabsIfNeeded ( uint8  ranks,
SQLTransaction trans,
bool  logOnCreate = false 
)
269 {
270  for (uint8 i = 0; i < tabs; ++i)
271  {
273  if (rightsAndSlots.GetTabId() == i)
274  continue;
275 
276  rightsAndSlots.SetTabId(i);
277  if (m_rankId == GR_GUILDMASTER)
278  rightsAndSlots.SetGuildMasterValues();
279 
280  if (logOnCreate)
281  TC_LOG_ERROR("guild", "Guild " UI64FMTD " has broken Tab %u for rank %u. Created default tab.", m_guildId, i, m_rankId);
282 
284  stmt->setUInt64(0, m_guildId);
285  stmt->setUInt8(1, i);
286  stmt->setUInt8(2, m_rankId);
287  stmt->setInt8(3, rightsAndSlots.GetRights());
288  stmt->setInt32(4, rightsAndSlots.GetSlots());
289  trans->Append(stmt);
290  }
291 }
Definition: Guild.h:66
Definition: CharacterDatabase.h:174
void setUInt8(const uint8 index, const uint8 value)
Definition: PreparedStatement.cpp:97
ObjectGuid::LowType m_guildId
Definition: Guild.h:610
void SetGuildMasterValues()
Definition: Guild.h:296
Definition: PreparedStatement.h:74
uint8 m_rankId
Definition: Guild.h:611
GuildBankRightsAndSlots m_bankTabRightsAndSlots[GUILD_BANK_MAX_TABS]
Definition: Guild.h:615
int8 GetRights() const
Definition: Guild.h:308
#define UI64FMTD
Definition: Define.h:137
Definition: Guild.h:289
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
void setInt32(const uint8 index, const int32 value)
Definition: PreparedStatement.cpp:151
void setInt8(const uint8 index, const int8 value)
Definition: PreparedStatement.cpp:133
int32 GetSlots() const
Definition: Guild.h:307
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
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
int8 GetTabId() const
Definition: Guild.h:306
void SetTabId(uint8 _tabId)
Definition: Guild.h:302

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int32 Guild::RankInfo::GetBankMoneyPerDay ( ) const
inline
592 { return m_bankMoneyPerDay; }
uint32 m_bankMoneyPerDay
Definition: Guild.h:614

+ Here is the caller graph for this function:

int8 Guild::RankInfo::GetBankTabRights ( uint8  tabId) const
inline
597  {
598  return tabId < GUILD_BANK_MAX_TABS ? m_bankTabRightsAndSlots[tabId].GetRights() : 0;
599  }
Definition: Guild.h:44
GuildBankRightsAndSlots m_bankTabRightsAndSlots[GUILD_BANK_MAX_TABS]
Definition: Guild.h:615
int8 GetRights() const
Definition: Guild.h:308

+ Here is the caller graph for this function:

int32 Guild::RankInfo::GetBankTabSlotsPerDay ( uint8  tabId) const
inline
602  {
603  return tabId < GUILD_BANK_MAX_TABS ? m_bankTabRightsAndSlots[tabId].GetSlots() : 0;
604  }
Definition: Guild.h:44
GuildBankRightsAndSlots m_bankTabRightsAndSlots[GUILD_BANK_MAX_TABS]
Definition: Guild.h:615
int32 GetSlots() const
Definition: Guild.h:307

+ Here is the caller graph for this function:

uint8 Guild::RankInfo::GetId ( ) const
inline
584 { return m_rankId; }
uint8 m_rankId
Definition: Guild.h:611

+ Here is the caller graph for this function:

std::string const& Guild::RankInfo::GetName ( ) const
inline
586 { return m_name; }
std::string m_name
Definition: Guild.h:612

+ Here is the caller graph for this function:

uint32 Guild::RankInfo::GetRights ( ) const
inline
589 { return m_rights; }
uint32 m_rights
Definition: Guild.h:613

+ Here is the caller graph for this function:

void Guild::RankInfo::LoadFromDB ( Field fields)
248 {
249  m_rankId = fields[1].GetUInt8();
250  m_name = fields[2].GetString();
251  m_rights = fields[3].GetUInt32();
252  m_bankMoneyPerDay = fields[4].GetUInt32();
253  if (m_rankId == GR_GUILDMASTER) // Prevent loss of leader rights
255 }
Definition: Guild.h:66
Definition: Guild.h:99
uint8 m_rankId
Definition: Guild.h:611
uint8 GetUInt8() const
Definition: Field.h:70
uint32 m_rights
Definition: Guild.h:613
std::string m_name
Definition: Guild.h:612
uint32 GetUInt32() const
Definition: Field.h:146
uint32 m_bankMoneyPerDay
Definition: Guild.h:614
std::string GetString() const
Definition: Field.h:276

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Guild::RankInfo::SaveToDB ( SQLTransaction trans) const
258 {
260  stmt->setUInt64(0, m_guildId);
261  stmt->setUInt8 (1, m_rankId);
262  stmt->setString(2, m_name);
263  stmt->setUInt32(3, m_rights);
264  stmt->setUInt32(4, m_bankMoneyPerDay);
265  CharacterDatabase.ExecuteOrAppend(trans, stmt);
266 }
void ExecuteOrAppend(SQLTransaction &trans, PreparedStatement *stmt)
Definition: DatabaseWorkerPool.h:236
void setUInt8(const uint8 index, const uint8 value)
Definition: PreparedStatement.cpp:97
ObjectGuid::LowType m_guildId
Definition: Guild.h:610
void setString(const uint8 index, const std::string &value)
Definition: PreparedStatement.cpp:187
Definition: PreparedStatement.h:74
uint8 m_rankId
Definition: Guild.h:611
uint32 m_rights
Definition: Guild.h:613
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
std::string m_name
Definition: Guild.h:612
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
uint32 m_bankMoneyPerDay
Definition: Guild.h:614
Definition: CharacterDatabase.h:164
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Guild::RankInfo::SetBankMoneyPerDay ( uint32  money)
325 {
326  if (m_rankId == GR_GUILDMASTER) // Prevent loss of leader rights
328 
329  if (m_bankMoneyPerDay == money)
330  return;
331 
332  m_bankMoneyPerDay = money;
333 
335  stmt->setUInt32(0, money);
336  stmt->setUInt8 (1, m_rankId);
337  stmt->setUInt64(2, m_guildId);
339 }
Definition: Guild.h:66
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
Definition: CharacterDatabase.h:194
void setUInt8(const uint8 index, const uint8 value)
Definition: PreparedStatement.cpp:97
ObjectGuid::LowType m_guildId
Definition: Guild.h:610
Definition: PreparedStatement.h:74
uint8 m_rankId
Definition: Guild.h:611
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
uint32 m_bankMoneyPerDay
Definition: Guild.h:614
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
Definition: Guild.h:50
uint32_t uint32
Definition: g3dmath.h:168

+ Here is the call graph for this function:

void Guild::RankInfo::SetBankTabSlotsAndRights ( GuildBankRightsAndSlots  rightsAndSlots,
bool  saveToDB 
)
342 {
343  if (m_rankId == GR_GUILDMASTER) // Prevent loss of leader rights
344  rightsAndSlots.SetGuildMasterValues();
345 
346  GuildBankRightsAndSlots& guildBR = m_bankTabRightsAndSlots[rightsAndSlots.GetTabId()];
347  guildBR = rightsAndSlots;
348 
349  if (saveToDB)
350  {
352  stmt->setUInt64(0, m_guildId);
353  stmt->setUInt8 (1, guildBR.GetTabId());
354  stmt->setUInt8 (2, m_rankId);
355  stmt->setInt8 (3, guildBR.GetRights());
356  stmt->setInt32 (4, guildBR.GetSlots());
358  }
359 }
Definition: Guild.h:66
Definition: CharacterDatabase.h:174
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
void setUInt8(const uint8 index, const uint8 value)
Definition: PreparedStatement.cpp:97
ObjectGuid::LowType m_guildId
Definition: Guild.h:610
void SetGuildMasterValues()
Definition: Guild.h:296
Definition: PreparedStatement.h:74
uint8 m_rankId
Definition: Guild.h:611
GuildBankRightsAndSlots m_bankTabRightsAndSlots[GUILD_BANK_MAX_TABS]
Definition: Guild.h:615
int8 GetRights() const
Definition: Guild.h:308
Definition: Guild.h:289
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
void setInt32(const uint8 index, const int32 value)
Definition: PreparedStatement.cpp:151
void setInt8(const uint8 index, const int8 value)
Definition: PreparedStatement.cpp:133
int32 GetSlots() const
Definition: Guild.h:307
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
int8 GetTabId() const
Definition: Guild.h:306

+ Here is the call graph for this function:

void Guild::RankInfo::SetName ( std::string const name)
294 {
295  if (m_name == name)
296  return;
297 
298  m_name = name;
299 
301  stmt->setString(0, m_name);
302  stmt->setUInt8 (1, m_rankId);
303  stmt->setUInt64(2, m_guildId);
305 }
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
void setUInt8(const uint8 index, const uint8 value)
Definition: PreparedStatement.cpp:97
ObjectGuid::LowType m_guildId
Definition: Guild.h:610
void setString(const uint8 index, const std::string &value)
Definition: PreparedStatement.cpp:187
Definition: PreparedStatement.h:74
Definition: CharacterDatabase.h:189
uint8 m_rankId
Definition: Guild.h:611
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
std::string m_name
Definition: Guild.h:612
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21

+ Here is the call graph for this function:

void Guild::RankInfo::SetRights ( uint32  rights)
308 {
309  if (m_rankId == GR_GUILDMASTER) // Prevent loss of leader rights
310  rights = GR_RIGHT_ALL;
311 
312  if (m_rights == rights)
313  return;
314 
315  m_rights = rights;
316 
318  stmt->setUInt32(0, m_rights);
319  stmt->setUInt8 (1, m_rankId);
320  stmt->setUInt64(2, m_guildId);
322 }
Definition: Guild.h:66
Definition: Guild.h:99
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
void setUInt8(const uint8 index, const uint8 value)
Definition: PreparedStatement.cpp:97
ObjectGuid::LowType m_guildId
Definition: Guild.h:610
Definition: PreparedStatement.h:74
uint8 m_rankId
Definition: Guild.h:611
uint32 m_rights
Definition: Guild.h:613
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
Definition: CharacterDatabase.h:190

+ Here is the call graph for this function:

Member Data Documentation

uint32 Guild::RankInfo::m_bankMoneyPerDay
private
GuildBankRightsAndSlots Guild::RankInfo::m_bankTabRightsAndSlots[GUILD_BANK_MAX_TABS]
private
ObjectGuid::LowType Guild::RankInfo::m_guildId
private
std::string Guild::RankInfo::m_name
private
uint8 Guild::RankInfo::m_rankId
private
uint32 Guild::RankInfo::m_rights
private

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