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

#include <GuildMgr.h>

Public Member Functions

GuildGetGuildByLeader (ObjectGuid guid) const
 
GuildGetGuildById (ObjectGuid::LowType guildId) const
 
GuildGetGuildByGuid (ObjectGuid guid) const
 
GuildGetGuildByName (std::string const &guildName) const
 
std::string GetGuildNameById (ObjectGuid::LowType guildId) const
 
void LoadGuildRewards ()
 
void LoadGuilds ()
 
void AddGuild (Guild *guild)
 
void RemoveGuild (ObjectGuid::LowType guildId)
 
void SaveGuilds ()
 
void ResetReputationCaps ()
 
ObjectGuid::LowType GenerateGuildId ()
 
void SetNextGuildId (ObjectGuid::LowType Id)
 
std::vector< GuildReward > constGetGuildRewards () const
 
void ResetTimes (bool week)
 

Static Public Member Functions

static GuildMgrinstance ()
 

Protected Types

typedef std::unordered_map
< ObjectGuid::LowType, Guild * > 
GuildContainer
 

Protected Attributes

ObjectGuid::LowType NextGuildId
 
GuildContainer GuildStore
 
std::vector< GuildRewardGuildRewards
 

Private Member Functions

 GuildMgr ()
 
 ~GuildMgr ()
 

Member Typedef Documentation

typedef std::unordered_map<ObjectGuid::LowType, Guild*> GuildMgr::GuildContainer
protected

Constructor & Destructor Documentation

GuildMgr::GuildMgr ( )
private
21  : NextGuildId(UI64LIT(1))
22 { }
#define UI64LIT(N)
Definition: Define.h:138
ObjectGuid::LowType NextGuildId
Definition: GuildMgr.h:56
GuildMgr::~GuildMgr ( )
private
25 {
26  for (GuildContainer::iterator itr = GuildStore.begin(); itr != GuildStore.end(); ++itr)
27  delete itr->second;
28 }
GuildContainer GuildStore
Definition: GuildMgr.h:57

Member Function Documentation

void GuildMgr::AddGuild ( Guild guild)
31 {
32  GuildStore[guild->GetId()] = guild;
33 }
ObjectGuid::LowType GetId() const
Definition: Guild.h:763
GuildContainer GuildStore
Definition: GuildMgr.h:57

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ObjectGuid::LowType GuildMgr::GenerateGuildId ( )
47 {
48  if (NextGuildId >= 0xFFFFFFFE)
49  {
50  TC_LOG_ERROR("guild", "Guild ids overflow!! Can't continue, shutting down server. ");
52  }
53  return NextGuildId++;
54 }
Definition: World.h:74
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
ObjectGuid::LowType NextGuildId
Definition: GuildMgr.h:56
static void StopNow(uint8 exitcode)
Definition: World.h:662

+ Here is the call graph for this function:

Guild * GuildMgr::GetGuildByGuid ( ObjectGuid  guid) const
67 {
68  // Full guids are only used when receiving/sending data to client
69  // everywhere else guild id is used
70  if (guid.IsGuild())
71  if (ObjectGuid::LowType guildId = guid.GetCounter())
72  return GetGuildById(guildId);
73 
74  return NULL;
75 }
arena_t NULL
Definition: jemalloc_internal.h:624
uint64 LowType
Definition: ObjectGuid.h:199
Guild * GetGuildById(ObjectGuid::LowType guildId) const
Definition: GuildMgr.cpp:57
bool IsGuild() const
Definition: ObjectGuid.h:259
LowType GetCounter() const
Definition: ObjectGuid.h:221

+ Here is the call graph for this function:

Guild * GuildMgr::GetGuildById ( ObjectGuid::LowType  guildId) const
58 {
59  GuildContainer::const_iterator itr = GuildStore.find(guildId);
60  if (itr != GuildStore.end())
61  return itr->second;
62 
63  return NULL;
64 }
arena_t NULL
Definition: jemalloc_internal.h:624
GuildContainer GuildStore
Definition: GuildMgr.h:57

