TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Guild.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
3  * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License as published by the
7  * Free Software Foundation; either version 2 of the License, or (at your
8  * option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13  * more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef TRINITYCORE_GUILD_H
20 #define TRINITYCORE_GUILD_H
21 
22 #include "AchievementMgr.h"
23 #include "World.h"
24 #include "Item.h"
25 #include "WorldPacket.h"
26 #include "ObjectMgr.h"
27 #include "Player.h"
28 #include "DBCStore.h"
29 
30 class Item;
31 
32 namespace WorldPackets
33 {
34  namespace Guild
35  {
38  class GuildNews;
39  }
40 }
41 
43 {
44  GUILD_BANK_MAX_TABS = 8, // send by client for money log also
46  GUILD_BANK_MONEY_LOGS_TAB = 100, // used for money log in DB
53  TAB_UNDEFINED = 0xFF,
54 };
55 
57 {
61 };
62 
64 {
65  // These ranks can be modified, but they cannot be deleted
69  GR_MEMBER = 3,
71  // When promoting member server does: rank--
72  // When demoting member server does: rank++
73 };
74 
76 {
77  GR_RIGHT_NONE = 0x00000000,
78  GR_RIGHT_GCHATLISTEN = 0x00000001,
79  GR_RIGHT_GCHATSPEAK = 0x00000002,
80  GR_RIGHT_OFFCHATLISTEN = 0x00000004,
81  GR_RIGHT_OFFCHATSPEAK = 0x00000008,
82  GR_RIGHT_INVITE = 0x00000010,
83  GR_RIGHT_REMOVE = 0x00000020,
84  GR_RIGHT_ROSTER = 0x00000040,
85  GR_RIGHT_PROMOTE = 0x00000080,
86  GR_RIGHT_DEMOTE = 0x00000100,
87  GR_RIGHT_UNK_200 = 0x00000200,
88  GR_RIGHT_UNK_400 = 0x00000400,
89  GR_RIGHT_UNK_800 = 0x00000800,
90  GR_RIGHT_SETMOTD = 0x00001000,
92  GR_RIGHT_VIEWOFFNOTE = 0x00004000,
93  GR_RIGHT_EOFFNOTE = 0x00008000,
95  GR_RIGHT_WITHDRAW_GOLD_LOCK = 0x00020000, // remove money withdraw capacity
96  GR_RIGHT_WITHDRAW_REPAIR = 0x00040000, // withdraw for repair
97  GR_RIGHT_WITHDRAW_GOLD = 0x00080000, // withdraw gold
98  GR_RIGHT_CREATE_GUILD_EVENT = 0x00100000, // wotlk
99  GR_RIGHT_ALL = 0x00DDFFBF
100 };
101 
103 {
120 };
121 
123 {
143  ERR_GUILD_UNK1 = 20, // Forces roster update
156 };
157 
159 {
165 };
166 
168 {
177 };
178 
180 {
184 
187 };
188 
190 {
201 };
202 
204 {
211 };
212 
214 {
221 };
222 
224 {
229  GUILDMEMBER_STATUS_MOBILE = 0x0008, // remote chat from mobile app
230 };
231 
233 {
236  GUILD_NEWS_DUNGEON_ENCOUNTER = 2, // @todo Implement
241  GUILD_NEWS_CREATE = 7, // @todo Implement
242  GUILD_NEWS_EVENT = 8 // @todo Implement
243 };
244 
246 {
251  std::vector<uint32> AchievementsRequired;
252 };
253 
255 
256 // Guild Challenge
257 #define GUILD_CHALLENGES_TYPES 6
258 
259 const uint32 GuildChallengeGoldReward[GUILD_CHALLENGES_TYPES] = { 0, 250, 1000, 500, 250, 500 };
260 const uint32 GuildChallengeMaxLevelGoldReward[GUILD_CHALLENGES_TYPES] = { 0, 125, 500, 250, 125, 250 };
262 
263 // Emblem info
265 {
266 public:
267  EmblemInfo() : m_style(0), m_color(0), m_borderStyle(0), m_borderColor(0), m_backgroundColor(0) { }
268 
269  bool LoadFromDB(Field* fields);
270  void SaveToDB(ObjectGuid::LowType guildId) const;
271  void ReadPacket(WorldPackets::Guild::SaveGuildEmblem& packet);
272  bool ValidateEmblemColors();
273 
274  uint32 GetStyle() const { return m_style; }
275  uint32 GetColor() const { return m_color; }
276  uint32 GetBorderStyle() const { return m_borderStyle; }
277  uint32 GetBorderColor() const { return m_borderColor; }
278  uint32 GetBackgroundColor() const { return m_backgroundColor; }
279 
280 private:
286 };
287 
288 // Structure for storing guild bank rights and remaining slots together.
290 {
291 public:
293  GuildBankRightsAndSlots(uint8 _tabId) : tabId(_tabId), rights(0), slots(0) { }
294  GuildBankRightsAndSlots(uint8 _tabId, int8 _rights, int32 _slots) : tabId(_tabId), rights(_rights), slots(_slots) { }
295 
297  {
300  }
301 
302  void SetTabId(uint8 _tabId) { tabId = _tabId; }
303  void SetSlots(int32 _slots) { slots = _slots; }
304  void SetRights(int8 _rights) { rights = _rights; }
305 
306  int8 GetTabId() const { return tabId; }
307  int32 GetSlots() const { return slots; }
308  int8 GetRights() const { return rights; }
309 
310 private:
314 };
315 
316 typedef std::vector <GuildBankRightsAndSlots> GuildBankRightsAndSlotsVec;
317 
318 typedef std::set <uint8> SlotIds;
319 
321 {
322 private:
323  // Class representing guild member
324  class Member
325  {
326  public:
327  Member(ObjectGuid::LowType guildId, ObjectGuid guid, uint8 rankId) :
328  m_guildId(guildId),
329  m_guid(guid),
330  m_zoneId(0),
331  m_level(0),
332  m_class(0),
333  _gender(0),
334  m_flags(GUILDMEMBER_STATUS_NONE),
335  m_logoutTime(::time(NULL)),
336  m_accountId(0),
337  m_rankId(rankId),
338  m_achievementPoints(0),
339  m_totalActivity(0),
340  m_weekActivity(0),
341  m_totalReputation(0),
342  m_weekReputation(0)
343  {
344  memset(m_bankWithdraw, 0, (GUILD_BANK_MAX_TABS + 1) * sizeof(int32));
345  }
346 
347  void SetStats(Player* player);
348  void SetStats(std::string const& name, uint8 level, uint8 _class, uint8 gender, uint32 zoneId, uint32 accountId, uint32 reputation);
349  bool CheckStats() const;
350 
351  void SetPublicNote(std::string const& publicNote);
352  void SetOfficerNote(std::string const& officerNote);
353  void SetZoneId(uint32 id) { m_zoneId = id; }
354  void SetAchievementPoints(uint32 val) { m_achievementPoints = val; }
355  void SetLevel(uint8 var) { m_level = var; }
356  void AddReputation(uint32& reputation);
357  void AddActivity(uint64 activity);
358 
359  void AddFlag(uint8 var) { m_flags |= var; }
360  void RemFlag(uint8 var) { m_flags &= ~var; }
361  void ResetFlags() { m_flags = GUILDMEMBER_STATUS_NONE; }
362 
363  bool LoadFromDB(Field* fields);
364  void SaveToDB(SQLTransaction& trans) const;
365 
366  ObjectGuid const& GetGUID() const { return m_guid; }
367  std::string const& GetName() const { return m_name; }
368  uint32 GetAccountId() const { return m_accountId; }
369  uint8 GetRankId() const { return m_rankId; }
370  uint64 GetLogoutTime() const { return m_logoutTime; }
371  std::string GetPublicNote() const { return m_publicNote; }
372  std::string GetOfficerNote() const { return m_officerNote; }
373  uint8 GetClass() const { return m_class; }
374  uint8 GetGender() const { return _gender; }
375  uint8 GetLevel() const { return m_level; }
376  uint8 GetFlags() const { return m_flags; }
377  uint32 GetZoneId() const { return m_zoneId; }
378  uint32 GetAchievementPoints() const { return m_achievementPoints; }
379  uint64 GetTotalActivity() const { return m_totalActivity; }
380  uint64 GetWeekActivity() const { return m_weekActivity; }
381  uint32 GetTotalReputation() const { return m_totalReputation; }
382  uint32 GetWeekReputation() const { return m_weekReputation; }
383 
384  std::set<uint32> GetTrackedCriteriaIds() const { return m_trackedCriteriaIds; }
385  void SetTrackedCriteriaIds(std::set<uint32> criteriaIds) { m_trackedCriteriaIds.swap(criteriaIds); }
386  bool IsTrackingCriteriaId(uint32 criteriaId) const { return m_trackedCriteriaIds.find(criteriaId) != m_trackedCriteriaIds.end(); }
387 
388  bool IsOnline() const { return (m_flags & GUILDMEMBER_STATUS_ONLINE); }
389 
390  void ChangeRank(uint8 newRank);
391 
392  inline void UpdateLogoutTime() { m_logoutTime = ::time(NULL); }
393  inline bool IsRank(uint8 rankId) const { return m_rankId == rankId; }
394  inline bool IsRankNotLower(uint8 rankId) const { return m_rankId <= rankId; }
395  inline bool IsSamePlayer(ObjectGuid guid) const { return m_guid == guid; }
396 
397  void UpdateBankWithdrawValue(SQLTransaction& trans, uint8 tabId, uint32 amount);
398  int32 GetBankWithdrawValue(uint8 tabId) const;
399  void ResetValues(bool weekly = false);
400 
401  inline Player* FindPlayer() const { return ObjectAccessor::FindPlayer(m_guid); }
403 
404  private:
406  // Fields from characters table
408  std::string m_name;
416  // Fields from guild_member table
418  std::string m_publicNote;
419  std::string m_officerNote;
420 
421  std::set<uint32> m_trackedCriteriaIds;
422 
423  int32 m_bankWithdraw[GUILD_BANK_MAX_TABS + 1];
429  };
430 
431  // Base class for event entries
432  class LogEntry
433  {
434  public:
435  LogEntry(ObjectGuid::LowType guildId, uint32 guid) : m_guildId(guildId), m_guid(guid), m_timestamp(::time(NULL)) { }
436  LogEntry(ObjectGuid::LowType guildId, uint32 guid, time_t timestamp) : m_guildId(guildId), m_guid(guid), m_timestamp(timestamp) { }
437  virtual ~LogEntry() { }
438 
439  uint32 GetGUID() const { return m_guid; }
440  uint64 GetTimestamp() const { return m_timestamp; }
441 
442  virtual void SaveToDB(SQLTransaction& trans) const = 0;
443 
444  protected:
448  };
449 
450  // Event log entry
451  class EventLogEntry : public LogEntry
452  {
453  public:
454  EventLogEntry(ObjectGuid::LowType guildId, uint32 guid, GuildEventLogTypes eventType, ObjectGuid::LowType playerGuid1, ObjectGuid::LowType playerGuid2, uint8 newRank) :
455  LogEntry(guildId, guid), m_eventType(eventType), m_playerGuid1(playerGuid1), m_playerGuid2(playerGuid2), m_newRank(newRank) { }
456 
457  EventLogEntry(ObjectGuid::LowType guildId, uint32 guid, time_t timestamp, GuildEventLogTypes eventType, ObjectGuid::LowType playerGuid1, ObjectGuid::LowType playerGuid2, uint8 newRank) :
458  LogEntry(guildId, guid, timestamp), m_eventType(eventType), m_playerGuid1(playerGuid1), m_playerGuid2(playerGuid2), m_newRank(newRank) { }
459 
461 
462  void SaveToDB(SQLTransaction& trans) const override;
463  void WritePacket(WorldPackets::Guild::GuildEventLogQueryResults& packet) const;
464 
465  private:
470  };
471 
472  // Bank event log entry
474  {
475  public:
476  static bool IsMoneyEvent(GuildBankEventLogTypes eventType)
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  }
484 
485  bool IsMoneyEvent() const
486  {
487  return IsMoneyEvent(m_eventType);
488  }
489 
490  BankEventLogEntry(ObjectGuid::LowType guildId, uint32 guid, GuildBankEventLogTypes eventType, uint8 tabId, ObjectGuid::LowType playerGuid, uint64 itemOrMoney, uint16 itemStackCount, uint8 destTabId) :
491  LogEntry(guildId, guid), m_eventType(eventType), m_bankTabId(tabId), m_playerGuid(playerGuid),
492  m_itemOrMoney(itemOrMoney), m_itemStackCount(itemStackCount), m_destTabId(destTabId) { }
493 
494  BankEventLogEntry(ObjectGuid::LowType guildId, uint32 guid, time_t timestamp, uint8 tabId, GuildBankEventLogTypes eventType, ObjectGuid::LowType playerGuid, uint64 itemOrMoney, uint16 itemStackCount, uint8 destTabId) :
495  LogEntry(guildId, guid, timestamp), m_eventType(eventType), m_bankTabId(tabId), m_playerGuid(playerGuid),
496  m_itemOrMoney(itemOrMoney), m_itemStackCount(itemStackCount), m_destTabId(destTabId) { }
497 
499 
500  void SaveToDB(SQLTransaction& trans) const override;
501  void WritePacket(WorldPackets::Guild::GuildBankLogQueryResults& packet) const;
502 
503  private:
510  };
511 
512  // News log entry
513  class NewsLogEntry : public LogEntry
514  {
515  public:
517  LogEntry(guildId, guid), m_type(type), m_playerGuid(playerGuid), m_flags(flags), m_value(value) { }
518 
519  NewsLogEntry(ObjectGuid::LowType guildId, uint32 guid, time_t timestamp, GuildNews type, ObjectGuid playerGuid, uint32 flags, uint32 value) :
520  LogEntry(guildId, guid, timestamp), m_type(type), m_playerGuid(playerGuid), m_flags(flags), m_value(value) { }
521 
523 
524  GuildNews GetType() const { return m_type; }
525  ObjectGuid GetPlayerGuid() const { return m_playerGuid; }
526  uint32 GetValue() const { return m_value; }
527  uint32 GetFlags() const { return m_flags; }
528  void SetSticky(bool sticky)
529  {
530  if (sticky)
531  m_flags |= 1;
532  else
533  m_flags &= ~1;
534  }
535 
536  void SaveToDB(SQLTransaction& trans) const override;
537  void WritePacket(WorldPackets::Guild::GuildNews& newsPacket) const;
538 
539  private:
544  };
545 
546  // Class encapsulating work with events collection
547  typedef std::list<LogEntry*> GuildLog;
548 
549  class LogHolder
550  {
551  public:
552  LogHolder(uint32 maxRecords) : m_maxRecords(maxRecords), m_nextGUID(uint32(GUILD_EVENT_LOG_GUID_UNDEFINED)) { }
553  ~LogHolder();
554 
555  uint8 GetSize() const { return uint8(m_log.size()); }
556  // Checks if new log entry can be added to holder when loading from DB
557  inline bool CanInsert() const { return m_log.size() < m_maxRecords; }
558  // Adds event from DB to collection
559  void LoadEvent(LogEntry* entry);
560  // Adds new event to collection and saves it to DB
561  void AddEvent(SQLTransaction& trans, LogEntry* entry);
562  uint32 GetNextGUID();
563  GuildLog* GetGuildLog() { return &m_log; }
564 
565  private:
566  GuildLog m_log;
569  };
570 
571  // Class encapsulating guild rank data
572  class RankInfo
573  {
574  public:
575  RankInfo(): m_guildId(UI64LIT(0)), m_rankId(GUILD_RANK_NONE), m_rights(GR_RIGHT_NONE), m_bankMoneyPerDay(0) { }
576  RankInfo(ObjectGuid::LowType guildId) : m_guildId(guildId), m_rankId(GUILD_RANK_NONE), m_rights(GR_RIGHT_NONE), m_bankMoneyPerDay(0) { }
577  RankInfo(ObjectGuid::LowType guildId, uint8 rankId, std::string const& name, uint32 rights, uint32 money) :
578  m_guildId(guildId), m_rankId(rankId), m_name(name), m_rights(rights),
579  m_bankMoneyPerDay(rankId != GR_GUILDMASTER ? money : GUILD_WITHDRAW_MONEY_UNLIMITED) { }
580 
581  void LoadFromDB(Field* fields);
582  void SaveToDB(SQLTransaction& trans) const;
583 
584  uint8 GetId() const { return m_rankId; }
585 
586  std::string const& GetName() const { return m_name; }
587  void SetName(std::string const& name);
588 
589  uint32 GetRights() const { return m_rights; }
590  void SetRights(uint32 rights);
591 
592  int32 GetBankMoneyPerDay() const { return m_bankMoneyPerDay; }
593 
594  void SetBankMoneyPerDay(uint32 money);
595 
596  inline int8 GetBankTabRights(uint8 tabId) const
597  {
598  return tabId < GUILD_BANK_MAX_TABS ? m_bankTabRightsAndSlots[tabId].GetRights() : 0;
599  }
600 
601  inline int32 GetBankTabSlotsPerDay(uint8 tabId) const
602  {
603  return tabId < GUILD_BANK_MAX_TABS ? m_bankTabRightsAndSlots[tabId].GetSlots() : 0;
604  }
605 
606  void SetBankTabSlotsAndRights(GuildBankRightsAndSlots rightsAndSlots, bool saveToDB);
607  void CreateMissingTabsIfNeeded(uint8 ranks, SQLTransaction& trans, bool logOnCreate = false);
608 
609  private:
612  std::string m_name;
616  };
617 
618  class BankTab
619  {
620  public:
621  BankTab(ObjectGuid::LowType guildId, uint8 tabId) : m_guildId(guildId), m_tabId(tabId)
622  {
623  memset(m_items, 0, GUILD_BANK_MAX_SLOTS * sizeof(Item*));
624  }
625 
626  void LoadFromDB(Field* fields);
627  bool LoadItemFromDB(Field* fields);
628  void Delete(SQLTransaction& trans, bool removeItemsFromDB = false);
629 
630  void WritePacket(WorldPacket& data) const;
631  bool WriteSlotPacket(WorldPacket& data, uint8 slotId, bool ignoreEmpty = true) const;
632  void WriteInfoPacket(WorldPacket& data) const
633  {
634  data << m_name;
635  data << m_icon;
636  }
637 
638  void SetInfo(std::string const& name, std::string const& icon);
639  void SetText(std::string const& text);
640  void SendText(Guild const* guild, WorldSession* session) const;
641 
642  std::string const& GetName() const { return m_name; }
643  std::string const& GetIcon() const { return m_icon; }
644  std::string const& GetText() const { return m_text; }
645 
646  inline Item* GetItem(uint8 slotId) const { return slotId < GUILD_BANK_MAX_SLOTS ? m_items[slotId] : NULL; }
647  bool SetItem(SQLTransaction& trans, uint8 slotId, Item* item);
648 
649  private:
652 
654  std::string m_name;
655  std::string m_icon;
656  std::string m_text;
657  };
658 
659  // Movement data
661  {
662  public:
663  MoveItemData(Guild* guild, Player* player, uint8 container, uint8 slotId) : m_pGuild(guild), m_pPlayer(player),
664  m_container(container), m_slotId(slotId), m_pItem(NULL), m_pClonedItem(NULL) { }
665  virtual ~MoveItemData() { }
666 
667  virtual bool IsBank() const = 0;
668  // Initializes item pointer. Returns true, if item exists, false otherwise.
669  virtual bool InitItem() = 0;
670  // Checks splited amount against item. Splited amount cannot be more that number of items in stack.
671  virtual bool CheckItem(uint32& splitedAmount);
672  // Defines if player has rights to save item in container
673  virtual bool HasStoreRights(MoveItemData* /*pOther*/) const { return true; }
674  // Defines if player has rights to withdraw item from container
675  virtual bool HasWithdrawRights(MoveItemData* /*pOther*/) const { return true; }
676  // Checks if container can store specified item
677  bool CanStore(Item* pItem, bool swap, bool sendError);
678  // Clones stored item
679  bool CloneItem(uint32 count);
680  // Remove item from container (if splited update items fields)
681  virtual void RemoveItem(SQLTransaction& trans, MoveItemData* pOther, uint32 splitedAmount = 0) = 0;
682  // Saves item to container
683  virtual Item* StoreItem(SQLTransaction& trans, Item* pItem) = 0;
684  // Log bank event
685  virtual void LogBankEvent(SQLTransaction& trans, MoveItemData* pFrom, uint32 count) const = 0;
686  // Log GM action
687  virtual void LogAction(MoveItemData* pFrom) const;
688  // Copy slots id from position vector
689  void CopySlots(SlotIds& ids) const;
690 
691  Item* GetItem(bool isCloned = false) const { return isCloned ? m_pClonedItem : m_pItem; }
692  uint8 GetContainer() const { return m_container; }
693  uint8 GetSlotId() const { return m_slotId; }
694 
695  protected:
696  virtual InventoryResult CanStore(Item* pItem, bool swap) = 0;
697 
704  ItemPosCountVec m_vec;
705  };
706 
708  {
709  public:
710  PlayerMoveItemData(Guild* guild, Player* player, uint8 container, uint8 slotId) :
711  MoveItemData(guild, player, container, slotId) { }
712 
713  bool IsBank() const override { return false; }
714  bool InitItem() override;
715  void RemoveItem(SQLTransaction& trans, MoveItemData* pOther, uint32 splitedAmount = 0) override;
716  Item* StoreItem(SQLTransaction& trans, Item* pItem) override;
717  void LogBankEvent(SQLTransaction& trans, MoveItemData* pFrom, uint32 count) const override;
718  protected:
719  InventoryResult CanStore(Item* pItem, bool swap) override;
720  };
721 
723  {
724  public:
725  BankMoveItemData(Guild* guild, Player* player, uint8 container, uint8 slotId) :
726  MoveItemData(guild, player, container, slotId) { }
727 
728  bool IsBank() const override { return true; }
729  bool InitItem() override;
730  bool HasStoreRights(MoveItemData* pOther) const override;
731  bool HasWithdrawRights(MoveItemData* pOther) const override;
732  void RemoveItem(SQLTransaction& trans, MoveItemData* pOther, uint32 splitedAmount) override;
733  Item* StoreItem(SQLTransaction& trans, Item* pItem) override;
734  void LogBankEvent(SQLTransaction& trans, MoveItemData* pFrom, uint32 count) const override;
735  void LogAction(MoveItemData* pFrom) const override;
736 
737  protected:
738  InventoryResult CanStore(Item* pItem, bool swap) override;
739 
740  private:
741  Item* _StoreItem(SQLTransaction& trans, BankTab* pTab, Item* pItem, ItemPosCount& pos, bool clone) const;
742  bool _ReserveSpace(uint8 slotId, Item* pItem, Item* pItemDest, uint32& count);
743  void CanStoreItemInTab(Item* pItem, uint8 skipSlotId, bool merge, uint32& count);
744  };
745 
746  typedef std::unordered_map<ObjectGuid, Member*> Members;
747  typedef std::vector<RankInfo> Ranks;
748  typedef std::vector<BankTab*> BankTabs;
749 
750 public:
751  static void SendCommandResult(WorldSession* session, GuildCommandType type, GuildCommandError errCode, std::string const& param = "");
752  static void SendSaveEmblemResult(WorldSession* session, GuildEmblemError errCode);
753 
754  Guild();
755  ~Guild();
756 
757  bool Create(Player* pLeader, std::string const& name);
758  void Disband();
759 
760  void SaveToDB();
761 
762  // Getters
763  ObjectGuid::LowType GetId() const { return m_id; }
764  ObjectGuid GetGUID() const { return ObjectGuid::Create<HighGuid::Guild>(m_id); }
765  ObjectGuid GetLeaderGUID() const { return m_leaderGuid; }
766  std::string const& GetName() const { return m_name; }
767  std::string const& GetMOTD() const { return m_motd; }
768  std::string const& GetInfo() const { return m_info; }
769  time_t GetCreatedDate() const { return m_createdDate; }
770  uint64 GetBankMoney() const { return m_bankMoney; }
771 
772  bool SetName(std::string const& name);
773 
774  // Handle client commands
775  void HandleRoster(WorldSession* session);
776  void SendQueryResponse(WorldSession* session);
777  void HandleSetAchievementTracking(WorldSession* session, std::set<uint32> const& achievementIds);
778  void HandleSetMOTD(WorldSession* session, std::string const& motd);
779  void HandleSetInfo(WorldSession* session, std::string const& info);
780  void HandleSetEmblem(WorldSession* session, const EmblemInfo& emblemInfo);
781  void HandleSetNewGuildMaster(WorldSession* session, std::string const& name);
782  void HandleSetBankTabInfo(WorldSession* session, uint8 tabId, std::string const& name, std::string const& icon);
783  void HandleSetMemberNote(WorldSession* session, std::string const& note, ObjectGuid guid, bool isPublic);
784  void HandleSetRankInfo(WorldSession* session, uint8 rankId, std::string const& name, uint32 rights, uint32 moneyPerDay, GuildBankRightsAndSlotsVec const& rightsAndSlots);
785  void HandleBuyBankTab(WorldSession* session, uint8 tabId);
786  void HandleInviteMember(WorldSession* session, std::string const& name);
787  void HandleAcceptMember(WorldSession* session);
788  void HandleLeaveMember(WorldSession* session);
789  void HandleRemoveMember(WorldSession* session, ObjectGuid guid);
790  void HandleUpdateMemberRank(WorldSession* session, ObjectGuid guid, bool demote);
791  void HandleSetMemberRank(WorldSession* session, ObjectGuid guid, ObjectGuid setterGuid, uint32 rank);
792  void HandleAddNewRank(WorldSession* session, std::string const& name);
793  void HandleRemoveRank(WorldSession* session, uint8 rankId);
794  void HandleMemberDepositMoney(WorldSession* session, uint64 amount, bool cashFlow = false);
795  bool HandleMemberWithdrawMoney(WorldSession* session, uint64 amount, bool repair = false);
796  void HandleMemberLogout(WorldSession* session);
797  void HandleDelete(WorldSession* session);
798  void HandleGuildPartyRequest(WorldSession* session);
799  void HandleNewsSetSticky(WorldSession* session, uint32 newsId, bool sticky);
800  void HandleGuildRequestChallengeUpdate(WorldSession* session);
801 
802  void UpdateMemberData(Player* player, uint8 dataid, uint32 value);
803  void OnPlayerStatusChange(Player* player, uint32 flag, bool state);
804 
805  // Send info to client
806  void SendGuildRankInfo(WorldSession* session) const;
807  void SendEventLog(WorldSession* session) const;
808  void SendBankLog(WorldSession* session, uint8 tabId) const;
809  void SendBankList(WorldSession* session, uint8 tabId, bool fullUpdate) const;
810  void SendBankTabText(WorldSession* session, uint8 tabId) const;
811  void SendPermissions(WorldSession* session) const;
812  void SendMoneyInfo(WorldSession* session) const;
813  void SendLoginInfo(WorldSession* session);
814  void SendNewsUpdate(WorldSession* session);
815 
816  // Send events
817  void SendEventBankMoneyChanged();
818  void SendEventMOTD(WorldSession* session, bool broadcast = false);
819  void SendEventNewLeader(Member* newLeader, Member* oldLeader, bool isSelfPromoted = false);
820  void SendEventPlayerLeft(Member* leaver, Member* remover = nullptr, bool isRemoved = false);
821  void SendEventPresenceChanged(WorldSession* session, bool loggedOn, bool broadcast = false);
822 
823  // Load from DB
824  bool LoadFromDB(Field* fields);
825  void LoadGuildNewsLogFromDB(Field* fields);
826  void LoadRankFromDB(Field* fields);
827  bool LoadMemberFromDB(Field* fields);
828  bool LoadEventLogFromDB(Field* fields);
829  void LoadBankRightFromDB(Field* fields);
830  void LoadBankTabFromDB(Field* fields);
831  bool LoadBankEventLogFromDB(Field* fields);
832  bool LoadBankItemFromDB(Field* fields);
833  bool Validate();
834 
835  // Broadcasts
836  void BroadcastToGuild(WorldSession* session, bool officerOnly, std::string const& msg, uint32 language = LANG_UNIVERSAL) const;
837  void BroadcastAddonToGuild(WorldSession* session, bool officerOnly, std::string const& msg, std::string const& prefix) const;
838  void BroadcastPacketToRank(WorldPacket const* packet, uint8 rankId) const;
839  void BroadcastPacket(WorldPacket const* packet) const;
840  void BroadcastPacketIfTrackingAchievement(WorldPacket const* packet, uint32 criteriaId) const;
841 
842  void MassInviteToEvent(WorldSession* session, uint32 minLevel, uint32 maxLevel, uint32 minRank);
843 
844  template<class Do>
845  void BroadcastWorker(Do& _do, Player* except = NULL)
846  {
847  for (Members::iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
848  if (Player* player = itr->second->FindConnectedPlayer())
849  if (player != except)
850  _do(player);
851  }
852 
853  // Members
854  // Adds member to guild. If rankId == GUILD_RANK_NONE, lowest rank is assigned.
855  bool AddMember(ObjectGuid guid, uint8 rankId = GUILD_RANK_NONE);
856  void DeleteMember(ObjectGuid guid, bool isDisbanding = false, bool isKicked = false, bool canDeleteGuild = false);
857  bool ChangeMemberRank(ObjectGuid guid, uint8 newRank);
858  bool IsMember(ObjectGuid guid) const;
859  uint32 GetMembersCount() const { return uint32(m_members.size()); }
860 
861  // Bank
862  void SwapItems(Player* player, uint8 tabId, uint8 slotId, uint8 destTabId, uint8 destSlotId, uint32 splitedAmount);
863  void SwapItemsWithInventory(Player* player, bool toChar, uint8 tabId, uint8 slotId, uint8 playerBag, uint8 playerSlotId, uint32 splitedAmount);
864 
865  // Bank tabs
866  void SetBankTabText(uint8 tabId, std::string const& text);
867 
868  AchievementMgr<Guild>& GetAchievementMgr() { return m_achievementMgr; }
869  AchievementMgr<Guild> const& GetAchievementMgr() const { return m_achievementMgr; }
870 
871  // Guild leveling
872  uint8 GetLevel() const { return _level; }
873 
874  void AddGuildNews(uint8 type, ObjectGuid guid, uint32 flags, uint32 value);
875 
876  EmblemInfo const& GetEmblemInfo() const { return m_emblemInfo; }
877  void ResetTimes(bool weekly);
878 
879  bool HasAchieved(uint32 achievementId) const;
880  void UpdateAchievementCriteria(AchievementCriteriaTypes type, uint64 miscValue1, uint64 miscValue2, uint64 miscValue3, Unit* unit, Player* player);
881 
882 protected:
884  std::string m_name;
886  std::string m_motd;
887  std::string m_info;
889 
893 
894  Ranks m_ranks;
895  Members m_members;
896  BankTabs m_bankTabs;
897 
898  // These are actually ordered lists. The first element is the oldest entry.
900  LogHolder* m_bankEventLog[GUILD_BANK_MAX_TABS + 1];
903 
905 
906 private:
907  inline uint8 _GetRanksSize() const { return uint8(m_ranks.size()); }
908  inline const RankInfo* GetRankInfo(uint8 rankId) const { return rankId < _GetRanksSize() ? &m_ranks[rankId] : NULL; }
909  inline RankInfo* GetRankInfo(uint8 rankId) { return rankId < _GetRanksSize() ? &m_ranks[rankId] : NULL; }
910  inline bool _HasRankRight(Player const* player, uint32 right) const
911  {
912  if (player)
913  if (Member const* member = GetMember(player->GetGUID()))
914  return (_GetRankRights(member->GetRankId()) & right) != GR_RIGHT_NONE;
915  return false;
916  }
917 
918  inline uint8 _GetLowestRankId() const { return uint8(m_ranks.size() - 1); }
919 
920  inline uint8 _GetPurchasedTabsSize() const { return uint8(m_bankTabs.size()); }
921  inline BankTab* GetBankTab(uint8 tabId) { return tabId < m_bankTabs.size() ? m_bankTabs[tabId] : NULL; }
922  inline const BankTab* GetBankTab(uint8 tabId) const { return tabId < m_bankTabs.size() ? m_bankTabs[tabId] : NULL; }
923 
924  inline const Member* GetMember(ObjectGuid guid) const
925  {
926  Members::const_iterator itr = m_members.find(guid);
927  return itr != m_members.end() ? itr->second : NULL;
928  }
929 
931  {
932  Members::iterator itr = m_members.find(guid);
933  return itr != m_members.end() ? itr->second : NULL;
934  }
935 
936  inline Member* GetMember(std::string const& name)
937  {
938  for (Members::iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
939  if (itr->second->GetName() == name)
940  return itr->second;
941 
942  return NULL;
943  }
944 
945  inline void _DeleteMemberFromDB(ObjectGuid::LowType lowguid) const
946  {
948  stmt->setUInt64(0, lowguid);
950  }
951 
952  // Creates log holders (either when loading or when creating guild)
953  void _CreateLogHolders();
954  // Tries to create new bank tab
955  void _CreateNewBankTab();
956  // Creates default guild ranks with names in given locale
957  void _CreateDefaultGuildRanks(LocaleConstant loc);
958  // Creates new rank
959  bool _CreateRank(std::string const& name, uint32 rights);
960  // Update account number when member added/removed from guild
961  void _UpdateAccountsNumber();
962  bool _IsLeader(Player* player) const;
963  void _DeleteBankItems(SQLTransaction& trans, bool removeItemsFromDB = false);
964  bool _ModifyBankMoney(SQLTransaction& trans, uint64 amount, bool add);
965  void _SetLeaderGUID(Member* pLeader);
966 
967  void _SetRankBankMoneyPerDay(uint8 rankId, uint32 moneyPerDay);
968  void _SetRankBankTabRightsAndSlots(uint8 rankId, GuildBankRightsAndSlots rightsAndSlots, bool saveToDB = true);
969  int8 _GetRankBankTabRights(uint8 rankId, uint8 tabId) const;
970  uint32 _GetRankRights(uint8 rankId) const;
971  int32 _GetRankBankMoneyPerDay(uint8 rankId) const;
972  int32 _GetRankBankTabSlotsPerDay(uint8 rankId, uint8 tabId) const;
973  std::string _GetRankName(uint8 rankId) const;
974 
975  int32 _GetMemberRemainingSlots(Member const* member, uint8 tabId) const;
976  int32 _GetMemberRemainingMoney(Member const* member) const;
977  void _UpdateMemberWithdrawSlots(SQLTransaction& trans, ObjectGuid guid, uint8 tabId);
978  bool _MemberHasTabRights(ObjectGuid guid, uint8 tabId, int32 rights) const;
979 
980  void _LogEvent(GuildEventLogTypes eventType, ObjectGuid::LowType playerGuid1, ObjectGuid::LowType playerGuid2 = UI64LIT(0), uint8 newRank = 0);
981  void _LogBankEvent(SQLTransaction& trans, GuildBankEventLogTypes eventType, uint8 tabId, ObjectGuid::LowType playerGuid, uint64 itemOrMoney, uint16 itemStackCount = 0, uint8 destTabId = 0);
982 
983  Item* _GetItem(uint8 tabId, uint8 slotId) const;
984  void _RemoveItem(SQLTransaction& trans, uint8 tabId, uint8 slotId);
985  void _MoveItems(MoveItemData* pSrc, MoveItemData* pDest, uint32 splitedAmount);
986  bool _DoItemsMove(MoveItemData* pSrc, MoveItemData* pDest, bool sendError, uint32 splitedAmount = 0);
987 
988  void _SendBankContentUpdate(MoveItemData* pSrc, MoveItemData* pDest) const;
989  void _SendBankContentUpdate(uint8 tabId, SlotIds slots) const;
990  void SendGuildRanksUpdate(ObjectGuid setterGuid, ObjectGuid targetGuid, uint32 rank);
991 };
992 #endif
uint32 GetRights() const
Definition: Guild.h:589
Definition: Guild.h:66
Definition: Guild.h:186
Definition: Guild.h:99
std::string m_text
Definition: Guild.h:656
Definition: GuildPackets.h:932
Definition: Guild.h:432
ObjectGuid GetLeaderGUID() const
Definition: Guild.h:765
Definition: Guild.h:219
uint32 GetTotalReputation() const
Definition: Guild.h:381
Definition: Guild.h:116
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
uint32 GetZoneId() const
Definition: Guild.h:377
Definition: Guild.h:81
uint32 m_backgroundColor
Definition: Guild.h:285
Definition: Guild.h:82
Definition: Guild.h:473
Definition: Guild.h:218
Definition: Guild.h:192
Definition: Guild.h:241
PetitionSigns
Definition: Guild.h:167
uint32 m_color
Definition: Guild.h:282
PetitionTurns
Definition: Guild.h:158
Definition: Guild.h:175
int8_t int8
Definition: Define.h:148
GuildEventLogTypes
Definition: Guild.h:203
bool CanInsert() const
Definition: Guild.h:557
static void var(TextOutput &t, const std::string &name, const std::string &val)
Definition: System.cpp:1582
Definition: SharedDefines.h:961
Definition: Guild.h:151
const uint32 GuildChallengeMaxLevelGoldReward[GUILD_CHALLENGES_TYPES]
Definition: Guild.h:260
Definition: Guild.h:154
uint16 m_itemStackCount
Definition: Guild.h:508
const BankTab * GetBankTab(uint8 tabId) const
Definition: Guild.h:922
Definition: Guild.h:112
Definition: Guild.h:131
Member * GetMember(ObjectGuid guid)
Definition: Guild.h:930
std::string const & GetIcon() const
Definition: Guild.h:643
AchievementMgr< Guild > m_achievementMgr
Definition: Guild.h:902
BankEventLogEntry(ObjectGuid::LowType guildId, uint32 guid, time_t timestamp, uint8 tabId, GuildBankEventLogTypes eventType, ObjectGuid::LowType playerGuid, uint64 itemOrMoney, uint16 itemStackCount, uint8 destTabId)
Definition: Guild.h:494
Definition: Guild.h:96
BankTabs m_bankTabs
Definition: Guild.h:896
EventLogEntry(ObjectGuid::LowType guildId, uint32 guid, GuildEventLogTypes eventType, ObjectGuid::LowType playerGuid1, ObjectGuid::LowType playerGuid2, uint8 newRank)
Definition: Guild.h:454
uint32 m_accountId
Definition: Guild.h:415
LogHolder * m_eventLog
Definition: Guild.h:899
void SetLevel(uint8 var)
Definition: Guild.h:355
EmblemInfo m_emblemInfo
Definition: Guild.h:890
Definition: Guild.h:85
void AddFlag(uint8 var)
Definition: Guild.h:359
const Member * GetMember(ObjectGuid guid) const
Definition: Guild.h:924
uint8 _GetLowestRankId() const
Definition: Guild.h:918
uint32 m_zoneId
Definition: Guild.h:409
uint32 m_achievementPoints
Definition: Guild.h:424
Definition: Guild.h:451
ObjectGuid m_guid
Definition: Guild.h:407
Member(ObjectGuid::LowType guildId, ObjectGuid guid, uint8 rankId)
Definition: Guild.h:327
Definition: Guild.h:199
Definition: Guild.h:46
std::string m_publicNote
Definition: Guild.h:418
Item * GetItem(bool isCloned=false) const
Definition: Guild.h:691
GuildBankRights
Definition: Guild.h:179
Definition: Guild.h:174
uint64 GetTimestamp() const
Definition: Guild.h:440
bool IsTrackingCriteriaId(uint32 criteriaId) const
Definition: Guild.h:386
const uint32 GuildChallengesMaxCount[GUILD_CHALLENGES_TYPES]
Definition: Guild.h:261
Class used to access individual fields of database query result.
Definition: Field.h:56
int8 GetBankTabRights(uint8 tabId) const
Definition: Guild.h:596
Definition: Guild.h:98
Definition: Guild.h:80
Definition: Guild.h:107
void LoadFromDB()
Definition: AddonMgr.cpp:40
std::string const & GetMOTD() const
Definition: Guild.h:767
Definition: GuildPackets.h:985
ObjectGuid::LowType m_playerGuid1
Definition: Guild.h:467
uint32 GetWeekReputation() const
Definition: Guild.h:382
uint32 m_guid
Definition: Guild.h:446
Definition: Guild.h:229
Definition: Guild.h:228
Definition: Guild.h:549
Definition: Guild.h:193
GuildBankEventLogTypes m_eventType
Definition: Guild.h:504
ObjectGuid::LowType m_guildId
Definition: Guild.h:610
Definition: Guild.h:127
uint32 m_accountsNumber
Definition: Guild.h:891
Definition: Guild.h:113
Definition: Guild.h:95
Definition: Guild.h:53
uint32 m_weekReputation
Definition: Guild.h:428
Definition: Guild.h:148
void SetGuildMasterValues()
Definition: Guild.h:296
Definition: Guild.h:236
Definition: Guild.h:132
PlayerMoveItemData(Guild *guild, Player *player, uint8 container, uint8 slotId)
Definition: Guild.h:710
#define UI64LIT(N)
Definition: Define.h:138
uint64 GetWeekActivity() const
Definition: Guild.h:380
int32 RaceMask
Definition: Guild.h:249
Definition: Guild.h:105
Definition: Guild.h:52
Definition: Guild.h:196
Definition: Guild.h:155
Definition: Guild.h:182
arena_t NULL
Definition: jemalloc_internal.h:624
time_t m_createdDate
Definition: Guild.h:888
RankInfo(ObjectGuid::LowType guildId)
Definition: Guild.h:576
BankTab * GetBankTab(uint8 tabId)
Definition: Guild.h:921
std::string const & GetName() const
Definition: Guild.h:766
uint32 m_nextGUID
Definition: Guild.h:568
Definition: Guild.h:200
EmblemInfo const & GetEmblemInfo() const
Definition: Guild.h:876
void _DeleteMemberFromDB(ObjectGuid::LowType lowguid) const
Definition: Guild.h:945
uint32 GetAchievementPoints() const
Definition: Guild.h:378
uint32 ItemID
Definition: Guild.h:247
Definition: Guild.h:129
bool IsOnline() const
Definition: Guild.h:388
bool IsRank(uint8 rankId) const
Definition: Guild.h:393
Definition: Guild.h:234
uint8 m_newRank
Definition: Guild.h:469
GuildLog * GetGuildLog()
Definition: Guild.h:563
uint32 m_maxRecords
Definition: Guild.h:567
uint64 GetTotalActivity() const
Definition: Guild.h:379
LogEntry(ObjectGuid::LowType guildId, uint32 guid)
Definition: Guild.h:435
Definition: Guild.h:58
void ResetFlags()
Definition: Guild.h:361
Definition: Guild.h:722
int8 rights
Definition: Guild.h:312
Definition: Guild.h:185
Definition: Guild.h:206
Definition: Guild.h:618
Definition: Guild.h:208
uint8 m_level
Definition: Guild.h:410
uint64 Cost
Definition: Guild.h:250
uint32 GetGUID() const
Definition: Guild.h:439
uint32 GetMembersCount() const
Definition: Guild.h:859
std::string const & GetName() const
Definition: Guild.h:642
Definition: Guild.h:161
std::string GetPublicNote() const
Definition: Guild.h:371
Definition: Guild.h:141
uint32 GetFlags() const
Definition: Guild.h:527
Item * m_pItem
Definition: Guild.h:702
uint32 m_totalReputation
Definition: Guild.h:427
uint64 LowType
Definition: ObjectGuid.h:199
Definition: Guild.h:149
ObjectGuid::LowType m_guildId
Definition: Guild.h:650
Definition: Guild.h:324
Definition: CharacterDatabase.h:162
Definition: PreparedStatement.h:74
Definition: Guild.h:240
GuildMemberData
Definition: Guild.h:56
uint8 GetGender() const
Definition: Guild.h:374
Definition: Guild.h:245
Definition: Guild.h:44
GuildBankRightsAndSlots(uint8 _tabId, int8 _rights, int32 _slots)
Definition: Guild.h:294
uint8 GetRankId() const
Definition: Guild.h:369
Definition: Guild.h:191
Definition: Guild.h:143
uint64 GetLogoutTime() const
Definition: Guild.h:370
Definition: Guild.h:207
uint64 m_logoutTime
Definition: Guild.h:414
uint32 m_style
Definition: Guild.h:281
Definition: Guild.h:215
bool IsMoneyEvent() const
Definition: Guild.h:485
Definition: Guild.h:195
uint8 m_rankId
Definition: Guild.h:611
Definition: Guild.h:217
uint8 _GetPurchasedTabsSize() const
Definition: Guild.h:920
Definition: Guild.h:137
ObjectGuid m_leaderGuid
Definition: Guild.h:885
BankEventLogEntry(ObjectGuid::LowType guildId, uint32 guid, GuildBankEventLogTypes eventType, uint8 tabId, ObjectGuid::LowType playerGuid, uint64 itemOrMoney, uint16 itemStackCount, uint8 destTabId)
Definition: Guild.h:490
Definition: Guild.h:94
GuildMemberFlags
Definition: Guild.h:223
std::string const & GetName() const
Definition: Guild.h:367
Definition: Guild.h:205
Definition: Guild.h:145
uint32 GetBorderColor() const
Definition: Guild.h:277
uint8 MinGuildRep
Definition: Guild.h:248
Player * m_pPlayer
Definition: Guild.h:699
~EventLogEntry()
Definition: Guild.h:460
uint8 GetFlags() const
Definition: Guild.h:376
uint32 GetBorderStyle() const
Definition: Guild.h:276
ObjectGuid m_playerGuid
Definition: Guild.h:541
Definition: Guild.h:170
TC_GAME_API Player * FindPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:209
Definition: Guild.h:164
uint32 m_flags
Definition: Guild.h:542
GuildNews
Definition: Guild.h:232
Definition: Guild.h:235
Definition: Guild.h:133
int32 GetBankTabSlotsPerDay(uint8 tabId) const
Definition: Guild.h:601
uint8 m_tabId
Definition: Guild.h:651
RankInfo()
Definition: Guild.h:575
GuildRankRights
Definition: Guild.h:75
Definition: Guild.h:86
Definition: Guild.h:138
AchievementMgr< Guild > const & GetAchievementMgr() const
Definition: Guild.h:869
uint8 GetLevel() const
Definition: Guild.h:872
Definition: Guild.h:47
void SetSlots(int32 _slots)
Definition: Guild.h:303
uint64 GetBankMoney() const
Definition: Guild.h:770
uint8 GetClass() const
Definition: Guild.h:373
Definition: Guild.h:136
time_t GetCreatedDate() const
Definition: Guild.h:769
int8 GetRights() const
Definition: Guild.h:308
std::string m_motd
Definition: Guild.h:886
uint32 m_borderColor
Definition: Guild.h:284
void SetRights(int8 _rights)
Definition: Guild.h:304
uint8 _GetRanksSize() const
Definition: Guild.h:907
bool IsBank() const override
Definition: Guild.h:713
LocaleConstant
Definition: Common.h:115
Definition: Guild.h:176
void RemFlag(uint8 var)
Definition: Guild.h:360
uint8 GetSize() const
Definition: Guild.h:555
uint64 m_weekActivity
Definition: Guild.h:426
GuildDefaultRanks
Definition: Guild.h:63
Definition: Guild.h:88
EventLogEntry(ObjectGuid::LowType guildId, uint32 guid, time_t timestamp, GuildEventLogTypes eventType, ObjectGuid::LowType playerGuid1, ObjectGuid::LowType playerGuid2, uint8 newRank)
Definition: Guild.h:457
LogHolder(uint32 maxRecords)
Definition: Guild.h:552
uint32 GetColor() const
Definition: Guild.h:275
void UpdateLogoutTime()
Definition: Guild.h:392
Definition: Guild.h:67
std::set< uint8 > SlotIds
Definition: Guild.h:318
Definition: Guild.h:153
GuildBankEventLogTypes
Definition: Guild.h:189
std::vector< RankInfo > Ranks
Definition: Guild.h:747
~BankEventLogEntry()
Definition: Guild.h:498
AchievementCriteriaTypes
Definition: DBCEnums.h:196
std::string GetOfficerNote() const
Definition: Guild.h:372
uint32 m_value
Definition: Guild.h:543
Definition: Item.h:259
GuildCommandError
Definition: Guild.h:122
std::string m_icon
Definition: Guild.h:655
Definition: Guild.h:115
Item * m_pClonedItem
Definition: Guild.h:703
std::string const & GetText() const
Definition: Guild.h:644
uint32 m_rights
Definition: Guild.h:613
GuildEventLogTypes m_eventType
Definition: Guild.h:466
Members m_members
Definition: Guild.h:895
int32_t int32
Definition: Define.h:146
Definition: Guild.h:572
Definition: Guild.h:90
Definition: Guild.h:78
Definition: Guild.h:92
Definition: Guild.h:49
uint32_t uint32
Definition: Define.h:150
ObjectGuid::LowType m_playerGuid2
Definition: Guild.h:468
uint8 m_flags
Definition: Guild.h:413
uint8 m_class
Definition: Guild.h:411
void SetZoneId(uint32 id)
Definition: Guild.h:353
Definition: Guild.h:69
Player * FindConnectedPlayer() const
Definition: Guild.h:402
GuildMisc
Definition: Guild.h:42
uint64_t uint64
Definition: Define.h:149
ObjectGuid::LowType m_playerGuid
Definition: Guild.h:506
ObjectGuid::LowType GetId() const
Definition: Guild.h:763
std::string m_name
Definition: Guild.h:884
bool _HasRankRight(Player const *player, uint32 right) const
Definition: Guild.h:910
std::string m_name
Definition: Guild.h:408
uint16_t uint16
Definition: Define.h:151
Definition: Guild.h:130
uint32 GetStyle() const
Definition: Guild.h:274
Definition: Guild.h:169
ObjectGuid GetGUID() const
Definition: Guild.h:764
Definition: Guild.h:171
RankInfo(ObjectGuid::LowType guildId, uint8 rankId, std::string const &name, uint32 rights, uint32 money)
Definition: Guild.h:577
uint8 m_slotId
Definition: Guild.h:701
Definition: Guild.h:225
uint64 m_itemOrMoney
Definition: Guild.h:507
Definition: Guild.h:162
GuildBankRightsAndSlots()
Definition: Guild.h:292
Definition: Guild.h:289
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
void WriteInfoPacket(WorldPacket &data) const
Definition: Guild.h:632
Definition: Guild.h:70
uint8 _gender
Definition: Guild.h:412
int32 GetBankMoneyPerDay() const
Definition: Guild.h:592
Definition: Guild.h:128
std::string const & GetName() const
Definition: Guild.h:586
Definition: Guild.h:173
Definition: Guild.h:227
Definition: Guild.h:144
Definition: Guild.h:163
Item * GetItem(uint8 slotId) const
Definition: Guild.h:646
Definition: Guild.h:152
Ranks m_ranks
Definition: Guild.h:894
uint8 GetSlotId() const
Definition: Guild.h:693
Definition: Guild.h:707
Definition: Guild.h:93
std::unordered_map< ObjectGuid, Member * > Members
Definition: Guild.h:746
Definition: BattlegroundMgr.h:57
Definition: Guild.h:89
Definition: Guild.h:91
Definition: Guild.h:97
AchievementMgr< Guild > & GetAchievementMgr()
Definition: Guild.h:868
GuildNews m_type
Definition: Guild.h:540
EmblemInfo()
Definition: Guild.h:267
ObjectGuid const & GetGUID() const
Definition: Guild.h:366
BankMoveItemData(Guild *guild, Player *player, uint8 container, uint8 slotId)
Definition: Guild.h:725
Definition: Guild.h:139
Member * GetMember(std::string const &name)
Definition: Guild.h:936
void SetSticky(bool sticky)
Definition: Guild.h:528
Definition: Guild.h:142
void SetTrackedCriteriaIds(std::set< uint32 > criteriaIds)
Definition: Guild.h:385
virtual bool HasWithdrawRights(MoveItemData *) const
Definition: Guild.h:675
int32 GetSlots() const
Definition: Guild.h:307
uint8_t uint8
Definition: g3dmath.h:164
ObjectGuid::LowType m_guildId
Definition: Guild.h:445
Definition: Guild.h:60
Definition: Guild.h:110
std::vector< GuildBankRightsAndSlots > GuildBankRightsAndSlotsVec
Definition: Guild.h:316
uint32 const MinNewsItemLevel
Definition: Guild.h:254
Definition: Guild.h:237
Definition: Guild.h:209
Definition: Guild.h:109
Definition: Guild.h:197
ItemPosCountVec m_vec
Definition: Guild.h:704
bool IsRankNotLower(uint8 rankId) const
Definition: Guild.h:394
const RankInfo * GetRankInfo(uint8 rankId) const
Definition: Guild.h:908
ObjectGuid::LowType m_id
Definition: Guild.h:883
Definition: Guild.h:660
GuildBankRightsAndSlots(uint8 _tabId)
Definition: Guild.h:293
RankInfo * GetRankInfo(uint8 rankId)
Definition: Guild.h:909
Definition: Guild.h:134
GuildLog m_log
Definition: Guild.h:566
Definition: Guild.h:108
uint8 m_destTabId
Definition: Guild.h:509
void BroadcastWorker(Do &_do, Player *except=NULL)
Definition: Guild.h:845
uint8 GetContainer() const
Definition: Guild.h:692
uint8 GetLevel() const
Definition: Guild.h:375
NewsLogEntry(ObjectGuid::LowType guildId, uint32 guid, GuildNews type, ObjectGuid playerGuid, uint32 flags, uint32 value)
Definition: Guild.h:516
Definition: Guild.h:77
virtual bool HasStoreRights(MoveItemData *) const
Definition: Guild.h:673
static bool IsMoneyEvent(GuildBankEventLogTypes eventType)
Definition: Guild.h:476
Definition: Guild.h:84
#define TC_GAME_API
Definition: Define.h:134
Definition: Guild.h:117
#define GUILD_CHALLENGES_TYPES
Definition: Guild.h:257
LogEntry(ObjectGuid::LowType guildId, uint32 guid, time_t timestamp)
Definition: Guild.h:436
Definition: Guild.h:150
std::set< uint32 > GetTrackedCriteriaIds() const
Definition: Guild.h:384
std::string m_name
Definition: Guild.h:612
uint32 m_borderStyle
Definition: Guild.h:283
Definition: Guild.h:104
Definition: Guild.h:79
Definition: Guild.h:114
ObjectGuid::LowType m_guildId
Definition: Guild.h:405
Definition: Guild.h:140
int32_t int32
Definition: g3dmath.h:167
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
uint32 m_bankMoneyPerDay
Definition: Guild.h:614
virtual ~LogEntry()
Definition: Guild.h:437
~NewsLogEntry()
Definition: Guild.h:522
Definition: Guild.h:181
uint8 m_container
Definition: Guild.h:700
virtual ~MoveItemData()
Definition: Guild.h:665
uint8_t uint8
Definition: Define.h:152
Definition: Guild.h:226
Definition: Guild.h:238
Definition: Guild.h:183
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
uint8 GetId() const
Definition: Guild.h:584
Player * FindPlayer() const
Definition: Guild.h:401
Definition: Guild.h:68
NewsLogEntry(ObjectGuid::LowType guildId, uint32 guid, time_t timestamp, GuildNews type, ObjectGuid playerGuid, uint32 flags, uint32 value)
Definition: Guild.h:519
Definition: Guild.h:51
Definition: Guild.h:50
const FieldDescriptor value
Definition: descriptor.h:1522
Definition: Guild.h:111
Definition: Guild.h:198
GuildNews GetType() const
Definition: Guild.h:524
uint64 m_bankMoney
Definition: Guild.h:892
bool IsBank() const override
Definition: Guild.h:728
std::vector< BankTab * > BankTabs
Definition: Guild.h:748
Definition: Guild.h:210
uint64 m_timestamp
Definition: Guild.h:447
Player session in the World.
Definition: WorldSession.h:882
Definition: ObjectGuid.h:189
uint64 m_totalActivity
Definition: Guild.h:425
uint32_t uint32
Definition: g3dmath.h:168
uint8 flags
Definition: DisableMgr.cpp:44
Definition: Guild.h:194
const uint32 GuildChallengeGoldReward[GUILD_CHALLENGES_TYPES]
Definition: Guild.h:259
Definition: Guild.h:220
GuildCommandType
Definition: Guild.h:102
GuildEmblemError
Definition: Guild.h:213
uint8 _level
Definition: Guild.h:904
Definition: GuildPackets.h:866
std::string m_name
Definition: Guild.h:654
std::list< LogEntry * > GuildLog
Definition: Guild.h:547
InventoryResult
Definition: Item.h:46
Definition: Guild.h:106
std::string m_officerNote
Definition: Guild.h:419
std::vector< uint32 > AchievementsRequired
Definition: Guild.h:251
std::set< uint32 > m_trackedCriteriaIds
Definition: Guild.h:421
uint32 GetBackgroundColor() const
Definition: Guild.h:278
Definition: Guild.h:126
int8 GetTabId() const
Definition: Guild.h:306
Definition: Guild.h:160
Definition: Guild.h:146
Definition: Guild.h:48
LogHolder * m_newsLog
Definition: Guild.h:901
void SetTabId(uint8 _tabId)
Definition: Guild.h:302
Definition: Guild.h:239
Definition: Guild.h:320
std::string m_info
Definition: Guild.h:887
Definition: Unit.h:1305
Definition: Guild.h:124
uint32 GetAccountId() const
Definition: Guild.h:368
void SetAchievementPoints(uint32 val)
Definition: Guild.h:354
Definition: Guild.h:45
Definition: Guild.h:135
Guild * m_pGuild
Definition: Guild.h:698
Definition: Guild.h:87
uint32 GetValue() const
Definition: Guild.h:526
Definition: Guild.h:264
TC_GAME_API Player * FindConnectedPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:215
Definition: Guild.h:119
Definition: Guild.h:513
std::string const & GetInfo() const
Definition: Guild.h:768
uint8 m_bankTabId
Definition: Guild.h:505
Definition: WorldPacket.h:26
Definition: Guild.h:172
Definition: Guild.h:83
Definition: Guild.h:118
bool IsSamePlayer(ObjectGuid guid) const
Definition: Guild.h:395
Definition: Guild.h:242
MoveItemData(Guild *guild, Player *player, uint8 container, uint8 slotId)
Definition: Guild.h:663
int32 slots
Definition: Guild.h:313
Definition: Guild.h:125
BankTab(ObjectGuid::LowType guildId, uint8 tabId)
Definition: Guild.h:621
uint8 m_rankId
Definition: Guild.h:417
uint8 tabId
Definition: Guild.h:311
ObjectGuid GetPlayerGuid() const
Definition: Guild.h:525
std::shared_ptr< Transaction > SQLTransaction
Definition: Transaction.h:58
Definition: Guild.h:147