+ Here is the caller graph for this function:

Guild * GuildMgr::GetGuildByLeader ( ObjectGuid  guid) const
106 {
107  for (GuildContainer::const_iterator itr = GuildStore.begin(); itr != GuildStore.end(); ++itr)
108  if (itr->second->GetLeaderGUID() == guid)
109  return itr->second;
110 
111  return NULL;
112 }
arena_t NULL
Definition: jemalloc_internal.h:624
GuildContainer GuildStore
Definition: GuildMgr.h:57
Guild * GuildMgr::GetGuildByName ( std::string const guildName) const
78 {
79  std::string search = guildName;
80  std::transform(search.begin(), search.end(), search.begin(), ::toupper);
81  for (GuildContainer::const_iterator itr = GuildStore.begin(); itr != GuildStore.end(); ++itr)
82  {
83  std::string gname = itr->second->GetName();
84  std::transform(gname.begin(), gname.end(), gname.begin(), ::toupper);
85  if (search == gname)
86  return itr->second;
87  }
88  return NULL;
89 }
arena_t NULL
Definition: jemalloc_internal.h:624
GuildContainer GuildStore
Definition: GuildMgr.h:57

+ Here is the call graph for this function:

std::string GuildMgr::GetGuildNameById ( ObjectGuid::LowType  guildId) const
92 {
93  if (Guild* guild = GetGuildById(guildId))
94  return guild->GetName();
95 
96  return "";
97 }
Guild * GetGuildById(ObjectGuid::LowType guildId) const
Definition: GuildMgr.cpp:57
Definition: Guild.h:320

+ Here is the call graph for this function:

std::vector<GuildReward> const& GuildMgr::GetGuildRewards ( ) const
inline
51 { return GuildRewards; }
std::vector< GuildReward > GuildRewards
Definition: GuildMgr.h:58
GuildMgr * GuildMgr::instance ( )
static
100 {
101  static GuildMgr instance;
102  return &instance;
103 }
Definition: GuildMgr.h:23
static GuildMgr * instance()
Definition: GuildMgr.cpp:99
void GuildMgr::LoadGuildRewards ( )
468 {
469  uint32 oldMSTime = getMSTime();
470 
471  // 0 1 2 3
472  QueryResult result = WorldDatabase.Query("SELECT ItemID, MinGuildRep, RaceMask, Cost FROM guild_rewards");
473 
474  if (!result)
475  {
476  TC_LOG_ERROR("server.loading", ">> Loaded 0 guild reward definitions. DB table `guild_rewards` is empty.");
477  return;
478  }
479 
480  uint32 count = 0;
481 
482  do
483  {
484  GuildReward reward;
485  Field* fields = result->Fetch();
486  reward.ItemID = fields[0].GetUInt32();
487  reward.MinGuildRep = fields[1].GetUInt8();
488  reward.RaceMask = fields[2].GetInt32();
489  reward.Cost = fields[3].GetUInt64();
490 
491  if (!sObjectMgr->GetItemTemplate(reward.ItemID))
492  {
493  TC_LOG_ERROR("server.loading", "Guild rewards constains not existing item entry %u", reward.ItemID);
494  continue;
495  }
496 
497  if (reward.MinGuildRep >= MAX_REPUTATION_RANK)
498  {
499  TC_LOG_ERROR("server.loading", "Guild rewards contains wrong reputation standing %u, max is %u", uint32(reward.MinGuildRep), MAX_REPUTATION_RANK - 1);
500  continue;
501  }
502 
504  stmt->setUInt32(0, reward.ItemID);
505  PreparedQueryResult reqAchievementResult = WorldDatabase.Query(stmt);
506  if (reqAchievementResult)
507  {
508  do
509  {
510  fields = reqAchievementResult->Fetch();
511 
512  uint32 requiredAchievementId = fields[0].GetUInt32();
513 
514  if (!sAchievementMgr->GetAchievement(requiredAchievementId))
515  {
516  TC_LOG_ERROR("server.loading", "Guild rewards constains not existing achievement entry %u", requiredAchievementId);
517  continue;
518  }
519 
520  reward.AchievementsRequired.push_back(requiredAchievementId);
521  } while (reqAchievementResult->NextRow());
522  }
523 
524  GuildRewards.push_back(reward);
525  ++count;
526  } while (result->NextRow());
527 
528  TC_LOG_INFO("server.loading", ">> Loaded %u guild reward definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
529 }
std::shared_ptr< PreparedResultSet > PreparedQueryResult
Definition: QueryResult.h:107
uint64 GetUInt64() const
Definition: Field.h:184
Definition: WorldDatabase.h:101
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
int32 RaceMask
Definition: Guild.h:249
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
uint32 ItemID
Definition: Guild.h:247
uint64 Cost
Definition: Guild.h:250
#define sObjectMgr
Definition: ObjectMgr.h:1567
Definition: PreparedStatement.h:74
Definition: Guild.h:245
#define MAX_REPUTATION_RANK
Definition: SharedDefines.h:224
uint8 MinGuildRep
Definition: Guild.h:248
uint8 GetUInt8() const
Definition: Field.h:70
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
int32 GetInt32() const
Definition: Field.h:165
std::vector< GuildReward > GuildRewards
Definition: GuildMgr.h:58
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint32 GetUInt32() const
Definition: Field.h:146
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
uint32_t uint32
Definition: g3dmath.h:168
std::vector< uint32 > AchievementsRequired
Definition: Guild.h:251
#define sAchievementMgr
Definition: AchievementMgr.h:501

+ Here is the call graph for this function:

void GuildMgr::LoadGuilds ( )
115 {
116  // 1. Load all guilds
117  TC_LOG_INFO("server.loading", "Loading guilds definitions...");
118  {
119  uint32 oldMSTime = getMSTime();
120 
121  // 0 1 2 3 4 5 6
122  QueryResult result = CharacterDatabase.Query("SELECT g.guildid, g.name, g.leaderguid, g.EmblemStyle, g.EmblemColor, g.BorderStyle, g.BorderColor, "
123  // 7 8 9 10 11 12 13
124  "g.BackgroundColor, g.info, g.motd, g.createdate, g.BankMoney, g.level, COUNT(gbt.guildid) "
125  "FROM guild g LEFT JOIN guild_bank_tab gbt ON g.guildid = gbt.guildid GROUP BY g.guildid ORDER BY g.guildid ASC");
126 
127  if (!result)
128  {
129  TC_LOG_INFO("server.loading", ">> Loaded 0 guild definitions. DB table `guild` is empty.");
130  return;
131  }
132  else
133  {
134  uint32 count = 0;
135  do
136  {
137  Field* fields = result->Fetch();
138  Guild* guild = new Guild();
139 
140  if (!guild->LoadFromDB(fields))
141  {
142  delete guild;
143  continue;
144  }
145 
146  AddGuild(guild);
147 
148  ++count;
149  }
150  while (result->NextRow());
151 
152  TC_LOG_INFO("server.loading", ">> Loaded %u guild definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
153  }
154  }
155 
156  // 2. Load all guild ranks
157  TC_LOG_INFO("server.loading", "Loading guild ranks...");
158  {
159  uint32 oldMSTime = getMSTime();
160 
161  // Delete orphaned guild rank entries before loading the valid ones
162  CharacterDatabase.DirectExecute("DELETE gr FROM guild_rank gr LEFT JOIN guild g ON gr.guildId = g.guildId WHERE g.guildId IS NULL");
163 
164  // 0 1 2 3 4
165  QueryResult result = CharacterDatabase.Query("SELECT guildid, rid, rname, rights, BankMoneyPerDay FROM guild_rank ORDER BY guildid ASC, rid ASC");
166 
167  if (!result)
168  {
169  TC_LOG_INFO("server.loading", ">> Loaded 0 guild ranks. DB table `guild_rank` is empty.");
170  }
171  else
172  {
173  uint32 count = 0;
174  do
175  {
176  Field* fields = result->Fetch();
177  uint64 guildId = fields[0].GetUInt64();
178 
179  if (Guild* guild = GetGuildById(guildId))
180  guild->LoadRankFromDB(fields);
181 
182  ++count;
183  }
184  while (result->NextRow());
185 
186  TC_LOG_INFO("server.loading", ">> Loaded %u guild ranks in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
187  }
188  }
189 
190  // 3. Load all guild members
191  TC_LOG_INFO("server.loading", "Loading guild members...");
192  {
193  uint32 oldMSTime = getMSTime();
194 
195  // Delete orphaned guild member entries before loading the valid ones
196  CharacterDatabase.DirectExecute("DELETE gm FROM guild_member gm LEFT JOIN guild g ON gm.guildId = g.guildId WHERE g.guildId IS NULL");
197  CharacterDatabase.DirectExecute("DELETE gm FROM guild_member_withdraw gm LEFT JOIN guild_member g ON gm.guid = g.guid WHERE g.guid IS NULL");
198 
199  // 0 1 2 3 4 5 6 7 8 9 10
200  QueryResult result = CharacterDatabase.Query("SELECT gm.guildid, gm.guid, rank, pnote, offnote, w.tab0, w.tab1, w.tab2, w.tab3, w.tab4, w.tab5, "
201  // 11 12 13 14 15 16 17 18 19 20
202  "w.tab6, w.tab7, w.money, c.name, c.level, c.class, c.gender, c.zone, c.account, c.logout_time "
203  "FROM guild_member gm "
204  "LEFT JOIN guild_member_withdraw w ON gm.guid = w.guid "
205  "LEFT JOIN characters c ON c.guid = gm.guid ORDER BY gm.guildid ASC");
206 
207  if (!result)
208  TC_LOG_INFO("server.loading", ">> Loaded 0 guild members. DB table `guild_member` is empty.");
209  else
210  {
211  uint32 count = 0;
212 
213  do
214  {
215  Field* fields = result->Fetch();
216  uint64 guildId = fields[0].GetUInt64();
217 
218  if (Guild* guild = GetGuildById(guildId))
219  guild->LoadMemberFromDB(fields);
220 
221  ++count;
222  }
223  while (result->NextRow());
224 
225  TC_LOG_INFO("server.loading", ">> Loaded %u guild members in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
226  }
227  }
228 
229  // 4. Load all guild bank tab rights
230  TC_LOG_INFO("server.loading", "Loading bank tab rights...");
231  {
232  uint32 oldMSTime = getMSTime();
233 
234  // Delete orphaned guild bank right entries before loading the valid ones
235  CharacterDatabase.DirectExecute("DELETE gbr FROM guild_bank_right gbr LEFT JOIN guild g ON gbr.guildId = g.guildId WHERE g.guildId IS NULL");
236 
237  // 0 1 2 3 4
238  QueryResult result = CharacterDatabase.Query("SELECT guildid, TabId, rid, gbright, SlotPerDay FROM guild_bank_right ORDER BY guildid ASC, TabId ASC");
239 
240  if (!result)
241  {
242  TC_LOG_INFO("server.loading", ">> Loaded 0 guild bank tab rights. DB table `guild_bank_right` is empty.");
243  }
244  else
245  {
246  uint32 count = 0;
247  do
248  {
249  Field* fields = result->Fetch();
250  uint64 guildId = fields[0].GetUInt64();
251 
252  if (Guild* guild = GetGuildById(guildId))
253  guild->LoadBankRightFromDB(fields);
254 
255  ++count;
256  }
257  while (result->NextRow());
258 
259  TC_LOG_INFO("server.loading", ">> Loaded %u bank tab rights in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
260  }
261  }
262 
263  // 5. Load all event logs
264  TC_LOG_INFO("server.loading", "Loading guild event logs...");
265  {
266  uint32 oldMSTime = getMSTime();
267 
268  CharacterDatabase.DirectPExecute("DELETE FROM guild_eventlog WHERE LogGuid > %u", sWorld->getIntConfig(CONFIG_GUILD_EVENT_LOG_COUNT));
269 
270  // 0 1 2 3 4 5 6
271  QueryResult result = CharacterDatabase.Query("SELECT guildid, LogGuid, EventType, PlayerGuid1, PlayerGuid2, NewRank, TimeStamp FROM guild_eventlog ORDER BY TimeStamp DESC, LogGuid DESC");
272 
273  if (!result)
274  {
275  TC_LOG_INFO("server.loading", ">> Loaded 0 guild event logs. DB table `guild_eventlog` is empty.");
276  }
277  else
278  {
279  uint32 count = 0;
280  do
281  {
282  Field* fields = result->Fetch();
283  uint64 guildId = fields[0].GetUInt64();
284 
285  if (Guild* guild = GetGuildById(guildId))
286  guild->LoadEventLogFromDB(fields);
287 
288  ++count;
289  }
290  while (result->NextRow());
291 
292  TC_LOG_INFO("server.loading", ">> Loaded %u guild event logs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
293  }
294  }
295 
296  // 6. Load all bank event logs
297  TC_LOG_INFO("server.loading", "Loading guild bank event logs...");
298  {
299  uint32 oldMSTime = getMSTime();
300 
301  // Remove log entries that exceed the number of allowed entries per guild
302  CharacterDatabase.DirectPExecute("DELETE FROM guild_bank_eventlog WHERE LogGuid > %u", sWorld->getIntConfig(CONFIG_GUILD_BANK_EVENT_LOG_COUNT));
303 
304  // 0 1 2 3 4 5 6 7 8
305  QueryResult result = CharacterDatabase.Query("SELECT guildid, TabId, LogGuid, EventType, PlayerGuid, ItemOrMoney, ItemStackCount, DestTabId, TimeStamp FROM guild_bank_eventlog ORDER BY TimeStamp DESC, LogGuid DESC");
306 
307  if (!result)
308  {
309  TC_LOG_INFO("server.loading", ">> Loaded 0 guild bank event logs. DB table `guild_bank_eventlog` is empty.");
310  }
311  else
312  {
313  uint32 count = 0;
314  do
315  {
316  Field* fields = result->Fetch();
317  uint64 guildId = fields[0].GetUInt64();
318 
319  if (Guild* guild = GetGuildById(guildId))
320  guild->LoadBankEventLogFromDB(fields);
321 
322  ++count;
323  }
324  while (result->NextRow());
325 
326  TC_LOG_INFO("server.loading", ">> Loaded %u guild bank event logs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
327  }
328  }
329 
330  // 7. Load all news event logs
331  TC_LOG_INFO("server.loading", "Loading Guild News...");
332  {
333  uint32 oldMSTime = getMSTime();
334 
335  CharacterDatabase.DirectPExecute("DELETE FROM guild_newslog WHERE LogGuid > %u", sWorld->getIntConfig(CONFIG_GUILD_NEWS_LOG_COUNT));
336 
337  // 0 1 2 3 4 5 6
338  QueryResult result = CharacterDatabase.Query("SELECT guildid, LogGuid, EventType, PlayerGuid, Flags, Value, Timestamp FROM guild_newslog ORDER BY TimeStamp DESC, LogGuid DESC");
339 
340  if (!result)
341  TC_LOG_INFO("server.loading", ">> Loaded 0 guild event logs. DB table `guild_newslog` is empty.");
342  else
343  {
344  uint32 count = 0;
345  do
346  {
347  Field* fields = result->Fetch();
348  uint64 guildId = fields[0].GetUInt64();
349 
350  if (Guild* guild = GetGuildById(guildId))
351  guild->LoadGuildNewsLogFromDB(fields);
352 
353  ++count;
354  }
355  while (result->NextRow());
356 
357  TC_LOG_INFO("server.loading", ">> Loaded %u guild new logs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
358  }
359  }
360 
361 
362  // 8. Load all guild bank tabs
363  TC_LOG_INFO("server.loading", "Loading guild bank tabs...");
364  {
365  uint32 oldMSTime = getMSTime();
366 
367  // Delete orphaned guild bank tab entries before loading the valid ones
368  CharacterDatabase.DirectExecute("DELETE gbt FROM guild_bank_tab gbt LEFT JOIN guild g ON gbt.guildId = g.guildId WHERE g.guildId IS NULL");
369 
370  // 0 1 2 3 4
371  QueryResult result = CharacterDatabase.Query("SELECT guildid, TabId, TabName, TabIcon, TabText FROM guild_bank_tab ORDER BY guildid ASC, TabId ASC");
372 
373  if (!result)
374  {
375  TC_LOG_INFO("server.loading", ">> Loaded 0 guild bank tabs. DB table `guild_bank_tab` is empty.");
376  }
377  else
378  {
379  uint32 count = 0;
380  do
381  {
382  Field* fields = result->Fetch();
383  uint64 guildId = fields[0].GetUInt64();
384 
385  if (Guild* guild = GetGuildById(guildId))
386  guild->LoadBankTabFromDB(fields);
387 
388  ++count;
389  }
390  while (result->NextRow());
391 
392  TC_LOG_INFO("server.loading", ">> Loaded %u guild bank tabs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
393  }
394  }
395 
396  // 9. Fill all guild bank tabs
397  TC_LOG_INFO("guild", "Filling bank tabs with items...");
398  {
399  uint32 oldMSTime = getMSTime();
400 
401  // Delete orphan guild bank items
402  CharacterDatabase.DirectExecute("DELETE gbi FROM guild_bank_item gbi LEFT JOIN guild g ON gbi.guildId = g.guildId WHERE g.guildId IS NULL");
403 
404  // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
405  // SELECT guid, itemEntry, creatorGuid, giftCreatorGuid, count, duration, charges, flags, enchantments, randomPropertyId, durability, playedTime, text, transmogrification, upgradeId, enchantIllusion,
406  // 17 18 19 20 21 22 23
407  // battlePetSpeciesId, battlePetBreedData, battlePetLevel, battlePetDisplayId, guildid, TabId, SlotId FROM guild_bank_item gbi INNER JOIN item_instance ii ON gbi.item_guid = ii.guid
408 
410  if (!result)
411  {
412  TC_LOG_INFO("server.loading", ">> Loaded 0 guild bank tab items. DB table `guild_bank_item` or `item_instance` is empty.");
413  }
414  else
415  {
416  uint32 count = 0;
417  do
418  {
419  Field* fields = result->Fetch();
420  uint64 guildId = fields[21].GetUInt64();
421 
422  if (Guild* guild = GetGuildById(guildId))
423  guild->LoadBankItemFromDB(fields);
424 
425  ++count;
426  }
427  while (result->NextRow());
428 
429  TC_LOG_INFO("server.loading", ">> Loaded %u guild bank tab items in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
430  }
431  }
432 
433  // 10. Load guild achievements
434  {
435  PreparedQueryResult achievementResult;
436  PreparedQueryResult criteriaResult;
437  for (GuildContainer::const_iterator itr = GuildStore.begin(); itr != GuildStore.end(); ++itr)
438  {
440  stmt->setUInt64(0, itr->first);
441  achievementResult = CharacterDatabase.Query(stmt);
443  stmt->setUInt64(0, itr->first);
444  criteriaResult = CharacterDatabase.Query(stmt);
445 
446  itr->second->GetAchievementMgr().LoadFromDB(achievementResult, criteriaResult);
447  }
448  }
449 
450  // 11. Validate loaded guild data
451  TC_LOG_INFO("misc", "Validating data of loaded guilds...");
452  {
453  uint32 oldMSTime = getMSTime();
454 
455  for (GuildContainer::iterator itr = GuildStore.begin(); itr != GuildStore.end();)
456  {
457  Guild* guild = itr->second;
458  ++itr;
459  if (guild && !guild->Validate())
460  delete guild;
461  }
462 
463  TC_LOG_INFO("server.loading", ">> Validated data of loaded guilds in %u ms", GetMSTimeDiffToNow(oldMSTime));
464  }
465 }
bool LoadBankEventLogFromDB(Field *fields)
Definition: Guild.cpp:2332
std::shared_ptr< PreparedResultSet > PreparedQueryResult
Definition: QueryResult.h:107
uint64 GetUInt64() const
Definition: Field.h:184
bool Validate()
Definition: Guild.cpp:2409
Definition: World.h:327
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
Definition: CharacterDatabase.h:172
#define sWorld
Definition: World.h:887
void LoadRankFromDB(Field *fields)
Definition: Guild.cpp:2283
Definition: PreparedStatement.h:74
bool LoadEventLogFromDB(Field *fields)
Definition: Guild.cpp:2315
Definition: World.h:326
void LoadBankTabFromDB(Field *fields)
Definition: Guild.cpp:2387
Definition: World.h:328
void DirectPExecute(Format &&sql, Args &&...args)
Definition: DatabaseWorkerPool.h:134
void LoadGuildNewsLogFromDB(Field *fields)
Definition: Guild.cpp:2372
uint32_t uint32
Definition: Define.h:150
uint64_t uint64
Definition: Define.h:149
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
GuildContainer GuildStore
Definition: GuildMgr.h:57
void LoadBankRightFromDB(Field *fields)
Definition: Guild.cpp:2307
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
bool LoadBankItemFromDB(Field *fields)
Definition: Guild.cpp:2396
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
bool LoadMemberFromDB(Field *fields)
Definition: Guild.cpp:2292
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
bool LoadFromDB(Field *fields)
Definition: Guild.cpp:2252
void AddGuild(Guild *guild)
Definition: GuildMgr.cpp:30
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
Guild * GetGuildById(ObjectGuid::LowType guildId) const
Definition: GuildMgr.cpp:57
void DirectExecute(const char *sql)
Definition: DatabaseWorkerPool.h:121
Definition: Guild.h:320
Definition: CharacterDatabase.h:205
Definition: CharacterDatabase.h:206

+ Here is the call graph for this function:

void GuildMgr::RemoveGuild ( ObjectGuid::LowType  guildId)
36 {
37  GuildStore.erase(guildId);
38 }
GuildContainer GuildStore
Definition: GuildMgr.h:57
void GuildMgr::ResetReputationCaps ( )
void GuildMgr::ResetTimes ( bool  week)
532 {
534 
535  for (GuildContainer::const_iterator itr = GuildStore.begin(); itr != GuildStore.end(); ++itr)
536  if (Guild* guild = itr->second)
537  guild->ResetTimes(week);
538 }
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
Definition: CharacterDatabase.h:197
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
GuildContainer GuildStore
Definition: GuildMgr.h:57
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
Definition: Guild.h:320

+ Here is the call graph for this function:

void GuildMgr::SaveGuilds ( )
41 {
42  for (GuildContainer::iterator itr = GuildStore.begin(); itr != GuildStore.end(); ++itr)
43  itr->second->SaveToDB();
44 }
GuildContainer GuildStore
Definition: GuildMgr.h:57
void GuildMgr::SetNextGuildId ( ObjectGuid::LowType  Id)
inline
49 { NextGuildId = Id; }
ObjectGuid::LowType NextGuildId
Definition: GuildMgr.h:56

Member Data Documentation

std::vector<GuildReward> GuildMgr::GuildRewards
protected
GuildContainer GuildMgr::GuildStore
protected
ObjectGuid::LowType GuildMgr::NextGuildId
protected

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