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

#include <Guild.h>

Classes

class  BankEventLogEntry
 
class  BankMoveItemData
 
class  BankTab
 
class  EventLogEntry
 
class  LogEntry
 
class  LogHolder
 
class  Member
 
class  MoveItemData
 
class  NewsLogEntry
 
class  PlayerMoveItemData
 
class  RankInfo
 

Public Member Functions

 Guild ()
 
 ~Guild ()
 
bool Create (Player *pLeader, std::string const &name)
 
void Disband ()
 
void SaveToDB ()
 
ObjectGuid::LowType GetId () const
 
ObjectGuid GetGUID () const
 
ObjectGuid GetLeaderGUID () const
 
std::string constGetName () const
 
std::string constGetMOTD () const
 
std::string constGetInfo () const
 
time_t GetCreatedDate () const
 
uint64 GetBankMoney () const
 
bool SetName (std::string const &name)
 
void HandleRoster (WorldSession *session)
 
void SendQueryResponse (WorldSession *session)
 
void HandleSetAchievementTracking (WorldSession *session, std::set< uint32 > const &achievementIds)
 
void HandleSetMOTD (WorldSession *session, std::string const &motd)
 
void HandleSetInfo (WorldSession *session, std::string const &info)
 
void HandleSetEmblem (WorldSession *session, const EmblemInfo &emblemInfo)
 
void HandleSetNewGuildMaster (WorldSession *session, std::string const &name)
 
void HandleSetBankTabInfo (WorldSession *session, uint8 tabId, std::string const &name, std::string const &icon)
 
void HandleSetMemberNote (WorldSession *session, std::string const &note, ObjectGuid guid, bool isPublic)
 
void HandleSetRankInfo (WorldSession *session, uint8 rankId, std::string const &name, uint32 rights, uint32 moneyPerDay, GuildBankRightsAndSlotsVec const &rightsAndSlots)
 
void HandleBuyBankTab (WorldSession *session, uint8 tabId)
 
void HandleInviteMember (WorldSession *session, std::string const &name)
 
void HandleAcceptMember (WorldSession *session)
 
void HandleLeaveMember (WorldSession *session)
 
void HandleRemoveMember (WorldSession *session, ObjectGuid guid)
 
void HandleUpdateMemberRank (WorldSession *session, ObjectGuid guid, bool demote)
 
void HandleSetMemberRank (WorldSession *session, ObjectGuid guid, ObjectGuid setterGuid, uint32 rank)
 
void HandleAddNewRank (WorldSession *session, std::string const &name)
 
void HandleRemoveRank (WorldSession *session, uint8 rankId)
 
void HandleMemberDepositMoney (WorldSession *session, uint64 amount, bool cashFlow=false)
 
bool HandleMemberWithdrawMoney (WorldSession *session, uint64 amount, bool repair=false)
 
void HandleMemberLogout (WorldSession *session)
 
void HandleDelete (WorldSession *session)
 
void HandleGuildPartyRequest (WorldSession *session)
 
void HandleNewsSetSticky (WorldSession *session, uint32 newsId, bool sticky)
 
void HandleGuildRequestChallengeUpdate (WorldSession *session)
 
void UpdateMemberData (Player *player, uint8 dataid, uint32 value)
 
void OnPlayerStatusChange (Player *player, uint32 flag, bool state)
 
void SendGuildRankInfo (WorldSession *session) const
 
void SendEventLog (WorldSession *session) const
 
void SendBankLog (WorldSession *session, uint8 tabId) const
 
void SendBankList (WorldSession *session, uint8 tabId, bool fullUpdate) const
 
void SendBankTabText (WorldSession *session, uint8 tabId) const
 
void SendPermissions (WorldSession *session) const
 
void SendMoneyInfo (WorldSession *session) const
 
void SendLoginInfo (WorldSession *session)
 
void SendNewsUpdate (WorldSession *session)
 
void SendEventBankMoneyChanged ()
 
void SendEventMOTD (WorldSession *session, bool broadcast=false)
 
void SendEventNewLeader (Member *newLeader, Member *oldLeader, bool isSelfPromoted=false)
 
void SendEventPlayerLeft (Member *leaver, Member *remover=nullptr, bool isRemoved=false)
 
void SendEventPresenceChanged (WorldSession *session, bool loggedOn, bool broadcast=false)
 
bool LoadFromDB (Field *fields)
 
void LoadGuildNewsLogFromDB (Field *fields)
 
void LoadRankFromDB (Field *fields)
 
bool LoadMemberFromDB (Field *fields)
 
bool LoadEventLogFromDB (Field *fields)
 
void LoadBankRightFromDB (Field *fields)
 
void LoadBankTabFromDB (Field *fields)
 
bool LoadBankEventLogFromDB (Field *fields)
 
bool LoadBankItemFromDB (Field *fields)
 
bool Validate ()
 
void BroadcastToGuild (WorldSession *session, bool officerOnly, std::string const &msg, uint32 language=LANG_UNIVERSAL) const
 
void BroadcastAddonToGuild (WorldSession *session, bool officerOnly, std::string const &msg, std::string const &prefix) const
 
void BroadcastPacketToRank (WorldPacket const *packet, uint8 rankId) const
 
void BroadcastPacket (WorldPacket const *packet) const
 
void BroadcastPacketIfTrackingAchievement (WorldPacket const *packet, uint32 criteriaId) const
 
void MassInviteToEvent (WorldSession *session, uint32 minLevel, uint32 maxLevel, uint32 minRank)
 
template<class Do >
void BroadcastWorker (Do &_do, Player *except=NULL)
 
bool AddMember (ObjectGuid guid, uint8 rankId=GUILD_RANK_NONE)
 
void DeleteMember (ObjectGuid guid, bool isDisbanding=false, bool isKicked=false, bool canDeleteGuild=false)
 
bool ChangeMemberRank (ObjectGuid guid, uint8 newRank)
 
bool IsMember (ObjectGuid guid) const
 
uint32 GetMembersCount () const
 
void SwapItems (Player *player, uint8 tabId, uint8 slotId, uint8 destTabId, uint8 destSlotId, uint32 splitedAmount)
 
void SwapItemsWithInventory (Player *player, bool toChar, uint8 tabId, uint8 slotId, uint8 playerBag, uint8 playerSlotId, uint32 splitedAmount)
 
void SetBankTabText (uint8 tabId, std::string const &text)
 
AchievementMgr< Guild > & GetAchievementMgr ()
 
AchievementMgr< Guild > constGetAchievementMgr () const
 
uint8 GetLevel () const
 
void AddGuildNews (uint8 type, ObjectGuid guid, uint32 flags, uint32 value)
 
EmblemInfo constGetEmblemInfo () const
 
void ResetTimes (bool weekly)
 
bool HasAchieved (uint32 achievementId) const
 
void UpdateAchievementCriteria (AchievementCriteriaTypes type, uint64 miscValue1, uint64 miscValue2, uint64 miscValue3, Unit *unit, Player *player)
 

Static Public Member Functions

static void SendCommandResult (WorldSession *session, GuildCommandType type, GuildCommandError errCode, std::string const &param="")
 
static void SendSaveEmblemResult (WorldSession *session, GuildEmblemError errCode)
 

Protected Attributes

ObjectGuid::LowType m_id
 
std::string m_name
 
ObjectGuid m_leaderGuid
 
std::string m_motd
 
std::string m_info
 
time_t m_createdDate
 
EmblemInfo m_emblemInfo
 
uint32 m_accountsNumber
 
uint64 m_bankMoney
 
Ranks m_ranks
 
Members m_members
 
BankTabs m_bankTabs
 
LogHolderm_eventLog
 
LogHolderm_bankEventLog [GUILD_BANK_MAX_TABS+1]
 
LogHolderm_newsLog
 
AchievementMgr< Guildm_achievementMgr
 
uint8 _level
 

Private Types

typedef std::list< LogEntry * > GuildLog
 
typedef std::unordered_map
< ObjectGuid, Member * > 
Members
 
typedef std::vector< RankInfoRanks
 
typedef std::vector< BankTab * > BankTabs
 

Private Member Functions

uint8 _GetRanksSize () const
 
const RankInfoGetRankInfo (uint8 rankId) const
 
RankInfoGetRankInfo (uint8 rankId)
 
bool _HasRankRight (Player const *player, uint32 right) const
 
uint8 _GetLowestRankId () const
 
uint8 _GetPurchasedTabsSize () const
 
BankTabGetBankTab (uint8 tabId)
 
const BankTabGetBankTab (uint8 tabId) const
 
const MemberGetMember (ObjectGuid guid) const
 
MemberGetMember (ObjectGuid guid)
 
MemberGetMember (std::string const &name)
 
void _DeleteMemberFromDB (ObjectGuid::LowType lowguid) const
 
void _CreateLogHolders ()
 
void _CreateNewBankTab ()
 
void _CreateDefaultGuildRanks (LocaleConstant loc)
 
bool _CreateRank (std::string const &name, uint32 rights)
 
void _UpdateAccountsNumber ()
 
bool _IsLeader (Player *player) const
 
void _DeleteBankItems (SQLTransaction &trans, bool removeItemsFromDB=false)
 
bool _ModifyBankMoney (SQLTransaction &trans, uint64 amount, bool add)
 
void _SetLeaderGUID (Member *pLeader)
 
void _SetRankBankMoneyPerDay (uint8 rankId, uint32 moneyPerDay)
 
void _SetRankBankTabRightsAndSlots (uint8 rankId, GuildBankRightsAndSlots rightsAndSlots, bool saveToDB=true)
 
int8 _GetRankBankTabRights (uint8 rankId, uint8 tabId) const
 
uint32 _GetRankRights (uint8 rankId) const
 
int32 _GetRankBankMoneyPerDay (uint8 rankId) const
 
int32 _GetRankBankTabSlotsPerDay (uint8 rankId, uint8 tabId) const
 
std::string _GetRankName (uint8 rankId) const
 
int32 _GetMemberRemainingSlots (Member const *member, uint8 tabId) const
 
int32 _GetMemberRemainingMoney (Member const *member) const
 
void _UpdateMemberWithdrawSlots (SQLTransaction &trans, ObjectGuid guid, uint8 tabId)
 
bool _MemberHasTabRights (ObjectGuid guid, uint8 tabId, int32 rights) const
 
void _LogEvent (GuildEventLogTypes eventType, ObjectGuid::LowType playerGuid1, ObjectGuid::LowType playerGuid2=UI64LIT(0), uint8 newRank=0)
 
void _LogBankEvent (SQLTransaction &trans, GuildBankEventLogTypes eventType, uint8 tabId, ObjectGuid::LowType playerGuid, uint64 itemOrMoney, uint16 itemStackCount=0, uint8 destTabId=0)
 
Item_GetItem (uint8 tabId, uint8 slotId) const
 
void _RemoveItem (SQLTransaction &trans, uint8 tabId, uint8 slotId)
 
void _MoveItems (MoveItemData *pSrc, MoveItemData *pDest, uint32 splitedAmount)
 
bool _DoItemsMove (MoveItemData *pSrc, MoveItemData *pDest, bool sendError, uint32 splitedAmount=0)
 
void _SendBankContentUpdate (MoveItemData *pSrc, MoveItemData *pDest) const
 
void _SendBankContentUpdate (uint8 tabId, SlotIds slots) const
 
void SendGuildRanksUpdate (ObjectGuid setterGuid, ObjectGuid targetGuid, uint32 rank)
 

Member Typedef Documentation

typedef std::vector<BankTab*> Guild::BankTabs
private
typedef std::list<LogEntry*> Guild::GuildLog
private
typedef std::unordered_map<ObjectGuid, Member*> Guild::Members
private
typedef std::vector<RankInfo> Guild::Ranks
private

Constructor & Destructor Documentation

Guild::Guild ( )
1039  :
1040  m_id(UI64LIT(0)),
1041  m_leaderGuid(),
1042  m_createdDate(0),
1043  m_accountsNumber(0),
1044  m_bankMoney(0),
1045  m_eventLog(NULL),
1046  m_newsLog(NULL),
1047  m_achievementMgr(this),
1048  _level(1)
1049 {
1050  memset(&m_bankEventLog, 0, (GUILD_BANK_MAX_TABS + 1) * sizeof(LogHolder*));
1051 }
AchievementMgr< Guild > m_achievementMgr
Definition: Guild.h:902
LogHolder * m_eventLog
Definition: Guild.h:899
LogHolder * m_bankEventLog[GUILD_BANK_MAX_TABS+1]
Definition: Guild.h:900
uint32 m_accountsNumber
Definition: Guild.h:891
#define UI64LIT(N)
Definition: Define.h:138
arena_t NULL
Definition: jemalloc_internal.h:624
time_t m_createdDate
Definition: Guild.h:888
Definition: Guild.h:44
ObjectGuid m_leaderGuid
Definition: Guild.h:885
ObjectGuid::LowType m_id
Definition: Guild.h:883
uint64 m_bankMoney
Definition: Guild.h:892
uint8 _level
Definition: Guild.h:904
LogHolder * m_newsLog
Definition: Guild.h:901
Guild::~Guild ( )
1054 {
1055  SQLTransaction temp(NULL);
1056  _DeleteBankItems(temp);
1057 
1058  // Cleanup
1059  delete m_eventLog;
1060  m_eventLog = NULL;
1061  delete m_newsLog;
1062  m_newsLog = NULL;
1063 
1064  for (uint8 tabId = 0; tabId <= GUILD_BANK_MAX_TABS; ++tabId)
1065  {
1066  delete m_bankEventLog[tabId];
1067  m_bankEventLog[tabId] = NULL;
1068  }
1069 
1070  for (Members::iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
1071  {
1072  delete itr->second;
1073  itr->second = NULL;
1074  }
1075 }
LogHolder * m_eventLog
Definition: Guild.h:899
LogHolder * m_bankEventLog[GUILD_BANK_MAX_TABS+1]
Definition: Guild.h:900
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: Guild.h:44
Members m_members
Definition: Guild.h:895
uint8_t uint8
Definition: Define.h:152
LogHolder * m_newsLog
Definition: Guild.h:901
void _DeleteBankItems(SQLTransaction &trans, bool removeItemsFromDB=false)
Definition: Guild.cpp:2859
std::shared_ptr< Transaction > SQLTransaction
Definition: Transaction.h:58

+ Here is the call graph for this function:

Member Function Documentation

void Guild::_CreateDefaultGuildRanks ( LocaleConstant  loc)
private
2801 {
2803  stmt->setUInt64(0, m_id);
2804  CharacterDatabase.Execute(stmt);
2805 
2807  stmt->setUInt64(0, m_id);
2808  CharacterDatabase.Execute(stmt);
2809 
2810  _CreateRank(sObjectMgr->GetTrinityString(LANG_GUILD_MASTER, loc), GR_RIGHT_ALL);
2811  _CreateRank(sObjectMgr->GetTrinityString(LANG_GUILD_OFFICER, loc), GR_RIGHT_ALL);
2815 }
Definition: Guild.h:99
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
Definition: CharacterDatabase.h:175
#define sObjectMgr
Definition: ObjectMgr.h:1567
Definition: PreparedStatement.h:74
Definition: Language.h:779
Definition: Guild.h:78
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
Definition: Language.h:780
ObjectGuid::LowType m_id
Definition: Guild.h:883
bool _CreateRank(std::string const &name, uint32 rights)
Definition: Guild.cpp:2817
Definition: Language.h:781
Definition: Language.h:778
Definition: Guild.h:79
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
Definition: Language.h:782
Definition: CharacterDatabase.h:165

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Guild::_CreateLogHolders ( )
private
2769 {
2770  m_eventLog = new LogHolder(sWorld->getIntConfig(CONFIG_GUILD_EVENT_LOG_COUNT));
2771  m_newsLog = new LogHolder(sWorld->getIntConfig(CONFIG_GUILD_NEWS_LOG_COUNT));
2772  for (uint8 tabId = 0; tabId <= GUILD_BANK_MAX_TABS; ++tabId)
2773  m_bankEventLog[tabId] = new LogHolder(sWorld->getIntConfig(CONFIG_GUILD_BANK_EVENT_LOG_COUNT));
2774 }
Definition: World.h:327
LogHolder * m_eventLog
Definition: Guild.h:899
LogHolder * m_bankEventLog[GUILD_BANK_MAX_TABS+1]
Definition: Guild.h:900
#define sWorld
Definition: World.h:887
Definition: World.h:326
Definition: Guild.h:44
Definition: World.h:328
uint8_t uint8
Definition: Define.h:152
LogHolder * m_newsLog
Definition: Guild.h:901

+ Here is the caller graph for this function:

void Guild::_CreateNewBankTab ( )
private
2777 {
2778  uint8 tabId = _GetPurchasedTabsSize(); // Next free id
2779  m_bankTabs.push_back(new BankTab(m_id, tabId));
2780 
2782 
2784  stmt->setUInt64(0, m_id);
2785  stmt->setUInt8 (1, tabId);
2786  trans->Append(stmt);
2787 
2789  stmt->setUInt64(0, m_id);
2790  stmt->setUInt8 (1, tabId);
2791  trans->Append(stmt);
2792 
2793  ++tabId;
2794  for (Ranks::iterator itr = m_ranks.begin(); itr != m_ranks.end(); ++itr)
2795  (*itr).CreateMissingTabsIfNeeded(tabId, trans, false);
2796 
2798 }
BankTabs m_bankTabs
Definition: Guild.h:896
void setUInt8(const uint8 index, const uint8 value)
Definition: PreparedStatement.cpp:97
SQLTransaction BeginTransaction()
Begins an automanaged transaction pointer that will automatically rollback if not commited...
Definition: DatabaseWorkerPool.h:221
Definition: PreparedStatement.h:74
Definition: CharacterDatabase.h:167
void CommitTransaction(SQLTransaction transaction)
Definition: DatabaseWorkerPool.cpp:179
uint8 _GetPurchasedTabsSize() const
Definition: Guild.h:920
Definition: CharacterDatabase.h:168
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
Ranks m_ranks
Definition: Guild.h:894
ObjectGuid::LowType m_id
Definition: Guild.h:883
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
std::shared_ptr< Transaction > SQLTransaction
Definition: Transaction.h:58

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Guild::_CreateRank ( std::string const name,
uint32  rights 
)
private
2818 {
2819  uint8 newRankId = _GetRanksSize();
2820  if (newRankId >= GUILD_RANKS_MAX_COUNT)
2821  return false;
2822 
2823  // Ranks represent sequence 0, 1, 2, ... where 0 means guildmaster
2824  RankInfo info(m_id, newRankId, name, rights, 0);
2825  m_ranks.push_back(info);
2826 
2828  info.CreateMissingTabsIfNeeded(_GetPurchasedTabsSize(), trans);
2829  info.SaveToDB(trans);
2831 
2832  return true;
2833 }
SQLTransaction BeginTransaction()
Begins an automanaged transaction pointer that will automatically rollback if not commited...
Definition: DatabaseWorkerPool.h:221
void CommitTransaction(SQLTransaction transaction)
Definition: DatabaseWorkerPool.cpp:179
uint8 _GetPurchasedTabsSize() const
Definition: Guild.h:920
uint8 _GetRanksSize() const
Definition: Guild.h:907
Ranks m_ranks
Definition: Guild.h:894
ObjectGuid::LowType m_id
Definition: Guild.h:883
uint8_t uint8
Definition: Define.h:152
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
Definition: Guild.h:48
std::shared_ptr< Transaction > SQLTransaction
Definition: Transaction.h:58

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Guild::_DeleteBankItems ( SQLTransaction trans,
bool  removeItemsFromDB = false 
)
private
2860 {
2861  for (uint8 tabId = 0; tabId < _GetPurchasedTabsSize(); ++tabId)
2862  {
2863  m_bankTabs[tabId]->Delete(trans, removeItemsFromDB);
2864  delete m_bankTabs[tabId];
2865  m_bankTabs[tabId] = NULL;
2866  }
2867  m_bankTabs.clear();
2868 }
BankTabs m_bankTabs
Definition: Guild.h:896
arena_t NULL
Definition: jemalloc_internal.h:624
uint8 _GetPurchasedTabsSize() const
Definition: Guild.h:920
uint8_t uint8
Definition: Define.h:152

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Guild::_DeleteMemberFromDB ( ObjectGuid::LowType  lowguid) const
inlineprivate
946  {
948  stmt->setUInt64(0, lowguid);
950  }
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
Definition: CharacterDatabase.h:162
Definition: PreparedStatement.h:74
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
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:

+ Here is the caller graph for this function:

bool Guild::_DoItemsMove ( MoveItemData pSrc,
MoveItemData pDest,
bool  sendError,
uint32  splitedAmount = 0 
)
private
3119 {
3120  Item* pDestItem = pDest->GetItem();
3121  bool swap = (pDestItem != NULL);
3122 
3123  Item* pSrcItem = pSrc->GetItem(splitedAmount != 0);
3124  // 1. Can store source item in destination
3125  if (!pDest->CanStore(pSrcItem, swap, sendError))
3126  return false;
3127 
3128  // 2. Can store destination item in source
3129  if (swap)
3130  if (!pSrc->CanStore(pDestItem, true, true))
3131  return false;
3132 
3133  // GM LOG (@todo move to scripts)
3134  pDest->LogAction(pSrc);
3135  if (swap)
3136  pSrc->LogAction(pDest);
3137 
3139  // 3. Log bank events
3140  pDest->LogBankEvent(trans, pSrc, pSrcItem->GetCount());
3141  if (swap)
3142  pSrc->LogBankEvent(trans, pDest, pDestItem->GetCount());
3143 
3144  // 4. Remove item from source
3145  pSrc->RemoveItem(trans, pDest, splitedAmount);
3146 
3147  // 5. Remove item from destination
3148  if (swap)
3149  pDest->RemoveItem(trans, pSrc);
3150 
3151  // 6. Store item in destination
3152  pDest->StoreItem(trans, pSrcItem);
3153 
3154  // 7. Store item in source
3155  if (swap)
3156  pSrc->StoreItem(trans, pDestItem);
3157 
3159  return true;
3160 }
uint32 GetCount() const
Definition: Item.h:322
SQLTransaction BeginTransaction()
Begins an automanaged transaction pointer that will automatically rollback if not commited...
Definition: DatabaseWorkerPool.h:221
arena_t NULL
Definition: jemalloc_internal.h:624
void CommitTransaction(SQLTransaction transaction)
Definition: DatabaseWorkerPool.cpp:179
Definition: Item.h:259
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
std::shared_ptr< Transaction > SQLTransaction
Definition: Transaction.h:58

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Item * Guild::_GetItem ( uint8  tabId,
uint8  slotId 
) const
inlineprivate
3045 {
3046  if (const BankTab* tab = GetBankTab(tabId))
3047  return tab->GetItem(slotId);
3048  return NULL;
3049 }
arena_t NULL
Definition: jemalloc_internal.h:624
BankTab * GetBankTab(uint8 tabId)
Definition: Guild.h:921

+ Here is the call graph for this function:

uint8 Guild::_GetLowestRankId ( ) const
inlineprivate
918 { return uint8(m_ranks.size() - 1); }
Ranks m_ranks
Definition: Guild.h:894
uint8_t uint8
Definition: g3dmath.h:164

+ Here is the caller graph for this function:

int32 Guild::_GetMemberRemainingMoney ( Member const member) const
inlineprivate
2972 {
2973  if (member)
2974  {
2975  uint8 rankId = member->GetRankId();
2976  if (rankId == GR_GUILDMASTER)
2977  return static_cast<int32>(GUILD_WITHDRAW_MONEY_UNLIMITED);
2978 
2980  {
2981  int32 remaining = _GetRankBankMoneyPerDay(rankId) - member->GetBankWithdrawValue(GUILD_BANK_MAX_TABS);
2982  if (remaining > 0)
2983  return remaining;
2984  }
2985  }
2986  return 0;
2987 }
Definition: Guild.h:66
Definition: Guild.h:96
Definition: Guild.h:44
uint32 _GetRankRights(uint8 rankId) const
Definition: Guild.cpp:2925
int32_t int32
Definition: Define.h:146
Definition: Guild.h:97
int32 _GetRankBankMoneyPerDay(uint8 rankId) const
Definition: Guild.cpp:2932
uint8_t uint8
Definition: Define.h:152
Definition: Guild.h:50

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int32 Guild::_GetMemberRemainingSlots ( Member const member,
uint8  tabId 
) const
inlineprivate
2955 {
2956  if (member)
2957  {
2958  uint8 rankId = member->GetRankId();
2959  if (rankId == GR_GUILDMASTER)
2960  return static_cast<int32>(GUILD_WITHDRAW_SLOT_UNLIMITED);
2961  if ((_GetRankBankTabRights(rankId, tabId) & GUILD_BANK_RIGHT_VIEW_TAB) != 0)
2962  {
2963  int32 remaining = _GetRankBankTabSlotsPerDay(rankId, tabId) - member->GetBankWithdrawValue(tabId);
2964  if (remaining > 0)
2965  return remaining;
2966  }
2967  }
2968  return 0;
2969 }
Definition: Guild.h:66
int32 _GetRankBankTabSlotsPerDay(uint8 rankId, uint8 tabId) const
Definition: Guild.cpp:2939
int8 _GetRankBankTabRights(uint8 rankId, uint8 tabId) const
Definition: Guild.cpp:2947
int32_t int32
Definition: Define.h:146
Definition: Guild.h:181
uint8_t uint8
Definition: Define.h:152
Definition: Guild.h:51

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint8 Guild::_GetPurchasedTabsSize ( ) const
inlineprivate
920 { return uint8(m_bankTabs.size()); }
BankTabs m_bankTabs
Definition: Guild.h:896
uint8_t uint8
Definition: g3dmath.h:164

+ Here is the caller graph for this function:

int32 Guild::_GetRankBankMoneyPerDay ( uint8  rankId) const
inlineprivate
2933 {
2934  if (const RankInfo* rankInfo = GetRankInfo(rankId))
2935  return rankInfo->GetBankMoneyPerDay();
2936  return 0;
2937 }
const RankInfo * GetRankInfo(uint8 rankId) const
Definition: Guild.h:908

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int8 Guild::_GetRankBankTabRights ( uint8  rankId,
uint8  tabId 
) const
inlineprivate
2948 {
2949  if (const RankInfo* rankInfo = GetRankInfo(rankId))
2950  return rankInfo->GetBankTabRights(tabId);
2951  return 0;
2952 }
const RankInfo * GetRankInfo(uint8 rankId) const
Definition: Guild.h:908

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int32 Guild::_GetRankBankTabSlotsPerDay ( uint8  rankId,
uint8  tabId 
) const
inlineprivate
2940 {
2941  if (tabId < _GetPurchasedTabsSize())
2942  if (const RankInfo* rankInfo = GetRankInfo(rankId))
2943  return rankInfo->GetBankTabSlotsPerDay(tabId);
2944  return 0;
2945 }
uint8 _GetPurchasedTabsSize() const
Definition: Guild.h:920
const RankInfo * GetRankInfo(uint8 rankId) const
Definition: Guild.h:908

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::string Guild::_GetRankName ( uint8  rankId) const
inlineprivate
2919 {
2920  if (const RankInfo* rankInfo = GetRankInfo(rankId))
2921  return rankInfo->GetName();
2922  return "<unknown>";
2923 }
const RankInfo * GetRankInfo(uint8 rankId) const
Definition: Guild.h:908

+ Here is the call graph for this function:

uint32 Guild::_GetRankRights ( uint8  rankId) const
inlineprivate
2926 {
2927  if (const RankInfo* rankInfo = GetRankInfo(rankId))
2928  return rankInfo->GetRights();
2929  return 0;
2930 }
const RankInfo * GetRankInfo(uint8 rankId) const
Definition: Guild.h:908

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint8 Guild::_GetRanksSize ( ) const
inlineprivate
907 { return uint8(m_ranks.size()); }
Ranks m_ranks
Definition: Guild.h:894
uint8_t uint8
Definition: g3dmath.h:164

+ Here is the caller graph for this function:

bool Guild::_HasRankRight ( Player const player,
uint32  right 
) const
inlineprivate
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  }
const Member * GetMember(ObjectGuid guid) const
Definition: Guild.h:924
uint32 _GetRankRights(uint8 rankId) const
Definition: Guild.cpp:2925
Definition: Guild.h:77

+ Here is the caller graph for this function:

bool Guild::_IsLeader ( Player player) const
private
2851 {
2852  if (player->GetGUID() == m_leaderGuid)
2853  return true;
2854  if (const Member* member = GetMember(player->GetGUID()))
2855  return member->IsRank(GR_GUILDMASTER);
2856  return false;
2857 }
Definition: Guild.h:66
const Member * GetMember(ObjectGuid guid) const
Definition: Guild.h:924
ObjectGuid m_leaderGuid
Definition: Guild.h:885

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Guild::_LogBankEvent ( SQLTransaction trans,
GuildBankEventLogTypes  eventType,
uint8  tabId,
ObjectGuid::LowType  playerGuid,
uint64  itemOrMoney,
uint16  itemStackCount = 0,
uint8  destTabId = 0 
)
private
3024 {
3025  if (tabId > GUILD_BANK_MAX_TABS)
3026  return;
3027 
3028  // not logging moves within the same tab
3029  if (eventType == GUILD_BANK_LOG_MOVE_ITEM && tabId == destTabId)
3030  return;
3031 
3032  uint8 dbTabId = tabId;
3033  if (BankEventLogEntry::IsMoneyEvent(eventType))
3034  {
3035  tabId = GUILD_BANK_MAX_TABS;
3036  dbTabId = GUILD_BANK_MONEY_LOGS_TAB;
3037  }
3038  LogHolder* pLog = m_bankEventLog[tabId];
3039  pLog->AddEvent(trans, new BankEventLogEntry(m_id, pLog->GetNextGUID(), eventType, dbTabId, lowguid, itemOrMoney, itemStackCount, destTabId));
3040 
3041  sScriptMgr->OnGuildBankEvent(this, uint8(eventType), tabId, lowguid, itemOrMoney, itemStackCount, destTabId);
3042 }
LogHolder * m_bankEventLog[GUILD_BANK_MAX_TABS+1]
Definition: Guild.h:900
Definition: Guild.h:46
Definition: Guild.h:193
Definition: Guild.h:44
bool IsMoneyEvent() const
Definition: Guild.h:485
uint8_t uint8
Definition: g3dmath.h:164
ObjectGuid::LowType m_id
Definition: Guild.h:883
uint8_t uint8
Definition: Define.h:152
#define sScriptMgr
Definition: ScriptMgr.h:837
void AddEvent(SQLTransaction &trans, LogEntry *entry)
Definition: Guild.cpp:92

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Guild::_LogEvent ( GuildEventLogTypes  eventType,
ObjectGuid::LowType  playerGuid1,
ObjectGuid::LowType  playerGuid2 = UI64LIT(0),
uint8  newRank = 0 
)
inlineprivate
3014 {
3016  m_eventLog->AddEvent(trans, new EventLogEntry(m_id, m_eventLog->GetNextGUID(), eventType, playerGuid1, playerGuid2, newRank));
3018 
3019  sScriptMgr->OnGuildEvent(this, uint8(eventType), playerGuid1, playerGuid2, newRank);
3020 }
LogHolder * m_eventLog
Definition: Guild.h:899
SQLTransaction BeginTransaction()
Begins an automanaged transaction pointer that will automatically rollback if not commited...
Definition: DatabaseWorkerPool.h:221
void CommitTransaction(SQLTransaction transaction)
Definition: DatabaseWorkerPool.cpp:179
uint32 GetNextGUID()
Definition: Guild.cpp:107
uint8_t uint8
Definition: g3dmath.h:164
ObjectGuid::LowType m_id
Definition: Guild.h:883
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
#define sScriptMgr
Definition: ScriptMgr.h:837
void AddEvent(SQLTransaction &trans, LogEntry *entry)
Definition: Guild.cpp:92
std::shared_ptr< Transaction > SQLTransaction
Definition: Transaction.h:58

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Guild::_MemberHasTabRights ( ObjectGuid  guid,
uint8  tabId,
int32  rights 
) const
inlineprivate
3001 {
3002  if (const Member* member = GetMember(guid))
3003  {
3004  // Leader always has full rights
3005  if (member->IsRank(GR_GUILDMASTER) || m_leaderGuid == guid)
3006  return true;
3007  return (_GetRankBankTabRights(member->GetRankId(), tabId) & rights) == rights;
3008  }
3009  return false;
3010 }
Definition: Guild.h:66
const Member * GetMember(ObjectGuid guid) const
Definition: Guild.h:924
int8 _GetRankBankTabRights(uint8 rankId, uint8 tabId) const
Definition: Guild.cpp:2947
ObjectGuid m_leaderGuid
Definition: Guild.h:885

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Guild::_ModifyBankMoney ( SQLTransaction trans,
uint64  amount,
bool  add 
)
private
2871 {
2872  if (add)
2873  m_bankMoney += amount;
2874  else
2875  {
2876  // Check if there is enough money in bank.
2877  if (m_bankMoney < amount)
2878  return false;
2879  m_bankMoney -= amount;
2880  }
2881 
2883  stmt->setUInt64(0, m_bankMoney);
2884  stmt->setUInt64(1, m_id);
2885  trans->Append(stmt);
2886  return true;
2887 }
Definition: PreparedStatement.h:74
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
ObjectGuid::LowType m_id
Definition: Guild.h:883
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
uint64 m_bankMoney
Definition: Guild.h:892
Definition: CharacterDatabase.h:193

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Guild::_MoveItems ( MoveItemData pSrc,
MoveItemData pDest,
uint32  splitedAmount 
)
private
3058 {
3059  // 1. Initialize source item
3060  if (!pSrc->InitItem())
3061  return; // No source item
3062 
3063  // 2. Check source item
3064  if (!pSrc->CheckItem(splitedAmount))
3065  return; // Source item or splited amount is invalid
3066  /*
3067  if (pItemSrc->GetCount() == 0)
3068  {
3069  TC_LOG_FATAL("guild", "Guild::SwapItems: Player %s(GUIDLow: %u) tried to move item %u from tab %u slot %u to tab %u slot %u, but item %u has a stack of zero!",
3070  player->GetName(), player->GetGUIDLow(), pItemSrc->GetEntry(), tabId, slotId, destTabId, destSlotId, pItemSrc->GetEntry());
3071  //return; // Commented out for now, uncomment when it's verified that this causes a crash!!
3072  }
3073  // */
3074 
3075  // 3. Check destination rights
3076  if (!pDest->HasStoreRights(pSrc))
3077  return; // Player has no rights to store item in destination
3078 
3079  // 4. Check source withdraw rights
3080  if (!pSrc->HasWithdrawRights(pDest))
3081  return; // Player has no rights to withdraw items from source
3082 
3083  // 5. Check split
3084  if (splitedAmount)
3085  {
3086  // 5.1. Clone source item
3087  if (!pSrc->CloneItem(splitedAmount))
3088  return; // Item could not be cloned
3089 
3090  // 5.2. Move splited item to destination
3091  _DoItemsMove(pSrc, pDest, true, splitedAmount);
3092  }
3093  else // 6. No split
3094  {
3095  // 6.1. Try to merge items in destination (pDest->GetItem() == NULL)
3096  if (!_DoItemsMove(pSrc, pDest, false)) // Item could not be merged
3097  {
3098  // 6.2. Try to swap items
3099  // 6.2.1. Initialize destination item
3100  if (!pDest->InitItem())
3101  return;
3102 
3103  // 6.2.2. Check rights to store item in source (opposite direction)
3104  if (!pSrc->HasStoreRights(pDest))
3105  return; // Player has no rights to store item in source (opposite direction)
3106 
3107  if (!pDest->HasWithdrawRights(pSrc))
3108  return; // Player has no rights to withdraw item from destination (opposite direction)
3109 
3110  // 6.2.3. Swap items (pDest->GetItem() != NULL)
3111  _DoItemsMove(pSrc, pDest, true);
3112  }
3113  }
3114  // 7. Send changes
3115  _SendBankContentUpdate(pSrc, pDest);
3116 }
bool _DoItemsMove(MoveItemData *pSrc, MoveItemData *pDest, bool sendError, uint32 splitedAmount=0)
Definition: Guild.cpp:3118
void _SendBankContentUpdate(MoveItemData *pSrc, MoveItemData *pDest) const
Definition: Guild.cpp:3162

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Guild::_RemoveItem ( SQLTransaction trans,
uint8  tabId,
uint8  slotId 
)
inlineprivate
3052 {
3053  if (BankTab* pTab = GetBankTab(tabId))
3054  pTab->SetItem(trans, slotId, NULL);
3055 }
arena_t NULL
Definition: jemalloc_internal.h:624
BankTab * GetBankTab(uint8 tabId)
Definition: Guild.h:921

+ Here is the call graph for this function:

void Guild::_SendBankContentUpdate ( MoveItemData pSrc,
MoveItemData pDest 
) const
private
3163 {
3164  ASSERT(pSrc->IsBank() || pDest->IsBank());
3165 
3166  uint8 tabId = 0;
3167  SlotIds slots;
3168  if (pSrc->IsBank()) // B ->
3169  {
3170  tabId = pSrc->GetContainer();
3171  slots.insert(pSrc->GetSlotId());
3172  if (pDest->IsBank()) // B -> B
3173  {
3174  // Same tab - add destination slots to collection
3175  if (pDest->GetContainer() == pSrc->GetContainer())
3176  pDest->CopySlots(slots);
3177  else // Different tabs - send second message
3178  {
3179  SlotIds destSlots;
3180  pDest->CopySlots(destSlots);
3181  _SendBankContentUpdate(pDest->GetContainer(), destSlots);
3182  }
3183  }
3184  }
3185  else if (pDest->IsBank()) // C -> B
3186  {
3187  tabId = pDest->GetContainer();
3188  pDest->CopySlots(slots);
3189  }
3190 
3191  _SendBankContentUpdate(tabId, slots);
3192 }
std::set< uint8 > SlotIds
Definition: Guild.h:318
uint8_t uint8
Definition: Define.h:152
#define ASSERT
Definition: Errors.h:55
void _SendBankContentUpdate(MoveItemData *pSrc, MoveItemData *pDest) const
Definition: Guild.cpp:3162

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Guild::_SendBankContentUpdate ( uint8  tabId,
SlotIds  slots 
) const
private
3195 {
3196  if (BankTab const* tab = GetBankTab(tabId))
3197  {
3199  packet.FullUpdate = true; // @todo
3200  packet.Tab = int32(tabId);
3201  packet.Money = m_bankMoney;
3202 
3203  for (SlotIds::const_iterator itr = slots.begin(); itr != slots.end(); ++itr)
3204  {
3205  Item const* tabItem = tab->GetItem(*itr);
3206 
3208 
3209  itemInfo.Slot = int32(*itr);
3210  itemInfo.Item.ItemID = int32(tabItem ? tabItem->GetEntry() : 0);
3211  itemInfo.Count = int32(tabItem ? tabItem->GetCount() : 0);
3212  itemInfo.Charges = int32(tabItem ? abs(tabItem->GetSpellCharges()) : 0);
3213  itemInfo.OnUseEnchantmentID = 0/*int32(tabItem->GetItemSuffixFactor())*/;
3214  itemInfo.Flags = 0;
3215  itemInfo.Locked = false;
3216 
3217  if (tabItem)
3218  {
3219  uint32 enchants = 0;
3220  for (uint32 ench = 0; ench < MAX_ENCHANTMENT_SLOT; ++ench)
3221  if (tabItem->GetEnchantmentId(EnchantmentSlot(ench)))
3222  ++enchants;
3223 
3224  itemInfo.SocketEnchant.reserve(enchants);
3225  for (uint32 ench = 0; ench < MAX_ENCHANTMENT_SLOT; ++ench)
3226  {
3227  if (uint32 enchantId = tabItem->GetEnchantmentId(EnchantmentSlot(ench)))
3228  {
3230  socketEnchant.SocketEnchantID = int32(enchantId);
3231  socketEnchant.SocketIndex = int32(ench);
3232  itemInfo.SocketEnchant.push_back(socketEnchant);
3233  }
3234  }
3235  }
3236 
3237  packet.ItemInfo.push_back(itemInfo);
3238  }
3239 
3240  for (Members::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
3241  if (_MemberHasTabRights(itr->second->GetGUID(), tabId, GUILD_BANK_RIGHT_VIEW_TAB))
3242  if (Player* player = itr->second->FindPlayer())
3243  {
3244  packet.WithdrawalsRemaining = int32(_GetMemberRemainingSlots(itr->second, tabId));
3245  player->GetSession()->SendPacket(packet.Write());
3246  }
3247 
3248  TC_LOG_DEBUG("guild", "WORLD: Sent SMSG_GUILD_BANK_QUERY_RESULTS");
3249  }
3250 }
G3D::Matrix abs(const G3D::Matrix &M)
Definition: Matrix.h:632
WorldPackets::Item::ItemInstance Item
Definition: GuildPackets.h:789
uint32 GetCount() const
Definition: Item.h:322
int32 Charges
Definition: GuildPackets.h:793
int32 GetSpellCharges(uint8 index=0) const
Definition: Item.h:364
Definition: GuildPackets.h:807
int32 OnUseEnchantmentID
Definition: GuildPackets.h:794
std::vector< GuildBankSocketEnchant > SocketEnchant
Definition: GuildPackets.h:797
EnchantmentSlot
Definition: Item.h:172
int32 Count
Definition: GuildPackets.h:791
BankTab * GetBankTab(uint8 tabId)
Definition: Guild.h:921
int32 Flags
Definition: GuildPackets.h:795
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
Definition: Item.h:190
int32 Slot
Definition: GuildPackets.h:790
bool Locked
Definition: GuildPackets.h:796
int32 _GetMemberRemainingSlots(Member const *member, uint8 tabId) const
Definition: Guild.cpp:2954
int32 Tab
Definition: GuildPackets.h:817
WorldPacket const * Write() override
Definition: GuildPackets.cpp:596
Definition: GuildPackets.h:781
Definition: Item.h:259
Members m_members
Definition: Guild.h:895
uint32_t uint32
Definition: Define.h:150
uint64 Money
Definition: GuildPackets.h:818
std::vector< GuildBankItemInfo > ItemInfo
Definition: GuildPackets.h:814
int32_t int32
Definition: g3dmath.h:167
bool _MemberHasTabRights(ObjectGuid guid, uint8 tabId, int32 rights) const
Definition: Guild.cpp:3000
Definition: Guild.h:181
uint32 GetEntry() const
Definition: Object.h:107
uint64 m_bankMoney
Definition: Guild.h:892
uint32 ItemID
Definition: ItemPackets.h:46
bool FullUpdate
Definition: GuildPackets.h:819
int32 WithdrawalsRemaining
Definition: GuildPackets.h:816
uint32 GetEnchantmentId(EnchantmentSlot slot) const
Definition: Item.h:351

+ Here is the call graph for this function:

void Guild::_SetLeaderGUID ( Member pLeader)
private
2890 {
2891  if (!pLeader)
2892  return;
2893 
2894  m_leaderGuid = pLeader->GetGUID();
2895  pLeader->ChangeRank(GR_GUILDMASTER);
2896 
2898  stmt->setUInt64(0, m_leaderGuid.GetCounter());
2899  stmt->setUInt64(1, m_id);
2900  CharacterDatabase.Execute(stmt);
2901 }
Definition: Guild.h:66
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
Definition: PreparedStatement.h:74
ObjectGuid m_leaderGuid
Definition: Guild.h:885
Definition: CharacterDatabase.h:188
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
ObjectGuid::LowType m_id
Definition: Guild.h:883
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
LowType GetCounter() const
Definition: ObjectGuid.h:221

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Guild::_SetRankBankMoneyPerDay ( uint8  rankId,
uint32  moneyPerDay 
)
private
2904 {
2905  if (RankInfo* rankInfo = GetRankInfo(rankId))
2906  rankInfo->SetBankMoneyPerDay(moneyPerDay);
2907 }
const RankInfo * GetRankInfo(uint8 rankId) const
Definition: Guild.h:908

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Guild::_SetRankBankTabRightsAndSlots ( uint8  rankId,
GuildBankRightsAndSlots  rightsAndSlots,
bool  saveToDB = true 
)
private
2910 {
2911  if (rightsAndSlots.GetTabId() >= _GetPurchasedTabsSize())
2912  return;
2913 
2914  if (RankInfo* rankInfo = GetRankInfo(rankId))
2915  rankInfo->SetBankTabSlotsAndRights(rightsAndSlots, saveToDB);
2916 }
uint8 _GetPurchasedTabsSize() const
Definition: Guild.h:920
const RankInfo * GetRankInfo(uint8 rankId) const
Definition: Guild.h:908
int8 GetTabId() const
Definition: Guild.h:306

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Guild::_UpdateAccountsNumber ( )
private
2838 {
2839  // We use a set to be sure each element will be unique
2840  std::set<uint32> accountsIdSet;
2841  for (Members::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
2842  accountsIdSet.insert(itr->second->GetAccountId());
2843 
2844  m_accountsNumber = accountsIdSet.size();
2845 }
uint32 m_accountsNumber
Definition: Guild.h:891
Members m_members
Definition: Guild.h:895

+ Here is the caller graph for this function:

void Guild::_UpdateMemberWithdrawSlots ( SQLTransaction trans,
ObjectGuid  guid,
uint8  tabId 
)
inlineprivate
2990 {
2991  if (Member* member = GetMember(guid))
2992  {
2993  uint8 rankId = member->GetRankId();
2994  if (rankId != GR_GUILDMASTER
2995  && member->GetBankWithdrawValue(tabId) < _GetRankBankTabSlotsPerDay(rankId, tabId))
2996  member->UpdateBankWithdrawValue(trans, tabId, 1);
2997  }
2998 }
Definition: Guild.h:66
int32 _GetRankBankTabSlotsPerDay(uint8 rankId, uint8 tabId) const
Definition: Guild.cpp:2939
const Member * GetMember(ObjectGuid guid) const
Definition: Guild.h:924
uint8_t uint8
Definition: Define.h:152

+ Here is the call graph for this function:

void Guild::AddGuildNews ( uint8  type,
ObjectGuid  guid,
uint32  flags,
uint32  value 
)
3369 {
3370  NewsLogEntry* news = new NewsLogEntry(m_id, m_newsLog->GetNextGUID(), GuildNews(type), guid, flags, value);
3371 
3373  m_newsLog->AddEvent(trans, news);
3375 
3376  WorldPackets::Guild::GuildNews newsPacket;
3377  newsPacket.NewsEvents.reserve(1);
3378  news->WritePacket(newsPacket);
3379  BroadcastPacket(newsPacket.Write());
3380 }
Definition: GuildPackets.h:932
SQLTransaction BeginTransaction()
Begins an automanaged transaction pointer that will automatically rollback if not commited...
Definition: DatabaseWorkerPool.h:221
void BroadcastPacket(WorldPacket const *packet) const
Definition: Guild.cpp:2520
void CommitTransaction(SQLTransaction transaction)
Definition: DatabaseWorkerPool.cpp:179
GuildNews
Definition: Guild.h:232
uint32 GetNextGUID()
Definition: Guild.cpp:107
WorldPacket const * Write() override
Definition: GuildPackets.cpp:763
ObjectGuid::LowType m_id
Definition: Guild.h:883
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
const FieldDescriptor value
Definition: descriptor.h:1522
uint8 flags
Definition: DisableMgr.cpp:44
std::vector< GuildNewsEvent > NewsEvents
Definition: GuildPackets.h:939
LogHolder * m_newsLog
Definition: Guild.h:901
void AddEvent(SQLTransaction &trans, LogEntry *entry)
Definition: Guild.cpp:92
std::shared_ptr< Transaction > SQLTransaction
Definition: Transaction.h:58

+ Here is the call graph for this function:

bool Guild::AddMember ( ObjectGuid  guid,
uint8  rankId = GUILD_RANK_NONE 
)
2561 {
2563  // Player cannot be in guild
2564  if (player)
2565  {
2566  if (player->GetGuildId())
2567  return false;
2568  }
2569  else if (Player::GetGuildIdFromDB(guid))
2570  return false;
2571 
2572  // Remove all player signs from another petitions
2573  // This will be prevent attempt to join many guilds and corrupt guild data integrity
2574  Player::RemovePetitionsAndSigns(guid);
2575 
2576  ObjectGuid::LowType lowguid = guid.GetCounter();
2577 
2578  // If rank was not passed, assign lowest possible rank
2579  if (rankId == GUILD_RANK_NONE)
2580  rankId = _GetLowestRankId();
2581 
2582  Member* member = new Member(m_id, guid, rankId);
2583  std::string name;
2584  if (player)
2585  {
2586  m_members[guid] = member;
2587  player->SetInGuild(m_id);
2588  player->SetGuildIdInvited(UI64LIT(0));
2589  player->SetRank(rankId);
2590  player->SetGuildLevel(GetLevel());
2591  SendLoginInfo(player->GetSession());
2592  name = player->GetName();
2593  }
2594  else
2595  {
2596  member->ResetFlags();
2597 
2598  bool ok = false;
2599  // Player must exist
2601  stmt->setUInt64(0, lowguid);
2602  if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
2603  {
2604  Field* fields = result->Fetch();
2605  name = fields[0].GetString();
2606  member->SetStats(
2607  name,
2608  fields[1].GetUInt8(),
2609  fields[2].GetUInt8(),
2610  fields[3].GetUInt8(),
2611  fields[4].GetUInt16(),
2612  fields[5].GetUInt32(),
2613  0);
2614 
2615  ok = member->CheckStats();
2616  }
2617 
2618  if (!ok)
2619  {
2620  delete member;
2621  return false;
2622  }
2623  m_members[guid] = member;
2624  }
2625 
2626  SQLTransaction trans(NULL);
2627  member->SaveToDB(trans);
2628 
2631 
2632  WorldPackets::Guild::GuildEventPlayerJoined joinNotificationPacket;
2633  joinNotificationPacket.Guid = guid;
2634  joinNotificationPacket.Name = name;
2635  joinNotificationPacket.VirtualRealmAddress = GetVirtualRealmAddress();
2636  BroadcastPacket(joinNotificationPacket.Write());
2637 
2638  sGuildFinderMgr->RemoveAllMembershipRequestsFromPlayer(guid);
2639 
2640  // Call scripts if member was succesfully added (and stored to database)
2641  sScriptMgr->OnGuildAddMember(this, player, rankId);
2642 
2643  return true;
2644 }
uint32 VirtualRealmAddress
Definition: GuildPackets.h:262
std::shared_ptr< PreparedResultSet > PreparedQueryResult
Definition: QueryResult.h:107
uint8 _GetLowestRankId() const
Definition: Guild.h:918
Class used to access individual fields of database query result.
Definition: Field.h:56
#define UI64LIT(N)
Definition: Define.h:138
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: Guild.h:206
void BroadcastPacket(WorldPacket const *packet) const
Definition: Guild.cpp:2520
uint64 LowType
Definition: ObjectGuid.h:199
std::string Name
Definition: GuildPackets.h:261
Definition: PreparedStatement.h:74
uint8 GetLevel() const
Definition: Guild.h:872
Members m_members
Definition: Guild.h:895
Definition: Guild.h:49
Definition: CharacterDatabase.h:198
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
WorldPacket const * Write() override
Definition: GuildPackets.cpp:218
void _LogEvent(GuildEventLogTypes eventType, ObjectGuid::LowType playerGuid1, ObjectGuid::LowType playerGuid2=UI64LIT(0), uint8 newRank=0)
Definition: Guild.cpp:3013
Definition: GuildPackets.h:253
ObjectGuid::LowType m_id
Definition: Guild.h:883
void _UpdateAccountsNumber()
Definition: Guild.cpp:2837
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
uint32 GetVirtualRealmAddress()
Definition: World.cpp:3487
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
#define sScriptMgr
Definition: ScriptMgr.h:837
#define sGuildFinderMgr
Definition: GuildFinderMgr.h:271
ObjectGuid Guid
Definition: GuildPackets.h:260
std::string GetString() const
Definition: Field.h:276
TC_GAME_API Player * FindConnectedPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:215
void SendLoginInfo(WorldSession *session)
Definition: Guild.cpp:2130
LowType GetCounter() const
Definition: ObjectGuid.h:221
std::shared_ptr< Transaction > SQLTransaction
Definition: Transaction.h:58

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Guild::BroadcastAddonToGuild ( WorldSession session,
bool  officerOnly,
std::string const msg,
std::string const prefix 
) const
2497 {
2498  if (session && session->GetPlayer() && _HasRankRight(session->GetPlayer(), officerOnly ? GR_RIGHT_OFFCHATSPEAK : GR_RIGHT_GCHATSPEAK))
2499  {
2500  WorldPackets::Chat::Chat packet;
2501  packet.Initialize(officerOnly ? CHAT_MSG_OFFICER : CHAT_MSG_GUILD, LANG_ADDON, session->GetPlayer(), nullptr, msg, 0, "", DEFAULT_LOCALE, prefix);
2502  WorldPacket const* data = packet.Write();
2503  for (Members::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
2504  if (Player* player = itr->second->FindPlayer())
2505  if (player->GetSession() && _HasRankRight(player, officerOnly ? GR_RIGHT_OFFCHATLISTEN : GR_RIGHT_GCHATLISTEN) &&
2506  !player->GetSocial()->HasIgnore(session->GetPlayer()->GetGUID()) &&
2507  player->GetSession()->IsAddonRegistered(prefix))
2508  player->GetSession()->SendPacket(data);
2509  }
2510 }
Definition: Guild.h:81
Definition: Guild.h:80
Definition: ChatPackets.h:150
Player * GetPlayer() const
Definition: WorldSession.h:927
WorldPacket const * Write() override
Definition: ChatPackets.cpp:162
Definition: SharedDefines.h:4236
void Initialize(ChatMsg chatType, Language language, WorldObject const *sender, WorldObject const *receiver, std::string message, uint32 achievementId=0, std::string channelName="", LocaleConstant locale=DEFAULT_LOCALE, std::string addonPrefix="")
Definition: ChatPackets.cpp:104
Members m_members
Definition: Guild.h:895
Definition: Guild.h:78
bool _HasRankRight(Player const *player, uint32 right) const
Definition: Guild.h:910
Definition: SharedDefines.h:4235
Definition: Guild.h:79
#define DEFAULT_LOCALE
Definition: Common.h:134
Definition: WorldPacket.h:26
Definition: SharedDefines.h:985

+ Here is the call graph for this function:

void Guild::BroadcastPacket ( WorldPacket const packet) const
2521 {
2522  for (Members::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
2523  if (Player* player = itr->second->FindPlayer())
2524  player->GetSession()->SendPacket(packet);
2525 }
Members m_members
Definition: Guild.h:895

+ Here is the caller graph for this function:

void Guild::BroadcastPacketIfTrackingAchievement ( WorldPacket const packet,
uint32  criteriaId 
) const
2528 {
2529  for (Members::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
2530  if (itr->second->IsTrackingCriteriaId(criteriaId))
2531  if (Player* player = itr->second->FindPlayer())
2532  player->GetSession()->SendPacket(packet);
2533 }
Members m_members
Definition: Guild.h:895
void Guild::BroadcastPacketToRank ( WorldPacket const packet,
uint8  rankId 
) const
2513 {
2514  for (Members::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
2515  if (itr->second->IsRank(rankId))
2516  if (Player* player = itr->second->FindConnectedPlayer())
2517  player->GetSession()->SendPacket(packet);
2518 }
Members m_members
Definition: Guild.h:895

+ Here is the caller graph for this function:

void Guild::BroadcastToGuild ( WorldSession session,
bool  officerOnly,
std::string const msg,
uint32  language = LANG_UNIVERSAL 
) const
2482 {
2483  if (session && session->GetPlayer() && _HasRankRight(session->GetPlayer(), officerOnly ? GR_RIGHT_OFFCHATSPEAK : GR_RIGHT_GCHATSPEAK))
2484  {
2485  WorldPackets::Chat::Chat packet;
2486  packet.Initialize(officerOnly ? CHAT_MSG_OFFICER : CHAT_MSG_GUILD, Language(language), session->GetPlayer(), nullptr, msg);
2487  WorldPacket const* data = packet.Write();
2488  for (Members::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
2489  if (Player* player = itr->second->FindConnectedPlayer())
2490  if (player->GetSession() && _HasRankRight(player, officerOnly ? GR_RIGHT_OFFCHATLISTEN : GR_RIGHT_GCHATLISTEN) &&
2491  !player->GetSocial()->HasIgnore(session->GetPlayer()->GetGUID()))
2492  player->GetSession()->SendPacket(data);
2493  }
2494 }
Definition: Guild.h:81
Definition: Guild.h:80
Definition: ChatPackets.h:150
Player * GetPlayer() const
Definition: WorldSession.h:927
WorldPacket const * Write() override
Definition: ChatPackets.cpp:162
Language
Definition: SharedDefines.h:959
Definition: SharedDefines.h:4236
void Initialize(ChatMsg chatType, Language language, WorldObject const *sender, WorldObject const *receiver, std::string message, uint32 achievementId=0, std::string channelName="", LocaleConstant locale=DEFAULT_LOCALE, std::string addonPrefix="")
Definition: ChatPackets.cpp:104
Members m_members
Definition: Guild.h:895
Definition: Guild.h:78
bool _HasRankRight(Player const *player, uint32 right) const
Definition: Guild.h:910
Definition: SharedDefines.h:4235
Definition: Guild.h:79
Definition: WorldPacket.h:26

+ Here is the call graph for this function:

template<class Do >
void Guild::BroadcastWorker ( Do &  _do,
Player except = NULL 
)
inline
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  }
Members m_members
Definition: Guild.h:895
bool Guild::ChangeMemberRank ( ObjectGuid  guid,
uint8  newRank 
)
2709 {
2710  if (newRank <= _GetLowestRankId()) // Validate rank (allow only existing ranks)
2711  if (Member* member = GetMember(guid))
2712  {
2713  member->ChangeRank(newRank);
2714  return true;
2715  }
2716  return false;
2717 }
const Member * GetMember(ObjectGuid guid) const
Definition: Guild.h:924
uint8 _GetLowestRankId() const
Definition: Guild.h:918

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Guild::Create ( Player pLeader,
std::string const name 
)
1079 {
1080  // Check if guild with such name already exists
1081  if (sGuildMgr->GetGuildByName(name))
1082  return false;
1083 
1084  WorldSession* pLeaderSession = pLeader->GetSession();
1085  if (!pLeaderSession)
1086  return false;
1087 
1088  m_id = sGuildMgr->GenerateGuildId();
1089  m_leaderGuid = pLeader->GetGUID();
1090  m_name = name;
1091  m_info = "";
1092  m_motd = "No message set.";
1093  m_bankMoney = 0;
1094  m_createdDate = ::time(NULL);
1095  _level = 1;
1097 
1098  TC_LOG_DEBUG("guild", "GUILD: creating guild [%s] for leader %s (%s)",
1099  name.c_str(), pLeader->GetName().c_str(), m_leaderGuid.ToString().c_str());
1100 
1102 
1104  stmt->setUInt64(0, m_id);
1105  trans->Append(stmt);
1106 
1107  uint8 index = 0;
1109  stmt->setUInt64( index, m_id);
1110  stmt->setString(++index, name);
1111  stmt->setUInt64(++index, m_leaderGuid.GetCounter());
1112  stmt->setString(++index, m_info);
1113  stmt->setString(++index, m_motd);
1114  stmt->setUInt64(++index, uint32(m_createdDate));
1115  stmt->setUInt32(++index, m_emblemInfo.GetStyle());
1116  stmt->setUInt32(++index, m_emblemInfo.GetColor());
1117  stmt->setUInt32(++index, m_emblemInfo.GetBorderStyle());
1118  stmt->setUInt32(++index, m_emblemInfo.GetBorderColor());
1119  stmt->setUInt32(++index, m_emblemInfo.GetBackgroundColor());
1120  stmt->setUInt64(++index, m_bankMoney);
1121  trans->Append(stmt);
1122 
1124  _CreateDefaultGuildRanks(pLeaderSession->GetSessionDbLocaleIndex()); // Create default ranks
1125  bool ret = AddMember(m_leaderGuid, GR_GUILDMASTER); // Add guildmaster
1126 
1127  if (ret)
1128  {
1129  Member* leader = GetMember(m_leaderGuid);
1130  if (leader)
1131  SendEventNewLeader(leader, NULL);
1132 
1133  sScriptMgr->OnGuildCreate(this, pLeader, name);
1134  }
1135 
1136  return ret;
1137 }
Definition: Guild.h:66
Definition: CharacterDatabase.h:158
Definition: CharacterDatabase.h:163
EmblemInfo m_emblemInfo
Definition: Guild.h:890
LocaleConstant GetSessionDbLocaleIndex() const
Definition: WorldSession.h:1060
const Member * GetMember(ObjectGuid guid) const
Definition: Guild.h:924
#define sGuildMgr
Definition: GuildMgr.h:61
SQLTransaction BeginTransaction()
Begins an automanaged transaction pointer that will automatically rollback if not commited...
Definition: DatabaseWorkerPool.h:221
void setString(const uint8 index, const std::string &value)
Definition: PreparedStatement.cpp:187
arena_t NULL
Definition: jemalloc_internal.h:624
time_t m_createdDate
Definition: Guild.h:888
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
Definition: PreparedStatement.h:74
void CommitTransaction(SQLTransaction transaction)
Definition: DatabaseWorkerPool.cpp:179
ObjectGuid m_leaderGuid
Definition: Guild.h:885
uint32 GetBorderColor() const
Definition: Guild.h:277
uint32 GetBorderStyle() const
Definition: Guild.h:276
std::string m_motd
Definition: Guild.h:886
uint32 GetColor() const
Definition: Guild.h:275
void SendEventNewLeader(Member *newLeader, Member *oldLeader, bool isSelfPromoted=false)
Definition: Guild.cpp:2195
std::string m_name
Definition: Guild.h:884
uint32 GetStyle() const
Definition: Guild.h:274
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
bool AddMember(ObjectGuid guid, uint8 rankId=GUILD_RANK_NONE)
Definition: Guild.cpp:2560
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
void _CreateLogHolders()
Definition: Guild.cpp:2768
ObjectGuid::LowType m_id
Definition: Guild.h:883
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 sScriptMgr
Definition: ScriptMgr.h:837
uint64 m_bankMoney
Definition: Guild.h:892
Player session in the World.
Definition: WorldSession.h:882
uint32_t uint32
Definition: g3dmath.h:168
uint8 _level
Definition: Guild.h:904
uint32 GetBackgroundColor() const
Definition: Guild.h:278
std::string m_info
Definition: Guild.h:887
std::string ToString() const
Definition: ObjectGuid.cpp:99
void _CreateDefaultGuildRanks(LocaleConstant loc)
Definition: Guild.cpp:2800
LowType GetCounter() const
Definition: ObjectGuid.h:221
std::shared_ptr< Transaction > SQLTransaction
Definition: Transaction.h:58

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Guild::DeleteMember ( ObjectGuid  guid,
bool  isDisbanding = false,
bool  isKicked = false,
bool  canDeleteGuild = false 
)
2647 {
2648  // Guild master can be deleted when loading guild and guid doesn't exist in characters table
2649  // or when he is removed from guild by gm command
2650  if (m_leaderGuid == guid && !isDisbanding)
2651  {
2652  Member* oldLeader = NULL;
2653  Member* newLeader = NULL;
2654  for (Guild::Members::iterator i = m_members.begin(); i != m_members.end(); ++i)
2655  {
2656  if (i->first == guid)
2657  oldLeader = i->second;
2658  else if (!newLeader || newLeader->GetRankId() > i->second->GetRankId())
2659  newLeader = i->second;
2660  }
2661 
2662  if (!newLeader)
2663  {
2664  Disband();
2665  if (canDeleteGuild)
2666  delete this;
2667  return;
2668  }
2669 
2670  _SetLeaderGUID(newLeader);
2671 
2672  // If player not online data in data field will be loaded from guild tabs no need to update it !!
2673  if (Player* newLeaderPlayer = newLeader->FindPlayer())
2674  newLeaderPlayer->SetRank(GR_GUILDMASTER);
2675 
2676  // If leader does not exist (at guild loading with deleted leader) do not send broadcasts
2677  if (oldLeader)
2678  {
2679  SendEventNewLeader(newLeader, oldLeader, true);
2680  SendEventPlayerLeft(oldLeader);
2681  }
2682  }
2683  // Call script on remove before member is actually removed from guild (and database)
2684  sScriptMgr->OnGuildRemoveMember(this, guid, isDisbanding, isKicked);
2685 
2686  if (Member* member = GetMember(guid))
2687  delete member;
2688  m_members.erase(guid);
2689 
2690  // If player not online data in data field will be loaded from guild tabs no need to update it !!
2692  if (player)
2693  {
2694  player->SetInGuild(UI64LIT(0));
2695  player->SetRank(0);
2696  player->SetGuildLevel(0);
2697 
2698  for (GuildPerkSpellsEntry const* entry : sGuildPerkSpellsStore)
2699  if (entry->GuildLevel <= GetLevel())
2700  player->RemoveSpell(entry->SpellID, false, false);
2701  }
2702 
2704  if (!isDisbanding)
2706 }
Definition: Guild.h:66
const Member * GetMember(ObjectGuid guid) const
Definition: Guild.h:924
#define UI64LIT(N)
Definition: Define.h:138
arena_t NULL
Definition: jemalloc_internal.h:624
void _DeleteMemberFromDB(ObjectGuid::LowType lowguid) const
Definition: Guild.h:945
void Disband()
Definition: Guild.cpp:1140
ObjectGuid m_leaderGuid
Definition: Guild.h:885
uint8 GetLevel() const
Definition: Guild.h:872
Definition: DB2Structure.h:579
Members m_members
Definition: Guild.h:895
void SendEventNewLeader(Member *newLeader, Member *oldLeader, bool isSelfPromoted=false)
Definition: Guild.cpp:2195
void _SetLeaderGUID(Member *pLeader)
Definition: Guild.cpp:2889
DB2Storage< GuildPerkSpellsEntry > sGuildPerkSpellsStore("GuildPerkSpells.db2", GuildPerkSpellsFormat, HOTFIX_SEL_GUILD_PERK_SPELLS)
void _UpdateAccountsNumber()
Definition: Guild.cpp:2837
void SendEventPlayerLeft(Member *leaver, Member *remover=nullptr, bool isRemoved=false)
Definition: Guild.cpp:2216
#define sScriptMgr
Definition: ScriptMgr.h:837
TC_GAME_API Player * FindConnectedPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:215
LowType GetCounter() const
Definition: ObjectGuid.h:221

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Guild::Disband ( )
1141 {
1142  // Call scripts before guild data removed from database
1143  sScriptMgr->OnGuildDisband(this);
1144 
1146  BroadcastPacket(packet.Write());
1147 
1148  // Remove all members
1149  while (!m_members.empty())
1150  {
1151  Members::const_iterator itr = m_members.begin();
1152  DeleteMember(itr->second->GetGUID(), true);
1153  }
1154 
1156 
1158  stmt->setUInt64(0, m_id);
1159  trans->Append(stmt);
1160 
1162  stmt->setUInt64(0, m_id);
1163  trans->Append(stmt);
1164 
1166  stmt->setUInt64(0, m_id);
1167  trans->Append(stmt);
1168 
1169  // Free bank tab used memory and delete items stored in them
1170  _DeleteBankItems(trans, true);
1171 
1173  stmt->setUInt64(0, m_id);
1174  trans->Append(stmt);
1175 
1177  stmt->setUInt64(0, m_id);
1178  trans->Append(stmt);
1179 
1181  stmt->setUInt64(0, m_id);
1182  trans->Append(stmt);
1183 
1185  stmt->setUInt64(0, m_id);
1186  trans->Append(stmt);
1187 
1189 
1190  sGuildFinderMgr->DeleteGuild(GetGUID());
1191 
1192  sGuildMgr->RemoveGuild(m_id);
1193 }
#define sGuildMgr
Definition: GuildMgr.h:61
Definition: CharacterDatabase.h:179
Definition: CharacterDatabase.h:175
SQLTransaction BeginTransaction()
Begins an automanaged transaction pointer that will automatically rollback if not commited...
Definition: DatabaseWorkerPool.h:221
void BroadcastPacket(WorldPacket const *packet) const
Definition: Guild.cpp:2520
Definition: PreparedStatement.h:74
void DeleteMember(ObjectGuid guid, bool isDisbanding=false, bool isKicked=false, bool canDeleteGuild=false)
Definition: Guild.cpp:2646
void CommitTransaction(SQLTransaction transaction)
Definition: DatabaseWorkerPool.cpp:179
Definition: CharacterDatabase.h:159
WorldPacket const * Write() override
Definition: GuildPackets.h:298
Members m_members
Definition: Guild.h:895
Definition: GuildPackets.h:293
Definition: CharacterDatabase.h:169
ObjectGuid GetGUID() const
Definition: Guild.h:764
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
ObjectGuid::LowType m_id
Definition: Guild.h:883
Definition: CharacterDatabase.h:173
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
#define sScriptMgr
Definition: ScriptMgr.h:837
#define sGuildFinderMgr
Definition: GuildFinderMgr.h:271
Definition: CharacterDatabase.h:182
void _DeleteBankItems(SQLTransaction &trans, bool removeItemsFromDB=false)
Definition: Guild.cpp:2859
Definition: CharacterDatabase.h:165
std::shared_ptr< Transaction > SQLTransaction
Definition: Transaction.h:58

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

AchievementMgr<Guild>& Guild::GetAchievementMgr ( )
inline
868 { return m_achievementMgr; }
AchievementMgr< Guild > m_achievementMgr
Definition: Guild.h:902

+ Here is the caller graph for this function:

AchievementMgr<Guild> const& Guild::GetAchievementMgr ( ) const
inline
869 { return m_achievementMgr; }
AchievementMgr< Guild > m_achievementMgr
Definition: Guild.h:902
uint64 Guild::GetBankMoney ( ) const
inline
770 { return m_bankMoney; }
uint64 m_bankMoney
Definition: Guild.h:892

+ Here is the caller graph for this function:

BankTab* Guild::GetBankTab ( uint8  tabId)
inlineprivate
921 { return tabId < m_bankTabs.size() ? m_bankTabs[tabId] : NULL; }
BankTabs m_bankTabs
Definition: Guild.h:896
arena_t NULL
Definition: jemalloc_internal.h:624

+ Here is the caller graph for this function:

const BankTab* Guild::GetBankTab ( uint8  tabId) const
inlineprivate
922 { return tabId < m_bankTabs.size() ? m_bankTabs[tabId] : NULL; }
BankTabs m_bankTabs
Definition: Guild.h:896
arena_t NULL
Definition: jemalloc_internal.h:624
time_t Guild::GetCreatedDate ( ) const
inline
769 { return m_createdDate; }
time_t m_createdDate
Definition: Guild.h:888

+ Here is the caller graph for this function:

EmblemInfo const& Guild::GetEmblemInfo ( ) const
inline
876 { return m_emblemInfo; }
EmblemInfo m_emblemInfo
Definition: Guild.h:890

+ Here is the caller graph for this function:

ObjectGuid Guild::GetGUID ( ) const
inline
764 { return ObjectGuid::Create<HighGuid::Guild>(m_id); }
ObjectGuid::LowType m_id
Definition: Guild.h:883

+ Here is the caller graph for this function:

ObjectGuid::LowType Guild::GetId ( ) const
inline
763 { return m_id; }
ObjectGuid::LowType m_id
Definition: Guild.h:883

+ Here is the caller graph for this function:

std::string const& Guild::GetInfo ( ) const
inline
768 { return m_info; }
std::string m_info
Definition: Guild.h:887

+ Here is the caller graph for this function:

ObjectGuid Guild::GetLeaderGUID ( ) const
inline
765 { return m_leaderGuid; }
ObjectGuid m_leaderGuid
Definition: Guild.h:885

+ Here is the caller graph for this function:

uint8 Guild::GetLevel ( ) const
inline
872 { return _level; }
uint8 _level
Definition: Guild.h:904

+ Here is the caller graph for this function:

const Member* Guild::GetMember ( ObjectGuid  guid) const
inlineprivate
925  {
926  Members::const_iterator itr = m_members.find(guid);
927  return itr != m_members.end() ? itr->second : NULL;
928  }
arena_t NULL
Definition: jemalloc_internal.h:624
Members m_members
Definition: Guild.h:895

+ Here is the caller graph for this function:

Member* Guild::GetMember ( ObjectGuid  guid)
inlineprivate
931  {
932  Members::iterator itr = m_members.find(guid);
933  return itr != m_members.end() ? itr->second : NULL;
934  }
arena_t NULL
Definition: jemalloc_internal.h:624
Members m_members
Definition: Guild.h:895
Member* Guild::GetMember ( std::string const name)
inlineprivate
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  }
arena_t NULL
Definition: jemalloc_internal.h:624
Members m_members
Definition: Guild.h:895
uint32 Guild::GetMembersCount ( ) const
inline
859 { return uint32(m_members.size()); }
Members m_members
Definition: Guild.h:895
uint32_t uint32
Definition: g3dmath.h:168

+ Here is the caller graph for this function:

std::string const& Guild::GetMOTD ( ) const
inline
767 { return m_motd; }
std::string m_motd
Definition: Guild.h:886

+ Here is the caller graph for this function:

std::string const& Guild::GetName ( ) const
inline
766 { return m_name; }
std::string m_name
Definition: Guild.h:884

+ Here is the caller graph for this function:

const RankInfo* Guild::GetRankInfo ( uint8  rankId) const
inlineprivate
908 { return rankId < _GetRanksSize() ? &m_ranks[rankId] : NULL; }
arena_t NULL
Definition: jemalloc_internal.h:624
uint8 _GetRanksSize() const
Definition: Guild.h:907
Ranks m_ranks
Definition: Guild.h:894

+ Here is the caller graph for this function:

RankInfo* Guild::GetRankInfo ( uint8  rankId)
inlineprivate
909 { return rankId < _GetRanksSize() ? &m_ranks[rankId] : NULL; }
arena_t NULL
Definition: jemalloc_internal.h:624
uint8 _GetRanksSize() const
Definition: Guild.h:907
Ranks m_ranks
Definition: Guild.h:894
void Guild::HandleAcceptMember ( WorldSession session)
1671 {
1672  Player* player = session->GetPlayer();
1673  if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) &&
1674  player->GetTeam() != ObjectMgr::GetPlayerTeamByGUID(GetLeaderGUID()))
1675  return;
1676 
1677  AddMember(player->GetGUID());
1678 }
ObjectGuid GetLeaderGUID() const
Definition: Guild.h:765
Player * GetPlayer() const
Definition: WorldSession.h:927
#define sWorld
Definition: World.h:887
bool AddMember(ObjectGuid guid, uint8 rankId=GUILD_RANK_NONE)
Definition: Guild.cpp:2560
static uint32 GetPlayerTeamByGUID(ObjectGuid const &guid)
Definition: ObjectMgr.cpp:2294

+ Here is the call graph for this function:

void Guild::HandleAddNewRank ( WorldSession session,
std::string const name 
)
1837 {
1838  uint8 size = _GetRanksSize();
1839  if (size >= GUILD_RANKS_MAX_COUNT)
1840  return;
1841 
1842  // Only leader can add new rank
1843  if (_IsLeader(session->GetPlayer()))
1844  {
1846  {
1848  BroadcastPacket(eventPacket.Write());
1849  }
1850  }
1851 }
bool _IsLeader(Player *player) const
Definition: Guild.cpp:2850
WorldPacket const * Write() override
Definition: GuildPackets.h:280
Player * GetPlayer() const
Definition: WorldSession.h:927
void BroadcastPacket(WorldPacket const *packet) const
Definition: Guild.cpp:2520
uint8 _GetRanksSize() const
Definition: Guild.h:907
Definition: Guild.h:78
bool _CreateRank(std::string const &name, uint32 rights)
Definition: Guild.cpp:2817
Definition: Guild.h:79
uint8_t uint8
Definition: Define.h:152
Definition: GuildPackets.h:275
Definition: Guild.h:48

+ Here is the call graph for this function:

void Guild::HandleBuyBankTab ( WorldSession session,
uint8  tabId 
)

Hack to force client to update permissions

1558 {
1559  Player* player = session->GetPlayer();
1560  if (!player)
1561  return;
1562 
1563  Member const* member = GetMember(player->GetGUID());
1564  if (!member)
1565  return;
1566 
1568  return;
1569 
1570  if (tabId != _GetPurchasedTabsSize())
1571  return;
1572 
1573  // Do not get money for bank tabs that the GM bought, we had to buy them already.
1574  // This is just a speedup check, GetGuildBankTabPrice will return 0.
1575  if (tabId < GUILD_BANK_MAX_TABS - 2) // 7th tab is actually the 6th
1576  {
1577  uint32 tabCost = _GetGuildBankTabPrice(tabId) * GOLD;
1578  if (!tabCost)
1579  return;
1580 
1581  if (!player->HasEnoughMoney(uint64(tabCost))) // Should not happen, this is checked by client
1582  return;
1583 
1584  player->ModifyMoney(-int64(tabCost));
1585  }
1586 
1588 
1590  BroadcastPacket(packet.Write());
1591 
1592  SendPermissions(session);
1593 }
const Member * GetMember(ObjectGuid guid) const
Definition: Guild.h:924
uint32 _GetGuildBankTabPrice(uint8 tabId)
Definition: Guild.cpp:39
WorldPacket const * Write() override
Definition: GuildPackets.h:365
Player * GetPlayer() const
Definition: WorldSession.h:927
void BroadcastPacket(WorldPacket const *packet) const
Definition: Guild.cpp:2520
Definition: Guild.h:44
uint8 _GetPurchasedTabsSize() const
Definition: Guild.h:920
Definition: GuildPackets.h:360
uint32_t uint32
Definition: Define.h:150
uint64_t uint64
Definition: Define.h:149
Definition: SharedDefines.h:232
int64_t int64
Definition: g3dmath.h:169
void _CreateNewBankTab()
Definition: Guild.cpp:2776
void SendPermissions(WorldSession *session) const
Definition: Guild.cpp:2088

+ Here is the call graph for this function:

void Guild::HandleDelete ( WorldSession session)
1963 {
1964  // Only leader can disband guild
1965  if (_IsLeader(session->GetPlayer()))
1966  {
1967  Disband();
1968  TC_LOG_DEBUG("guild", "%s successfully deleted", GetGUID().ToString().c_str());
1969  delete this;
1970  }
1971 }
bool _IsLeader(Player *player) const
Definition: Guild.cpp:2850
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
Player * GetPlayer() const
Definition: WorldSession.h:927
void Disband()
Definition: Guild.cpp:1140
string ToString(int i)
Definition: strutil.h:491
ObjectGuid GetGUID() const
Definition: Guild.h:764

+ Here is the call graph for this function:

void Guild::HandleGuildPartyRequest ( WorldSession session)
1974 {
1975  Player* player = session->GetPlayer();
1976  Group* group = player->GetGroup();
1977 
1978  // Make sure player is a member of the guild and that he is in a group.
1979  if (!IsMember(player->GetGUID()) || !group)
1980  return;
1981 
1982  WorldPackets::Guild::GuildPartyState partyStateResponse;
1983  partyStateResponse.InGuildParty = (player->GetMap()->GetOwnerGuildId(player->GetTeam()) == GetId());
1984  partyStateResponse.NumMembers = 0;
1985  partyStateResponse.NumRequired = 0;
1986  partyStateResponse.GuildXPEarnedMult = 0.0f;
1987  session->SendPacket(partyStateResponse.Write());
1988 
1989  TC_LOG_DEBUG("guild", "SMSG_GUILD_PARTY_STATE_RESPONSE [%s]", session->GetPlayerInfo().c_str());
1990 }
int32 NumRequired
Definition: GuildPackets.h:657
float GuildXPEarnedMult
Definition: GuildPackets.h:655
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
Player * GetPlayer() const
Definition: WorldSession.h:927
WorldPacket const * Write() override
Definition: GuildPackets.cpp:500
int32 NumMembers
Definition: GuildPackets.h:656
bool InGuildParty
Definition: GuildPackets.h:658
ObjectGuid::LowType GetId() const
Definition: Guild.h:763
Definition: GuildPackets.h:648
void SendPacket(WorldPacket const *packet, bool forced=false)
Send a packet to the client.
Definition: WorldSession.cpp:211
bool IsMember(ObjectGuid guid) const
Definition: Guild.cpp:2719
std::string GetPlayerInfo() const
Definition: WorldSession.cpp:195
Definition: Group.h:191

+ Here is the call graph for this function:

void Guild::HandleGuildRequestChallengeUpdate ( WorldSession session)
Todo:
current count
1993 {
1995 
1996  for (int i = 0; i < GUILD_CHALLENGES_TYPES; ++i)
1997  updatePacket.CurrentCount[i] = int32(0);
1998 
1999  for (int i = 0; i < GUILD_CHALLENGES_TYPES; ++i)
2000  updatePacket.MaxCount[i] = int32(GuildChallengesMaxCount[i]);
2001 
2002  for (int i = 0; i < GUILD_CHALLENGES_TYPES; ++i)
2003  updatePacket.MaxLevelGold[i] = int32(GuildChallengeMaxLevelGoldReward[i]);
2004 
2005  for (int i = 0; i < GUILD_CHALLENGES_TYPES; ++i)
2006  updatePacket.Gold[i] = int32(GuildChallengeGoldReward[i]);
2007 
2008  session->SendPacket(updatePacket.Write());
2009 }
const uint32 GuildChallengeMaxLevelGoldReward[GUILD_CHALLENGES_TYPES]
Definition: Guild.h:260
const uint32 GuildChallengesMaxCount[GUILD_CHALLENGES_TYPES]
Definition: Guild.h:261
int32 MaxLevelGold[GUILD_CHALLENGES_TYPES]
Definition: GuildPackets.h:982
Definition: GuildPackets.h:972
int32 MaxCount[GUILD_CHALLENGES_TYPES]
Definition: GuildPackets.h:980
WorldPacket const * Write() override
Definition: GuildPackets.cpp:784
int32_t int32
Definition: Define.h:146
void SendPacket(WorldPacket const *packet, bool forced=false)
Send a packet to the client.
Definition: WorldSession.cpp:211
#define GUILD_CHALLENGES_TYPES
Definition: Guild.h:257
int32 CurrentCount[GUILD_CHALLENGES_TYPES]
Definition: GuildPackets.h:979
const uint32 GuildChallengeGoldReward[GUILD_CHALLENGES_TYPES]
Definition: Guild.h:259
int32 Gold[GUILD_CHALLENGES_TYPES]
Definition: GuildPackets.h:981

+ Here is the call graph for this function:

void Guild::HandleInviteMember ( WorldSession session,
std::string const name 
)
1596 {
1597  Player* pInvitee = ObjectAccessor::FindPlayerByName(name);
1598  if (!pInvitee)
1599  {
1601  return;
1602  }
1603 
1604  Player* player = session->GetPlayer();
1605  // Do not show invitations from ignored players
1606  if (pInvitee->GetSocial()->HasIgnore(player->GetGUID()))
1607  return;
1608 
1609  if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && pInvitee->GetTeam() != player->GetTeam())
1610  {
1612  return;
1613  }
1614 
1615  // Invited player cannot be in another guild
1616  if (pInvitee->GetGuildId())
1617  {
1619  return;
1620  }
1621 
1622  // Invited player cannot be invited
1623  if (pInvitee->GetGuildIdInvited())
1624  {
1626  return;
1627  }
1628 
1629  // Inviting player must have rights to invite
1630  if (!_HasRankRight(player, GR_RIGHT_INVITE))
1631  {
1633  return;
1634  }
1635 
1637 
1638  TC_LOG_DEBUG("guild", "Player %s invited %s to join his Guild", player->GetName().c_str(), name.c_str());
1639 
1640  pInvitee->SetGuildIdInvited(m_id);
1641  _LogEvent(GUILD_EVENT_LOG_INVITE_PLAYER, player->GetGUID().GetCounter(), pInvitee->GetGUID().GetCounter());
1642 
1644 
1646  invite.GuildVirtualRealmAddress = GetVirtualRealmAddress();
1647  invite.GuildGUID = GetGUID();
1648 
1649  invite.EmblemStyle = uint32(m_emblemInfo.GetStyle());
1650  invite.EmblemColor = uint32(m_emblemInfo.GetColor());
1651  invite.BorderStyle = uint32(m_emblemInfo.GetBorderStyle());
1652  invite.BorderColor = uint32(m_emblemInfo.GetBorderColor());
1653  invite.Background = uint32(m_emblemInfo.GetBackgroundColor());
1654  invite.Level = int32(GetLevel());
1655 
1656  invite.InviterName = player->GetName();
1657  invite.GuildName = GetName();
1658 
1659  if (Guild* oldGuild = pInvitee->GetGuild())
1660  {
1661  invite.OldGuildGUID = oldGuild->GetGUID();
1662  invite.OldGuildName = oldGuild->GetName();
1663  invite.OldGuildVirtualRealmAddress = GetVirtualRealmAddress();
1664  }
1665 
1666  pInvitee->GetSession()->SendPacket(invite.Write());
1667  TC_LOG_DEBUG("guild", "SMSG_GUILD_INVITE [%s]", pInvitee->GetName().c_str());
1668 }
Definition: Guild.h:82
static void SendCommandResult(WorldSession *session, GuildCommandType type, GuildCommandError errCode, std::string const &param="")
Definition: Guild.cpp:53
EmblemInfo m_emblemInfo
Definition: Guild.h:890
Definition: Guild.h:127
Definition: Guild.h:105
std::string const & GetName() const
Definition: Guild.h:766
Definition: Guild.h:129
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
Player * GetPlayer() const
Definition: WorldSession.h:927
#define sWorld
Definition: World.h:887
Definition: GuildPackets.h:206
Definition: Guild.h:137
uint32 InviterVirtualRealmAddress
Definition: GuildPackets.h:223
Definition: Guild.h:205
uint32 GetBorderColor() const
Definition: Guild.h:277
uint32 GetBorderStyle() const
Definition: Guild.h:276
Definition: Guild.h:133
uint8 GetLevel() const
Definition: Guild.h:872
Definition: Guild.h:136
uint32 GetColor() const
Definition: Guild.h:275
bool _HasRankRight(Player const *player, uint32 right) const
Definition: Guild.h:910
uint32 GetStyle() const
Definition: Guild.h:274
ObjectGuid GetGUID() const
Definition: Guild.h:764
TC_GAME_API Player * FindPlayerByName(std::string const &name)
Definition: ObjectAccessor.cpp:220
void _LogEvent(GuildEventLogTypes eventType, ObjectGuid::LowType playerGuid1, ObjectGuid::LowType playerGuid2=UI64LIT(0), uint8 newRank=0)
Definition: Guild.cpp:3013
ObjectGuid::LowType m_id
Definition: Guild.h:883
int32_t int32
Definition: g3dmath.h:167
uint32 GetVirtualRealmAddress()
Definition: World.cpp:3487
uint32_t uint32
Definition: g3dmath.h:168
uint32 GetBackgroundColor() const
Definition: Guild.h:278
Definition: Guild.h:320
Definition: Guild.h:124

+ Here is the call graph for this function:

void Guild::HandleLeaveMember ( WorldSession session)
1681 {
1682  Player* player = session->GetPlayer();
1683  bool disband = false;
1684 
1685  // If leader is leaving
1686  if (_IsLeader(player))
1687  {
1688  if (m_members.size() > 1)
1689  // Leader cannot leave if he is not the last member
1691  else if (GetLevel() >= sWorld->getIntConfig(CONFIG_GUILD_UNDELETABLE_LEVEL))
1693  else
1694  {
1695  // Guild is disbanded if leader leaves.
1696  Disband();
1697  disband = true;
1698  }
1699  }
1700  else
1701  {
1702  _LogEvent(GUILD_EVENT_LOG_LEAVE_GUILD, player->GetGUID().GetCounter());
1703  SendEventPlayerLeft(GetMember(player->GetGUID()));
1704 
1705  DeleteMember(player->GetGUID(), false, false);
1706 
1708  }
1709 
1710  sCalendarMgr->RemovePlayerGuildEventsAndSignups(player->GetGUID(), GetId());
1711 
1712  if (disband)
1713  delete this;
1714 }
static void SendCommandResult(WorldSession *session, GuildCommandType type, GuildCommandError errCode, std::string const &param="")
Definition: Guild.cpp:53
bool _IsLeader(Player *player) const
Definition: Guild.cpp:2850
#define sCalendarMgr
Definition: CalendarMgr.h:334
const Member * GetMember(ObjectGuid guid) const
Definition: Guild.h:924
Definition: Guild.h:132
Player * GetPlayer() const
Definition: WorldSession.h:927
#define sWorld
Definition: World.h:887
void DeleteMember(ObjectGuid guid, bool isDisbanding=false, bool isKicked=false, bool canDeleteGuild=false)
Definition: Guild.cpp:2646
void Disband()
Definition: Guild.cpp:1140
uint8 GetLevel() const
Definition: Guild.h:872
Definition: World.h:357
Definition: Guild.h:153
Members m_members
Definition: Guild.h:895
ObjectGuid::LowType GetId() const
Definition: Guild.h:763
std::string m_name
Definition: Guild.h:884
void _LogEvent(GuildEventLogTypes eventType, ObjectGuid::LowType playerGuid1, ObjectGuid::LowType playerGuid2=UI64LIT(0), uint8 newRank=0)
Definition: Guild.cpp:3013
void SendEventPlayerLeft(Member *leaver, Member *remover=nullptr, bool isRemoved=false)
Definition: Guild.cpp:2216
Definition: Guild.h:210
Definition: Guild.h:106
Definition: Guild.h:124

+ Here is the call graph for this function:

void Guild::HandleMemberDepositMoney ( WorldSession session,
uint64  amount,
bool  cashFlow = false 
)
1878 {
1879  Player* player = session->GetPlayer();
1880 
1881  // Call script after validation and before money transfer.
1882  sScriptMgr->OnGuildMemberDepositMoney(this, player, amount);
1883 
1885  _ModifyBankMoney(trans, amount, true);
1886  if (!cashFlow)
1887  {
1888  player->ModifyMoney(-int64(amount));
1889  player->SaveGoldToDB(trans);
1890  }
1891 
1892  _LogBankEvent(trans, cashFlow ? GUILD_BANK_LOG_CASH_FLOW_DEPOSIT : GUILD_BANK_LOG_DEPOSIT_MONEY, uint8(0), player->GetGUID().GetCounter(), amount);
1894 
1896 
1897  if (player->GetSession()->HasPermission(rbac::RBAC_PERM_LOG_GM_TRADE))
1898  {
1899  sLog->outCommand(player->GetSession()->GetAccountId(),
1900  "GM %s (Account: %u) deposit money (Amount: " UI64FMTD ") to guild bank (Guild ID " UI64FMTD ")",
1901  player->GetName().c_str(), player->GetSession()->GetAccountId(), amount, m_id);
1902  }
1903 }
SQLTransaction BeginTransaction()
Begins an automanaged transaction pointer that will automatically rollback if not commited...
Definition: DatabaseWorkerPool.h:221
Definition: Guild.h:200
#define sLog
Definition: Log.h:154
Player * GetPlayer() const
Definition: WorldSession.h:927
bool _ModifyBankMoney(SQLTransaction &trans, uint64 amount, bool add)
Definition: Guild.cpp:2870
void CommitTransaction(SQLTransaction transaction)
Definition: DatabaseWorkerPool.cpp:179
#define UI64FMTD
Definition: Define.h:137
int64_t int64
Definition: g3dmath.h:169
uint8_t uint8
Definition: g3dmath.h:164
ObjectGuid::LowType m_id
Definition: Guild.h:883
Definition: RBAC.h:63
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
#define sScriptMgr
Definition: ScriptMgr.h:837
Definition: Guild.h:194
void _LogBankEvent(SQLTransaction &trans, GuildBankEventLogTypes eventType, uint8 tabId, ObjectGuid::LowType playerGuid, uint64 itemOrMoney, uint16 itemStackCount=0, uint8 destTabId=0)
Definition: Guild.cpp:3023
void SendEventBankMoneyChanged()
Definition: Guild.cpp:2174
std::shared_ptr< Transaction > SQLTransaction
Definition: Transaction.h:58

+ Here is the call graph for this function:

void Guild::HandleMemberLogout ( WorldSession session)
1949 {
1950  Player* player = session->GetPlayer();
1951  if (Member* member = GetMember(player->GetGUID()))
1952  {
1953  member->SetStats(player);
1954  member->UpdateLogoutTime();
1955  member->ResetFlags();
1956  }
1957 
1958  SendEventPresenceChanged(session, false, true);
1959  SaveToDB();
1960 }
const Member * GetMember(ObjectGuid guid) const
Definition: Guild.h:924
Player * GetPlayer() const
Definition: WorldSession.h:927
void SendEventPresenceChanged(WorldSession *session, bool loggedOn, bool broadcast=false)
Definition: Guild.cpp:2234
void SaveToDB()
Definition: Guild.cpp:1195

+ Here is the call graph for this function:

bool Guild::HandleMemberWithdrawMoney ( WorldSession session,
uint64  amount,
bool  repair = false 
)
1906 {
1907  // clamp amount to MAX_MONEY_AMOUNT, Players can't hold more than that anyway
1908  amount = std::min(amount, uint64(MAX_MONEY_AMOUNT));
1909 
1910  if (m_bankMoney < amount) // Not enough money in bank
1911  return false;
1912 
1913  Player* player = session->GetPlayer();
1914 
1915  Member* member = GetMember(player->GetGUID());
1916  if (!member)
1917  return false;
1918 
1919  if (uint64(_GetMemberRemainingMoney(member)) < amount) // Check if we have enough slot/money today
1920  return false;
1921 
1922  // Call script after validation and before money transfer.
1923  sScriptMgr->OnGuildMemberWitdrawMoney(this, player, amount, repair);
1924 
1926  // Add money to player (if required)
1927  if (!repair)
1928  {
1929  if (!player->ModifyMoney(amount))
1930  return false;
1931 
1932  player->SaveGoldToDB(trans);
1933  }
1934 
1935  // Update remaining money amount
1936  member->UpdateBankWithdrawValue(trans, GUILD_BANK_MAX_TABS, amount);
1937  // Remove money from bank
1938  _ModifyBankMoney(trans, amount, false);
1939 
1940  // Log guild bank event
1941  _LogBankEvent(trans, repair ? GUILD_BANK_LOG_REPAIR_MONEY : GUILD_BANK_LOG_WITHDRAW_MONEY, uint8(0), player->GetGUID().GetCounter(), amount);
1943 
1945  return true;
1946 }
uint64 const MAX_MONEY_AMOUNT
Definition: Player.cpp:130
const Member * GetMember(ObjectGuid guid) const
Definition: Guild.h:924
SQLTransaction BeginTransaction()
Begins an automanaged transaction pointer that will automatically rollback if not commited...
Definition: DatabaseWorkerPool.h:221
Definition: Guild.h:196
uint64_t uint64
Definition: g3dmath.h:170
Player * GetPlayer() const
Definition: WorldSession.h:927
bool _ModifyBankMoney(SQLTransaction &trans, uint64 amount, bool add)
Definition: Guild.cpp:2870
Definition: Guild.h:44
Definition: Guild.h:195
void CommitTransaction(SQLTransaction transaction)
Definition: DatabaseWorkerPool.cpp:179
T min(const T &x, const T &y)
Definition: g3dmath.h:305
uint8_t uint8
Definition: g3dmath.h:164
int32 _GetMemberRemainingMoney(Member const *member) const
Definition: Guild.cpp:2971
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
#define sScriptMgr
Definition: ScriptMgr.h:837
uint64 m_bankMoney
Definition: Guild.h:892
void _LogBankEvent(SQLTransaction &trans, GuildBankEventLogTypes eventType, uint8 tabId, ObjectGuid::LowType playerGuid, uint64 itemOrMoney, uint16 itemStackCount=0, uint8 destTabId=0)
Definition: Guild.cpp:3023
void SendEventBankMoneyChanged()
Definition: Guild.cpp:2174
std::shared_ptr< Transaction > SQLTransaction
Definition: Transaction.h:58

+ Here is the call graph for this function:

void Guild::HandleNewsSetSticky ( WorldSession session,
uint32  newsId,
bool  sticky 
)
3393 {
3394  GuildLog* logs = m_newsLog->GetGuildLog();
3395  GuildLog::iterator itr = logs->begin();
3396  while (itr != logs->end() && (*itr)->GetGUID() != newsId)
3397  ++itr;
3398 
3399  if (itr == logs->end())
3400  {
3401  TC_LOG_DEBUG("guild", "HandleNewsSetSticky: [%s] requested unknown newsId %u - Sticky: %u",
3402  session->GetPlayerInfo().c_str(), newsId, sticky);
3403  return;
3404  }
3405 
3406  NewsLogEntry* news = (NewsLogEntry*)(*itr);
3407  news->SetSticky(sticky);
3408 
3409  TC_LOG_DEBUG("guild", "HandleNewsSetSticky: [%s] changed newsId %u sticky to %u",
3410  session->GetPlayerInfo().c_str(), newsId, sticky);
3411 
3412  WorldPackets::Guild::GuildNews newsPacket;
3413  newsPacket.NewsEvents.reserve(1);
3414  news->WritePacket(newsPacket);
3415  session->SendPacket(newsPacket.Write());
3416 }
Definition: GuildPackets.h:932
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
GuildLog * GetGuildLog()
Definition: Guild.h:563
void SendPacket(WorldPacket const *packet, bool forced=false)
Send a packet to the client.
Definition: WorldSession.cpp:211
std::string GetPlayerInfo() const
Definition: WorldSession.cpp:195
std::list< LogEntry * > GuildLog
Definition: Guild.h:547
std::vector< GuildNewsEvent > NewsEvents
Definition: GuildPackets.h:939
LogHolder * m_newsLog
Definition: Guild.h:901

+ Here is the call graph for this function:

void Guild::HandleRemoveMember ( WorldSession session,
ObjectGuid  guid 
)
1717 {
1718  Player* player = session->GetPlayer();
1719 
1720  // Player must have rights to remove members
1721  if (!_HasRankRight(player, GR_RIGHT_REMOVE))
1723  else if (Member* member = GetMember(guid))
1724  {
1725  std::string name = member->GetName();
1726 
1727  // Guild masters cannot be removed
1728  if (member->IsRank(GR_GUILDMASTER))
1730  // Do not allow to remove player with the same rank or higher
1731  else
1732  {
1733  Member* memberMe = GetMember(player->GetGUID());
1734  if (!memberMe || member->IsRankNotLower(memberMe->GetRankId()))
1736  else
1737  {
1738  _LogEvent(GUILD_EVENT_LOG_UNINVITE_PLAYER, player->GetGUID().GetCounter(), guid.GetCounter());
1739  SendEventPlayerLeft(member, memberMe, true);
1740 
1741  // After call to DeleteMember pointer to member becomes invalid
1742  DeleteMember(guid, false, true);
1743 
1745  }
1746  }
1747  }
1748 }
Definition: Guild.h:66
static void SendCommandResult(WorldSession *session, GuildCommandType type, GuildCommandError errCode, std::string const &param="")
Definition: Guild.cpp:53
const Member * GetMember(ObjectGuid guid) const
Definition: Guild.h:924
Definition: Guild.h:132
Player * GetPlayer() const
Definition: WorldSession.h:927
void DeleteMember(ObjectGuid guid, bool isDisbanding=false, bool isKicked=false, bool canDeleteGuild=false)
Definition: Guild.cpp:2646
Definition: Guild.h:133
Definition: Guild.h:138
bool _HasRankRight(Player const *player, uint32 right) const
Definition: Guild.h:910
void _LogEvent(GuildEventLogTypes eventType, ObjectGuid::LowType playerGuid1, ObjectGuid::LowType playerGuid2=UI64LIT(0), uint8 newRank=0)
Definition: Guild.cpp:3013
Definition: Guild.h:110
Definition: Guild.h:209
void SendEventPlayerLeft(Member *leaver, Member *remover=nullptr, bool isRemoved=false)
Definition: Guild.cpp:2216
Definition: Guild.h:124
Definition: Guild.h:83
LowType GetCounter() const
Definition: ObjectGuid.h:221

+ Here is the call graph for this function:

void Guild::HandleRemoveRank ( WorldSession session,
uint8  rankId 
)
1854 {
1855  // Cannot remove rank if total count is minimum allowed by the client or is not leader
1856  if (_GetRanksSize() <= GUILD_RANKS_MIN_COUNT || rankId >= _GetRanksSize() || !_IsLeader(session->GetPlayer()))
1857  return;
1858 
1859  // Delete bank rights for rank
1861  stmt->setUInt64(0, m_id);
1862  stmt->setUInt8(1, rankId);
1863  CharacterDatabase.Execute(stmt);
1864 
1865  // Delete rank
1867  stmt->setUInt64(0, m_id);
1868  stmt->setUInt8(1, rankId);
1869  CharacterDatabase.Execute(stmt);
1870 
1871  m_ranks.erase(m_ranks.begin() + rankId);
1872 
1874  BroadcastPacket(eventPacket.Write());
1875 }
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
bool _IsLeader(Player *player) const
Definition: Guild.cpp:2850
WorldPacket const * Write() override
Definition: GuildPackets.h:280
Definition: CharacterDatabase.h:176
void setUInt8(const uint8 index, const uint8 value)
Definition: PreparedStatement.cpp:97
Player * GetPlayer() const
Definition: WorldSession.h:927
void BroadcastPacket(WorldPacket const *packet) const
Definition: Guild.cpp:2520
Definition: PreparedStatement.h:74
Definition: Guild.h:47
uint8 _GetRanksSize() const
Definition: Guild.h:907
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
Ranks m_ranks
Definition: Guild.h:894
ObjectGuid::LowType m_id
Definition: Guild.h:883
Definition: CharacterDatabase.h:166
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
Definition: GuildPackets.h:275

+ Here is the call graph for this function:

void Guild::HandleRoster ( WorldSession session)
1276 {
1278 
1280  roster.CreateDate = uint32(m_createdDate);
1281  roster.GuildFlags = 0;
1282 
1283  roster.MemberData.reserve(m_members.size());
1284 
1285  for (auto itr : m_members)
1286  {
1287  Member* member = itr.second;
1288 
1290 
1291  memberData.Guid = member->GetGUID();
1292  memberData.RankID = int32(member->GetRankId());
1293  memberData.AreaID = int32(member->GetZoneId());
1294  memberData.PersonalAchievementPoints = int32(member->GetAchievementPoints());
1295  memberData.GuildReputation = int32(member->GetTotalReputation());
1296  memberData.LastSave = float(member->IsOnline() ? 0.0f : float(::time(NULL) - member->GetLogoutTime()) / DAY);
1297 
1298  //GuildRosterProfessionData
1299 
1301  memberData.Status = member->GetFlags();
1302  memberData.Level = member->GetLevel();
1303  memberData.ClassID = member->GetClass();
1304  memberData.Gender = member->GetGender();
1305 
1306  memberData.Authenticated = false;
1307  memberData.SorEligible = false;
1308 
1309  memberData.Name = member->GetName();
1310  memberData.Note = member->GetPublicNote();
1311  memberData.OfficerNote = member->GetOfficerNote();
1312 
1313  roster.MemberData.push_back(memberData);
1314  }
1315 
1316  roster.WelcomeText = m_motd;
1317  roster.InfoText = m_info;
1318 
1319  TC_LOG_DEBUG("guild", "SMSG_GUILD_ROSTER [%s]", session->GetPlayerInfo().c_str());
1320  session->SendPacket(roster.Write());
1321 }
std::string Name
Definition: GuildPackets.h:110
std::string InfoText
Definition: GuildPackets.h:132
std::string WelcomeText
Definition: GuildPackets.h:131
bool SorEligible
Definition: GuildPackets.h:119
int32 GuildFlags
Definition: GuildPackets.h:135
int32 RankID
Definition: GuildPackets.h:104
uint32 m_accountsNumber
Definition: Guild.h:891
Definition: GuildPackets.h:99
arena_t NULL
Definition: jemalloc_internal.h:624
time_t m_createdDate
Definition: Guild.h:888
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
uint8 Status
Definition: GuildPackets.h:114
std::string OfficerNote
Definition: GuildPackets.h:113
int32 GuildReputation
Definition: GuildPackets.h:107
int32 NumAccounts
Definition: GuildPackets.h:134
uint32 VirtualRealmAddress
Definition: GuildPackets.h:111
std::string m_motd
Definition: Guild.h:886
std::vector< GuildRosterMemberData > MemberData
Definition: GuildPackets.h:130
Definition: Common.h:99
uint8 Level
Definition: GuildPackets.h:115
int32 PersonalAchievementPoints
Definition: GuildPackets.h:106
float LastSave
Definition: GuildPackets.h:109
Members m_members
Definition: Guild.h:895
ObjectGuid Guid
Definition: GuildPackets.h:101
Definition: GuildPackets.h:123
void SendPacket(WorldPacket const *packet, bool forced=false)
Send a packet to the client.
Definition: WorldSession.cpp:211
WorldPacket const * Write() override
Definition: GuildPackets.cpp:66
uint8 ClassID
Definition: GuildPackets.h:116
std::string GetPlayerInfo() const
Definition: WorldSession.cpp:195
uint8 Gender
Definition: GuildPackets.h:117
int32_t int32
Definition: g3dmath.h:167
uint32 GetVirtualRealmAddress()
Definition: World.cpp:3487
uint32_t uint32
Definition: g3dmath.h:168
std::string Note
Definition: GuildPackets.h:112
uint32 CreateDate
Definition: GuildPackets.h:133
int32 AreaID
Definition: GuildPackets.h:105
std::string m_info
Definition: Guild.h:887
bool Authenticated
Definition: GuildPackets.h:118

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Guild::HandleSetAchievementTracking ( WorldSession session,
std::set< uint32 > const achievementIds 
)
1385 {
1386  Player* player = session->GetPlayer();
1387 
1388  if (Member* member = GetMember(player->GetGUID()))
1389  {
1390  std::set<uint32> criteriaIds;
1391 
1392  for (uint32 achievementId : achievementIds)
1393  {
1394  if (AchievementEntry const* achievement = sAchievementMgr->GetAchievement(achievementId))
1395  {
1396  if (AchievementCriteriaTree const* tree = sAchievementMgr->GetAchievementCriteriaTree(achievement->CriteriaTree))
1397  {
1398  sAchievementMgr->WalkCriteriaTree(tree, [&criteriaIds](AchievementCriteriaTree const* node)
1399  {
1400  if (node->Criteria)
1401  criteriaIds.insert(node->Criteria->ID);
1402  });
1403  }
1404  }
1405  }
1406 
1407  member->SetTrackedCriteriaIds(criteriaIds);
1408  m_achievementMgr.SendAllTrackedCriterias(player, member->GetTrackedCriteriaIds());
1409  }
1410 }
AchievementMgr< Guild > m_achievementMgr
Definition: Guild.h:902
uint32 ID
Definition: AchievementMgr.h:53
const Member * GetMember(ObjectGuid guid) const
Definition: Guild.h:924
AchievementCriteria const * Criteria
Definition: AchievementMgr.h:67
Definition: AchievementMgr.h:62
Player * GetPlayer() const
Definition: WorldSession.h:927
Definition: DB2Structure.h:27
uint32_t uint32
Definition: Define.h:150
#define sAchievementMgr
Definition: AchievementMgr.h:501
void SendAllTrackedCriterias(Player *receiver, std::set< uint32 > const &trackedCriterias) const
Definition: AchievementMgr.cpp:919

+ Here is the call graph for this function:

void Guild::HandleSetBankTabInfo ( WorldSession session,
uint8  tabId,
std::string const name,
std::string const icon 
)
1495 {
1496  BankTab* tab = GetBankTab(tabId);
1497  if (!tab)
1498  {
1499  TC_LOG_ERROR("guild", "Guild::HandleSetBankTabInfo: Player %s trying to change bank tab info from unexisting tab %d.",
1500  session->GetPlayerInfo().c_str(), tabId);
1501  return;
1502  }
1503 
1504  tab->SetInfo(name, icon);
1505 
1507  packet.Tab = tabId;
1508  packet.Name = name;
1509  packet.Icon = icon;
1510  BroadcastPacket(packet.Write());
1511 }
Definition: GuildPackets.h:368
std::string Name
Definition: GuildPackets.h:376
BankTab * GetBankTab(uint8 tabId)
Definition: Guild.h:921
void BroadcastPacket(WorldPacket const *packet) const
Definition: Guild.cpp:2520
std::string Icon
Definition: GuildPackets.h:375
WorldPacket const * Write() override
Definition: GuildPackets.cpp:341
std::string GetPlayerInfo() const
Definition: WorldSession.cpp:195
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
int32 Tab
Definition: GuildPackets.h:377

+ Here is the call graph for this function:

void Guild::HandleSetEmblem ( WorldSession session,
const EmblemInfo emblemInfo 
)
1455 {
1456  Player* player = session->GetPlayer();
1457  if (!_IsLeader(player))
1458  SendSaveEmblemResult(session, ERR_GUILDEMBLEM_NOTGUILDMASTER); // "Only guild leaders can create emblems."
1459  else if (!player->HasEnoughMoney(uint64(EMBLEM_PRICE)))
1460  SendSaveEmblemResult(session, ERR_GUILDEMBLEM_NOTENOUGHMONEY); // "You can't afford to do that."
1461  else
1462  {
1463  player->ModifyMoney(-int64(EMBLEM_PRICE));
1464 
1465  m_emblemInfo = emblemInfo;
1467 
1468  SendSaveEmblemResult(session, ERR_GUILDEMBLEM_SUCCESS); // "Guild Emblem saved."
1469 
1470  SendQueryResponse(session);
1471  }
1472 }
Definition: Guild.h:219
Definition: Guild.h:218
bool _IsLeader(Player *player) const
Definition: Guild.cpp:2850
EmblemInfo m_emblemInfo
Definition: Guild.h:890
Player * GetPlayer() const
Definition: WorldSession.h:927
Definition: Guild.h:215
static void SendSaveEmblemResult(WorldSession *session, GuildEmblemError errCode)
Definition: Guild.cpp:65
void SaveToDB(ObjectGuid::LowType guildId) const
Definition: Guild.cpp:701
uint64_t uint64
Definition: Define.h:149
#define EMBLEM_PRICE
Definition: Guild.cpp:37
int64_t int64
Definition: g3dmath.h:169
ObjectGuid::LowType m_id
Definition: Guild.h:883
void SendQueryResponse(WorldSession *session)
Definition: Guild.cpp:1323

+ Here is the call graph for this function:

void Guild::HandleSetInfo ( WorldSession session,
std::string const info 
)
1436 {
1437  if (m_info == info)
1438  return;
1439 
1440  // Player must have rights to set guild's info
1442  {
1443  m_info = info;
1444 
1445  sScriptMgr->OnGuildInfoChanged(this, info);
1446 
1448  stmt->setString(0, info);
1449  stmt->setUInt64(1, m_id);
1450  CharacterDatabase.Execute(stmt);
1451  }
1452 }
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
Definition: CharacterDatabase.h:187
void setString(const uint8 index, const std::string &value)
Definition: PreparedStatement.cpp:187
Player * GetPlayer() const
Definition: WorldSession.h:927
Definition: PreparedStatement.h:74
Definition: Guild.h:94
bool _HasRankRight(Player const *player, uint32 right) const
Definition: Guild.h:910
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
ObjectGuid::LowType m_id
Definition: Guild.h:883
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
#define sScriptMgr
Definition: ScriptMgr.h:837
std::string m_info
Definition: Guild.h:887

+ Here is the call graph for this function:

void Guild::HandleSetMemberNote ( WorldSession session,
std::string const note,
ObjectGuid  guid,
bool  isPublic 
)
1514 {
1515  // Player must have rights to set public/officer note
1516  if (!_HasRankRight(session->GetPlayer(), isPublic ? GR_RIGHT_EDIT_PUBLIC_NOTE : GR_RIGHT_EOFFNOTE))
1518  else if (Member* member = GetMember(guid))
1519  {
1520  if (isPublic)
1521  member->SetPublicNote(note);
1522  else
1523  member->SetOfficerNote(note);
1524 
1525  HandleRoster(session); // FIXME - We should send SMSG_GUILD_MEMBER_UPDATE_NOTE
1526 
1528  updateNote.Member = guid;
1529  updateNote.IsPublic = isPublic;
1530  updateNote.Note = note;
1531  session->SendPacket(updateNote.Write()); // @todo - Verify receiver of this packet...
1532  }
1533 }
std::string Note
Definition: GuildPackets.h:561
Definition: Guild.h:116
ObjectGuid Member
Definition: GuildPackets.h:559
static void SendCommandResult(WorldSession *session, GuildCommandType type, GuildCommandError errCode, std::string const &param="")
Definition: Guild.cpp:53
const Member * GetMember(ObjectGuid guid) const
Definition: Guild.h:924
Definition: GuildPackets.h:552
Player * GetPlayer() const
Definition: WorldSession.h:927
WorldPacket const * Write() override
Definition: GuildPackets.cpp:452
Definition: Guild.h:133
bool _HasRankRight(Player const *player, uint32 right) const
Definition: Guild.h:910
void HandleRoster(WorldSession *session)
Definition: Guild.cpp:1275
void SendPacket(WorldPacket const *packet, bool forced=false)
Send a packet to the client.
Definition: WorldSession.cpp:211
Definition: Guild.h:93
Definition: Guild.h:91
bool IsPublic
0 == Officer, 1 == Public
Definition: GuildPackets.h:560

+ Here is the call graph for this function:

void Guild::HandleSetMemberRank ( WorldSession session,
ObjectGuid  guid,
ObjectGuid  setterGuid,
uint32  rank 
)
div class="fragment">
1805 {
1806  Player* player = session->GetPlayer();
1807  Member* member = GetMember(targetGuid);
1808  if (!member)
1809  return;
1812 
1813  if (rank > member->GetRankId())
1814  {
1815  rights = GR_RIGHT_DEMOTE;
1817  }
1818 
1819  // Promoted player must be a member of guild
1820  if (!_HasRankRight(player, rights))
1821  {
1822  SendCommandResult(session, type, ERR_GUILD_PERMISSIONS);
1823  return;
1824  }
1825 
1826  // Player cannot promote himself
1827  if (member->IsSamePlayer(player->GetGUID()))
1828  {
1829  SendCommandResult(session, type, ERR_GUILD_NAME_INVALID);
1830  return;
1831  }
1832 
1833  SendGuildRanksUpdate(setterGuid, targetGuid, rank);
1834 }
static void SendCommandResult(WorldSession *session, GuildCommandType type, GuildCommandError errCode, std::string const &param="")
Definition: Guild.cpp:53
Definition: Guild.h:85
const Member * GetMember(ObjectGuid guid) const
Definition: Guild.h:924
Player * GetPlayer() const
Definition: WorldSession.h:927
Definition: Guild.h:133
GuildRankRights
Definition: Guild.h:75
Definition: Guild.h:86
void SendGuildRanksUpdate(ObjectGuid setterGuid, ObjectGuid targetGuid, uint32 rank)
Definition: Guild.cpp:3337
bool _HasRankRight(Player const *player, uint32 right) const
Definition: Guild.h:910
Definition: Guild.h:130
Definition: Guild.h:109
Definition: Guild.h:108
GuildCommandType
Definition: Guild.h:102

+ Here is the call graph for this function:

void Guild::HandleSetMOTD ( WorldSession session,
std::string const motd 
)
1413 {
1414  if (m_motd == motd)
1415  return;
1416 
1417  // Player must have rights to set MOTD
1418  if (!_HasRankRight(session->GetPlayer(), GR_RIGHT_SETMOTD))
1420  else
1421  {
1422  m_motd = motd;
1423 
1424  sScriptMgr->OnGuildMOTDChanged(this, motd);
1425 
1427  stmt->setString(0, motd);
1428  stmt->setUInt64(1, m_id);
1429  CharacterDatabase.Execute(stmt);
1430 
1431  SendEventMOTD(session, true);
1432  }
1433 }
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
static void SendCommandResult(WorldSession *session, GuildCommandType type, GuildCommandError errCode, std::string const &param="")
Definition: Guild.cpp:53
Definition: Guild.h:112
void setString(const uint8 index, const std::string &value)
Definition: PreparedStatement.cpp:187
Player * GetPlayer() const
Definition: WorldSession.h:927
Definition: PreparedStatement.h:74
Definition: CharacterDatabase.h:186
Definition: Guild.h:133
std::string m_motd
Definition: Guild.h:886
Definition: Guild.h:90
bool _HasRankRight(Player const *player, uint32 right) const
Definition: Guild.h:910
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
ObjectGuid::LowType m_id
Definition: Guild.h:883
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
void SendEventMOTD(WorldSession *session, bool broadcast=false)
Definition: Guild.cpp:2181
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
#define sScriptMgr
Definition: ScriptMgr.h:837

+ Here is the call graph for this function:

void Guild::HandleSetNewGuildMaster ( WorldSession session,
std::string const name 
)
1475 {
1476  Player* player = session->GetPlayer();
1477  // Only the guild master can throne a new guild master
1478  if (!_IsLeader(player))
1480  // Old GM must be a guild member
1481  else if (Member* oldGuildMaster = GetMember(player->GetGUID()))
1482  {
1483  // Same for the new one
1484  if (Member* newGuildMaster = GetMember(name))
1485  {
1486  _SetLeaderGUID(newGuildMaster);
1487  oldGuildMaster->ChangeRank(GR_INITIATE);
1488 
1489  SendEventNewLeader(newGuildMaster, oldGuildMaster);
1490  }
1491  }
1492 }
static void SendCommandResult(WorldSession *session, GuildCommandType type, GuildCommandError errCode, std::string const &param="")
Definition: Guild.cpp:53
bool _IsLeader(Player *player) const
Definition: Guild.cpp:2850
const Member * GetMember(ObjectGuid guid) const
Definition: Guild.h:924
Player * GetPlayer() const
Definition: WorldSession.h:927
Definition: Guild.h:133
void SendEventNewLeader(Member *newLeader, Member *oldLeader, bool isSelfPromoted=false)
Definition: Guild.cpp:2195
void _SetLeaderGUID(Member *pLeader)
Definition: Guild.cpp:2889
Definition: Guild.h:70
Definition: Guild.h:111

+ Here is the call graph for this function:

void Guild::HandleSetRankInfo ( WorldSession session,
uint8  rankId,
std::string const name,
uint32  rights,
uint32  moneyPerDay,
GuildBankRightsAndSlotsVec const rightsAndSlots 
)
1536 {
1537  // Only leader can modify ranks
1538  if (!_IsLeader(session->GetPlayer()))
1540  else if (RankInfo* rankInfo = GetRankInfo(rankId))
1541  {
1542  TC_LOG_DEBUG("guild", "Changed RankName to '%s', rights to 0x%08X", name.c_str(), rights);
1543 
1544  rankInfo->SetName(name);
1545  rankInfo->SetRights(rights);
1546  _SetRankBankMoneyPerDay(rankId, moneyPerDay);
1547 
1548  for (GuildBankRightsAndSlotsVec::const_iterator itr = rightsAndSlots.begin(); itr != rightsAndSlots.end(); ++itr)
1549  _SetRankBankTabRightsAndSlots(rankId, *itr);
1550 
1552  packet.RankID = rankId;
1553  BroadcastPacket(packet.Write());
1554  }
1555 }
static void SendCommandResult(WorldSession *session, GuildCommandType type, GuildCommandError errCode, std::string const &param="")
Definition: Guild.cpp:53
bool _IsLeader(Player *player) const
Definition: Guild.cpp:2850
void _SetRankBankTabRightsAndSlots(uint8 rankId, GuildBankRightsAndSlots rightsAndSlots, bool saveToDB=true)
Definition: Guild.cpp:2909
Definition: GuildPackets.h:265
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
Player * GetPlayer() const
Definition: WorldSession.h:927
void BroadcastPacket(WorldPacket const *packet) const
Definition: Guild.cpp:2520
Definition: Guild.h:133
Definition: Guild.h:115
int32 RankID
Definition: GuildPackets.h:272
const RankInfo * GetRankInfo(uint8 rankId) const
Definition: Guild.h:908
WorldPacket const * Write() override
Definition: GuildPackets.cpp:231
void _SetRankBankMoneyPerDay(uint8 rankId, uint32 moneyPerDay)
Definition: Guild.cpp:2903

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Guild::HandleUpdateMemberRank ( WorldSession session,
ObjectGuid  guid,
bool  demote 
)
1751 {
1752  Player* player = session->GetPlayer();
1754  // Player must have rights to promote
1755  if (!_HasRankRight(player, demote ? GR_RIGHT_DEMOTE : GR_RIGHT_PROMOTE))
1756  SendCommandResult(session, type, ERR_GUILD_PERMISSIONS);
1757  // Promoted player must be a member of guild
1758  else if (Member* member = GetMember(guid))
1759  {
1760  std::string name = member->GetName();
1761  // Player cannot promote himself
1762  if (member->IsSamePlayer(player->GetGUID()))
1763  {
1764  SendCommandResult(session, type, ERR_GUILD_NAME_INVALID);
1765  return;
1766  }
1767 
1768  Member const* memberMe = GetMember(player->GetGUID());
1769  ASSERT(memberMe);
1770  uint8 rankId = memberMe->GetRankId();
1771  if (demote)
1772  {
1773  // Player can demote only lower rank members
1774  if (member->IsRankNotLower(rankId))
1775  {
1776  SendCommandResult(session, type, ERR_GUILD_RANK_TOO_HIGH_S, name);
1777  return;
1778  }
1779  // Lowest rank cannot be demoted
1780  if (member->GetRankId() >= _GetLowestRankId())
1781  {
1782  SendCommandResult(session, type, ERR_GUILD_RANK_TOO_LOW_S, name);
1783  return;
1784  }
1785  }
1786  else
1787  {
1788  // Allow to promote only to lower rank than member's rank
1789  // member->GetRankId() + 1 is the highest rank that current player can promote to
1790  if (member->IsRankNotLower(rankId + 1))
1791  {
1792  SendCommandResult(session, type, ERR_GUILD_RANK_TOO_HIGH_S, name);
1793  return;
1794  }
1795  }
1796 
1797  uint32 newRankId = member->GetRankId() + (demote ? 1 : -1);
1798  member->ChangeRank(newRankId);
1799  _LogEvent(demote ? GUILD_EVENT_LOG_DEMOTE_PLAYER : GUILD_EVENT_LOG_PROMOTE_PLAYER, player->GetGUID().GetCounter(), member->GetGUID().GetCounter(), newRankId);
1800  //_BroadcastEvent(demote ? GE_DEMOTION : GE_PROMOTION, ObjectGuid::Empty, player->GetName().c_str(), name.c_str(), _GetRankName(newRankId).c_str());
1801  }
1802 }
static void SendCommandResult(WorldSession *session, GuildCommandType type, GuildCommandError errCode, std::string const &param="")
Definition: Guild.cpp:53
Definition: Guild.h:85
const Member * GetMember(ObjectGuid guid) const
Definition: Guild.h:924
uint8 _GetLowestRankId() const
Definition: Guild.h:918
Player * GetPlayer() const
Definition: WorldSession.h:927
Definition: Guild.h:208
Definition: Guild.h:207
Definition: Guild.h:133
Definition: Guild.h:86
Definition: Guild.h:138
uint32_t uint32
Definition: Define.h:150
bool _HasRankRight(Player const *player, uint32 right) const
Definition: Guild.h:910
Definition: Guild.h:130
Definition: Guild.h:139
void _LogEvent(GuildEventLogTypes eventType, ObjectGuid::LowType playerGuid1, ObjectGuid::LowType playerGuid2=UI64LIT(0), uint8 newRank=0)
Definition: Guild.cpp:3013
Definition: Guild.h:109
Definition: Guild.h:108
uint8_t uint8
Definition: Define.h:152
#define ASSERT
Definition: Errors.h:55
GuildCommandType
Definition: Guild.h:102

+ Here is the call graph for this function:

bool Guild::HasAchieved ( uint32  achievementId) const
3383 {
3384  return m_achievementMgr.HasAchieved(achievementId);
3385 }
AchievementMgr< Guild > m_achievementMgr
Definition: Guild.h:902
bool HasAchieved(uint32 achievementId) const
Definition: AchievementMgr.cpp:2004

+ Here is the call graph for this function:

bool Guild::IsMember ( ObjectGuid  guid) const
2720 {
2721  Members::const_iterator itr = m_members.find(guid);
2722  return itr != m_members.end();
2723 }
Members m_members
Definition: Guild.h:895

+ Here is the caller graph for this function:

bool Guild::LoadBankEventLogFromDB ( Field fields)
2333 {
2334  uint8 dbTabId = fields[1].GetUInt8();
2335  bool isMoneyTab = (dbTabId == GUILD_BANK_MONEY_LOGS_TAB);
2336  if (dbTabId < _GetPurchasedTabsSize() || isMoneyTab)
2337  {
2338  uint8 tabId = isMoneyTab ? uint8(GUILD_BANK_MAX_TABS) : dbTabId;
2339  LogHolder* pLog = m_bankEventLog[tabId];
2340  if (pLog->CanInsert())
2341  {
2342  uint32 guid = fields[2].GetUInt32();
2343  GuildBankEventLogTypes eventType = GuildBankEventLogTypes(fields[3].GetUInt8());
2344  if (BankEventLogEntry::IsMoneyEvent(eventType))
2345  {
2346  if (!isMoneyTab)
2347  {
2348  TC_LOG_ERROR("guild", "GuildBankEventLog ERROR: MoneyEvent(LogGuid: %u, Guild: " UI64FMTD ") does not belong to money tab (%u), ignoring...", guid, m_id, dbTabId);
2349  return false;
2350  }
2351  }
2352  else if (isMoneyTab)
2353  {
2354  TC_LOG_ERROR("guild", "GuildBankEventLog ERROR: non-money event (LogGuid: %u, Guild: " UI64FMTD ") belongs to money tab, ignoring...", guid, m_id);
2355  return false;
2356  }
2357  pLog->LoadEvent(new BankEventLogEntry(
2358  m_id, // guild id
2359  guid, // guid
2360  time_t(fields[8].GetUInt32()), // timestamp
2361  dbTabId, // tab id
2362  eventType, // event type
2363  fields[4].GetUInt64(), // player guid
2364  fields[5].GetUInt64(), // item or money
2365  fields[6].GetUInt16(), // itam stack count
2366  fields[7].GetUInt8())); // dest tab id
2367  }
2368  }
2369  return true;
2370 }
LogHolder * m_bankEventLog[GUILD_BANK_MAX_TABS+1]
Definition: Guild.h:900
Definition: Guild.h:46
Definition: Guild.h:44
bool IsMoneyEvent() const
Definition: Guild.h:485
uint8 _GetPurchasedTabsSize() const
Definition: Guild.h:920
uint8 GetUInt8() const
Definition: Field.h:70
GuildBankEventLogTypes
Definition: Guild.h:189
#define UI64FMTD
Definition: Define.h:137
uint32_t uint32
Definition: Define.h:150
uint8_t uint8
Definition: g3dmath.h:164
ObjectGuid::LowType m_id
Definition: Guild.h:883
uint32 GetUInt32() const
Definition: Field.h:146
uint8_t uint8
Definition: Define.h:152
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207

+ Here is the call graph for this function:

bool Guild::LoadBankItemFromDB ( Field fields)
2397 {
2398  uint8 tabId = fields[22].GetUInt8();
2399  if (tabId >= _GetPurchasedTabsSize())
2400  {
2401  TC_LOG_ERROR("guild", "Invalid tab for item (GUID: %u, id: #%u) in guild bank, skipped.",
2402  fields[0].GetUInt32(), fields[1].GetUInt32());
2403  return false;
2404  }
2405  return m_bankTabs[tabId]->LoadItemFromDB(fields);
2406 }
BankTabs m_bankTabs
Definition: Guild.h:896
uint8 _GetPurchasedTabsSize() const
Definition: Guild.h:920
uint8 GetUInt8() const
Definition: Field.h:70
uint8_t uint8
Definition: Define.h:152
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207

+ Here is the call graph for this function:

void Guild::LoadBankRightFromDB ( Field fields)
2308 {
2309  // tabId rights slots
2310  GuildBankRightsAndSlots rightsAndSlots(fields[1].GetUInt8(), fields[3].GetInt8(), fields[4].GetInt32());
2311  // rankId
2312  _SetRankBankTabRightsAndSlots(fields[2].GetUInt8(), rightsAndSlots, false);
2313 }
void _SetRankBankTabRightsAndSlots(uint8 rankId, GuildBankRightsAndSlots rightsAndSlots, bool saveToDB=true)
Definition: Guild.cpp:2909
Definition: Guild.h:289

+ Here is the call graph for this function:

void Guild::LoadBankTabFromDB ( Field fields)
2388 {
2389  uint8 tabId = fields[1].GetUInt8();
2390  if (tabId >= _GetPurchasedTabsSize())
2391  TC_LOG_ERROR("guild", "Invalid tab (tabId: %u) in guild bank, skipped.", tabId);
2392  else
2393  m_bankTabs[tabId]->LoadFromDB(fields);
2394 }
BankTabs m_bankTabs
Definition: Guild.h:896
uint8 _GetPurchasedTabsSize() const
Definition: Guild.h:920
uint8 GetUInt8() const
Definition: Field.h:70
uint8_t uint8
Definition: Define.h:152
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207

+ Here is the call graph for this function:

bool Guild::LoadEventLogFromDB ( Field fields)
2316 {
2317  if (m_eventLog->CanInsert())
2318  {
2319  m_eventLog->LoadEvent(new EventLogEntry(
2320  m_id, // guild id
2321  fields[1].GetUInt32(), // guid
2322  time_t(fields[6].GetUInt32()), // timestamp
2323  GuildEventLogTypes(fields[2].GetUInt8()), // event type
2324  fields[3].GetUInt64(), // player guid 1
2325  fields[4].GetUInt64(), // player guid 2
2326  fields[5].GetUInt8())); // rank
2327  return true;
2328  }
2329  return false;
2330 }
GuildEventLogTypes
Definition: Guild.h:203
bool CanInsert() const
Definition: Guild.h:557
LogHolder * m_eventLog
Definition: Guild.h:899
ObjectGuid::LowType m_id
Definition: Guild.h:883
void LoadEvent(LogEntry *entry)
Definition: Guild.cpp:83

+ Here is the call graph for this function:

bool Guild::LoadFromDB ( Field fields)
2253 {
2254  m_id = fields[0].GetUInt64();
2255  m_name = fields[1].GetString();
2256  m_leaderGuid = ObjectGuid::Create<HighGuid::Player>(fields[2].GetUInt64());
2257 
2258  if (!m_emblemInfo.LoadFromDB(fields))
2259  {
2260  TC_LOG_ERROR("guild", "Guild " UI64FMTD " has invalid emblem colors (Background: %u, Border: %u, Emblem: %u), skipped.",
2262  return false;
2263  }
2264 
2265  m_info = fields[8].GetString();
2266  m_motd = fields[9].GetString();
2267  m_createdDate = time_t(fields[10].GetUInt32());
2268  m_bankMoney = fields[11].GetUInt64();
2269  _level = fields[12].GetUInt32();
2270 
2271  uint8 purchasedTabs = uint8(fields[13].GetUInt64());
2272  if (purchasedTabs > GUILD_BANK_MAX_TABS)
2273  purchasedTabs = GUILD_BANK_MAX_TABS;
2274 
2275  m_bankTabs.resize(purchasedTabs);
2276  for (uint8 i = 0; i < purchasedTabs; ++i)
2277  m_bankTabs[i] = new BankTab(m_id, i);
2278 
2280  return true;
2281 }
uint64 GetUInt64() const
Definition: Field.h:184
BankTabs m_bankTabs
Definition: Guild.h:896
EmblemInfo m_emblemInfo
Definition: Guild.h:890
time_t m_createdDate
Definition: Guild.h:888
bool LoadFromDB(Field *fields)
Definition: Guild.cpp:690
Definition: Guild.h:44
ObjectGuid m_leaderGuid
Definition: Guild.h:885
uint32 GetBorderColor() const
Definition: Guild.h:277
std::string m_motd
Definition: Guild.h:886
uint32 GetColor() const
Definition: Guild.h:275
#define UI64FMTD
Definition: Define.h:137
std::string m_name
Definition: Guild.h:884
void _CreateLogHolders()
Definition: Guild.cpp:2768
uint8_t uint8
Definition: g3dmath.h:164
ObjectGuid::LowType m_id
Definition: Guild.h:883
uint32 GetUInt32() const
Definition: Field.h:146
uint8_t uint8
Definition: Define.h:152
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
uint64 m_bankMoney
Definition: Guild.h:892
uint8 _level
Definition: Guild.h:904
uint32 GetBackgroundColor() const
Definition: Guild.h:278
std::string m_info
Definition: Guild.h:887
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::LoadGuildNewsLogFromDB ( Field fields)
2373 {
2374  if (!m_newsLog->CanInsert())
2375  return;
2376 
2377  m_newsLog->LoadEvent(new NewsLogEntry(
2378  m_id, // guild id
2379  fields[1].GetUInt32(), // guid
2380  fields[6].GetUInt32(), // timestamp //64 bits?
2381  GuildNews(fields[2].GetUInt8()), // type
2382  ObjectGuid::Create<HighGuid::Player>(fields[3].GetUInt64()), // player guid
2383  fields[4].GetUInt32(), // Flags
2384  fields[5].GetUInt32())); // value
2385 }
bool CanInsert() const
Definition: Guild.h:557
GuildNews
Definition: Guild.h:232
ObjectGuid::LowType m_id
Definition: Guild.h:883
LogHolder * m_newsLog
Definition: Guild.h:901
void LoadEvent(LogEntry *entry)
Definition: Guild.cpp:83

+ Here is the call graph for this function:

bool Guild::LoadMemberFromDB ( Field fields)
2293 {
2294  ObjectGuid::LowType lowguid = fields[1].GetUInt64();
2295  Member *member = new Member(m_id, ObjectGuid::Create<HighGuid::Player>(lowguid), fields[2].GetUInt8());
2296  if (!member->LoadFromDB(fields))
2297  {
2298  _DeleteMemberFromDB(lowguid);
2299  delete member;
2300  return false;
2301  }
2302 
2303  m_members[member->GetGUID()] = member;
2304  return true;
2305 }
uint64 GetUInt64() const
Definition: Field.h:184
void _DeleteMemberFromDB(ObjectGuid::LowType lowguid) const
Definition: Guild.h:945
uint64 LowType
Definition: ObjectGuid.h:199
Members m_members
Definition: Guild.h:895
ObjectGuid::LowType m_id
Definition: Guild.h:883

+ Here is the call graph for this function:

void Guild::LoadRankFromDB ( Field fields)
2284 {
2285  RankInfo rankInfo(m_id);
2286 
2287  rankInfo.LoadFromDB(fields);
2288 
2289  m_ranks.push_back(rankInfo);
2290 }
Ranks m_ranks
Definition: Guild.h:894
ObjectGuid::LowType m_id
Definition: Guild.h:883

+ Here is the call graph for this function:

void Guild::MassInviteToEvent ( WorldSession session,
uint32  minLevel,
uint32  maxLevel,
uint32  minRank 
)
2536 {
2538 
2539  for (Members::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
2540  {
2541  // not sure if needed, maybe client checks it as well
2542  if (packet.Invites.size() >= CALENDAR_MAX_INVITES)
2543  {
2544  if (Player* player = session->GetPlayer())
2545  sCalendarMgr->SendCalendarCommandResult(player->GetGUID(), CALENDAR_ERROR_INVITES_EXCEEDED);
2546  return;
2547  }
2548 
2549  Member* member = itr->second;
2550  uint32 level = Player::GetLevelFromDB(member->GetGUID());
2551 
2552  if (member->GetGUID() != session->GetPlayer()->GetGUID() && level >= minLevel && level <= maxLevel && member->IsRankNotLower(minRank))
2553  packet.Invites.emplace_back(member->GetGUID(), level);
2554  }
2555 
2556  session->SendPacket(packet.Write());
2557 }
std::vector< CalendarEventInitialInviteInfo > Invites
Definition: CalendarPackets.h:531
#define sCalendarMgr
Definition: CalendarMgr.h:334
Definition: CalendarMgr.h:104
Player * GetPlayer() const
Definition: WorldSession.h:927
Members m_members
Definition: Guild.h:895
uint32_t uint32
Definition: Define.h:150
void SendPacket(WorldPacket const *packet, bool forced=false)
Send a packet to the client.
Definition: WorldSession.cpp:211
#define CALENDAR_MAX_INVITES
Definition: CalendarMgr.h:128
WorldPacket const * Write() override
Definition: CalendarPackets.cpp:444

+ Here is the call graph for this function:

void Guild::OnPlayerStatusChange ( Player player,
uint32  flag,
bool  state 
)
1228 {
1229  if (Member* member = GetMember(player->GetGUID()))
1230  {
1231  if (state)
1232  member->AddFlag(flag);
1233  else member->RemFlag(flag);
1234  }
1235 }
const Member * GetMember(ObjectGuid guid) const
Definition: Guild.h:924

+ Here is the call graph for this function:

void Guild::ResetTimes ( bool  weekly)
3356 {
3357  for (Members::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
3358  {
3359  itr->second->ResetValues(weekly);
3360  if (Player* player = itr->second->FindPlayer())
3361  {
3362  WorldPackets::Guild::GuildMemberDailyReset packet; // tells the client to request bank withdrawal limit
3363  player->GetSession()->SendPacket(packet.Write());
3364  }
3365  }
3366 }
Definition: GuildPackets.h:564
Members m_members
Definition: Guild.h:895
WorldPacket const * Write() override
Definition: GuildPackets.h:569

+ Here is the call graph for this function:

void Guild::SaveToDB ( )
1196 {
1198 
1199  m_achievementMgr.SaveToDB(trans);
1200 
1202 }
AchievementMgr< Guild > m_achievementMgr
Definition: Guild.h:902
SQLTransaction BeginTransaction()
Begins an automanaged transaction pointer that will automatically rollback if not commited...
Definition: DatabaseWorkerPool.h:221
void CommitTransaction(SQLTransaction transaction)
Definition: DatabaseWorkerPool.cpp:179
void SaveToDB(SQLTransaction &trans)
Definition: AchievementMgr.cpp:522
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
std::shared_ptr< Transaction > SQLTransaction
Definition: Transaction.h:58

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Guild::SendBankList ( WorldSession session,
uint8  tabId,
bool  fullUpdate 
) const
3253 {
3254  Member const* member = GetMember(session->GetPlayer()->GetGUID());
3255  if (!member) // Shouldn't happen, just in case
3256  return;
3257 
3259 
3260  packet.Money = uint64(m_bankMoney);
3261  packet.WithdrawalsRemaining = int32(_GetMemberRemainingSlots(member, tabId));
3262  packet.Tab = int32(tabId);
3263  packet.FullUpdate = fullUpdate;
3264 
3265  // TabInfo
3266  if (fullUpdate)
3267  {
3268  packet.TabInfo.reserve(_GetPurchasedTabsSize());
3269  for (uint8 i = 0; i < _GetPurchasedTabsSize(); ++i)
3270  {
3272  tabInfo.TabIndex = i;
3273  tabInfo.Name = m_bankTabs[i]->GetName();
3274  tabInfo.Icon = m_bankTabs[i]->GetIcon();
3275  packet.TabInfo.push_back(tabInfo);
3276  }
3277  }
3278 
3279  // ItemInfo
3280  uint32 itemCount = 0;
3281  if (fullUpdate && _MemberHasTabRights(session->GetPlayer()->GetGUID(), tabId, GUILD_BANK_RIGHT_VIEW_TAB))
3282  if (BankTab const* tab = GetBankTab(tabId))
3283  for (uint8 slotId = 0; slotId < GUILD_BANK_MAX_SLOTS; ++slotId)
3284  if (tab->GetItem(slotId))
3285  ++itemCount;
3286 
3287  packet.ItemInfo.reserve(itemCount);
3288 
3289  if (fullUpdate && _MemberHasTabRights(session->GetPlayer()->GetGUID(), tabId, GUILD_BANK_RIGHT_VIEW_TAB))
3290  {
3291  if (BankTab const* tab = GetBankTab(tabId))
3292  {
3293  for (uint8 slotId = 0; slotId < GUILD_BANK_MAX_SLOTS; ++slotId)
3294  {
3295  if (Item* tabItem = tab->GetItem(slotId))
3296  {
3298 
3299  itemInfo.Slot = int32(slotId);
3300  itemInfo.Item.ItemID = tabItem->GetEntry();
3301  itemInfo.Count = int32(tabItem->GetCount());
3302  itemInfo.Charges = int32(abs(tabItem->GetSpellCharges()));
3303  itemInfo.EnchantmentID = int32(tabItem->GetItemRandomPropertyId()); // verify that...
3304  itemInfo.OnUseEnchantmentID = 0/*int32(tabItem->GetItemSuffixFactor())*/;
3305  itemInfo.Flags = 0;
3306 
3307  uint32 enchants = 0;
3308  for (uint32 ench = 0; ench < MAX_ENCHANTMENT_SLOT; ++ench)
3309  if (tabItem->GetEnchantmentId(EnchantmentSlot(ench)))
3310  ++enchants;
3311 
3312  itemInfo.SocketEnchant.reserve(enchants);
3313  for (uint32 ench = 0; ench < MAX_ENCHANTMENT_SLOT; ++ench)
3314  {
3315  if (uint32 enchantId = tabItem->GetEnchantmentId(EnchantmentSlot(ench)))
3316  {
3318  socketEnchant.SocketEnchantID = int32(enchantId);
3319  socketEnchant.SocketIndex = int32(ench);
3320  itemInfo.SocketEnchant.push_back(socketEnchant);
3321  }
3322  }
3323 
3324  itemInfo.Locked = false;
3325 
3326  packet.ItemInfo.push_back(itemInfo);
3327  }
3328  }
3329  }
3330  }
3331 
3332  session->SendPacket(packet.Write());
3333 
3334  TC_LOG_DEBUG("guild", "WORLD: Sent SMSG_GUILD_BANK_QUERY_RESULTS");
3335 }
G3D::Matrix abs(const G3D::Matrix &M)
Definition: Matrix.h:632
WorldPackets::Item::ItemInstance Item
Definition: GuildPackets.h:789
int32 Charges
Definition: GuildPackets.h:793
Definition: GuildPackets.h:800
Definition: GuildPackets.h:807
BankTabs m_bankTabs
Definition: Guild.h:896
int32 OnUseEnchantmentID
Definition: GuildPackets.h:794
const Member * GetMember(ObjectGuid guid) const
Definition: Guild.h:924
std::vector< GuildBankSocketEnchant > SocketEnchant
Definition: GuildPackets.h:797
EnchantmentSlot
Definition: Item.h:172
int32 Count
Definition: GuildPackets.h:791
BankTab * GetBankTab(uint8 tabId)
Definition: Guild.h:921
int32 Flags
Definition: GuildPackets.h:795
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
uint64_t uint64
Definition: g3dmath.h:170
Player * GetPlayer() const
Definition: WorldSession.h:927
Definition: Item.h:190
int32 Slot
Definition: GuildPackets.h:790
bool Locked
Definition: GuildPackets.h:796
std::string Name
Definition: GuildPackets.h:803
uint8 _GetPurchasedTabsSize() const
Definition: Guild.h:920
int32 _GetMemberRemainingSlots(Member const *member, uint8 tabId) const
Definition: Guild.cpp:2954
int32 Tab
Definition: GuildPackets.h:817
WorldPacket const * Write() override
Definition: GuildPackets.cpp:596
Definition: GuildPackets.h:781
Definition: Item.h:259
int32 EnchantmentID
Definition: GuildPackets.h:792
uint32_t uint32
Definition: Define.h:150
uint64 Money
Definition: GuildPackets.h:818
void SendPacket(WorldPacket const *packet, bool forced=false)
Send a packet to the client.
Definition: WorldSession.cpp:211
int32 TabIndex
Definition: GuildPackets.h:802
std::vector< GuildBankItemInfo > ItemInfo
Definition: GuildPackets.h:814
int32_t int32
Definition: g3dmath.h:167
bool _MemberHasTabRights(ObjectGuid guid, uint8 tabId, int32 rights) const
Definition: Guild.cpp:3000
Definition: Guild.h:181
uint8_t uint8
Definition: Define.h:152
std::vector< GuildBankTabInfo > TabInfo
Definition: GuildPackets.h:815
uint64 m_bankMoney
Definition: Guild.h:892
std::string Icon
Definition: GuildPackets.h:804
Definition: Guild.h:45
uint32 ItemID
Definition: ItemPackets.h:46
bool FullUpdate
Definition: GuildPackets.h:819
int32 WithdrawalsRemaining
Definition: GuildPackets.h:816

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Guild::SendBankLog ( WorldSession session,
uint8  tabId 
) const
2054 {
2055  // GUILD_BANK_MAX_TABS send by client for money log
2056  if (tabId < _GetPurchasedTabsSize() || tabId == GUILD_BANK_MAX_TABS)
2057  {
2058  GuildLog* logs = m_bankEventLog[tabId]->GetGuildLog();
2059 
2060  if (!logs)
2061  return;
2062 
2064  packet.Tab = int32(tabId);
2065 
2066  //if (tabId == GUILD_BANK_MAX_TABS && hasCashFlow)
2067  // packet.WeeklyBonusMoney.Set(uint64(weeklyBonusMoney));
2068 
2069  packet.Entry.reserve(m_bankEventLog[tabId]->GetSize());
2070  for (GuildLog::const_iterator itr = logs->begin(); itr != logs->end(); ++itr)
2071  {
2072  BankEventLogEntry* bankEventLog = (BankEventLogEntry*)(*itr);
2073  bankEventLog->WritePacket(packet);
2074  }
2075 
2076  session->SendPacket(packet.Write());
2077 
2078  TC_LOG_DEBUG("guild", "SMSG_GUILD_BANK_LOG_QUERY_RESULT [%s] TabId: %u", session->GetPlayerInfo().c_str(), tabId);
2079  }
2080 }
LogHolder * m_bankEventLog[GUILD_BANK_MAX_TABS+1]
Definition: Guild.h:900
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
GuildLog * GetGuildLog()
Definition: Guild.h:563
Definition: Guild.h:44
uint8 _GetPurchasedTabsSize() const
Definition: Guild.h:920
void SendPacket(WorldPacket const *packet, bool forced=false)
Send a packet to the client.
Definition: WorldSession.cpp:211
std::vector< GuildBankLogEntry > Entry
Definition: GuildPackets.h:874
std::string GetPlayerInfo() const
Definition: WorldSession.cpp:195
int32 Tab
Definition: GuildPackets.h:873
int32_t int32
Definition: g3dmath.h:167
WorldPacket const * Write() override
Definition: GuildPackets.cpp:667
Definition: GuildPackets.h:866
std::list< LogEntry * > GuildLog
Definition: Guild.h:547

+ Here is the call graph for this function:

void Guild::SendBankTabText ( WorldSession session,
uint8  tabId 
) const
2083 {
2084  if (BankTab const* tab = GetBankTab(tabId))
2085  tab->SendText(this, session);
2086 }
BankTab * GetBankTab(uint8 tabId)
Definition: Guild.h:921

+ Here is the call graph for this function:

void Guild::SendCommandResult ( WorldSession session,
GuildCommandType  type,
GuildCommandError  errCode,
std::string const param = "" 
)
static
54 {
56  resultPacket.Command = type;
57  resultPacket.Result = errCode;
58  resultPacket.Name = param;
59  session->SendPacket(resultPacket.Write());
60 
61  TC_LOG_DEBUG("guild", "SMSG_GUILD_COMMAND_RESULT [%s]: Type: %u, code: %u, param: %s"
62  , session->GetPlayerInfo().c_str(), type, errCode, param.c_str());
63 }
int32 Command
Definition: GuildPackets.h:167
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
int32 Result
Definition: GuildPackets.h:166
std::string Name
Definition: GuildPackets.h:165
WorldPacket const * Write() override
Definition: GuildPackets.cpp:102
Definition: GuildPackets.h:158
void SendPacket(WorldPacket const *packet, bool forced=false)
Send a packet to the client.
Definition: WorldSession.cpp:211
std::string GetPlayerInfo() const
Definition: WorldSession.cpp:195

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Guild::SendEventBankMoneyChanged ( )
2175 {
2177  eventPacket.Money = GetBankMoney();
2178  BroadcastPacket(eventPacket.Write());
2179 }
WorldPacket const * Write() override
Definition: GuildPackets.cpp:238
void BroadcastPacket(WorldPacket const *packet) const
Definition: Guild.cpp:2520
uint64 GetBankMoney() const
Definition: Guild.h:770
uint64 Money
Definition: GuildPackets.h:290

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Guild::SendEventLog ( WorldSession session) const
2012 {
2013  GuildLog* logs = m_eventLog->GetGuildLog();
2014 
2015  if (!logs)
2016  return;
2017 
2019  packet.Entry.reserve(m_eventLog->GetSize());
2020 
2021  for (GuildLog::const_iterator itr = logs->begin(); itr != logs->end(); ++itr)
2022  {
2023  EventLogEntry* eventLog = (EventLogEntry*)(*itr);
2024  eventLog->WritePacket(packet);
2025  }
2026 
2027  session->SendPacket(packet.Write());
2028 
2029  TC_LOG_DEBUG("guild", "SMSG_GUILD_EVENT_LOG_QUERY_RESULTS [%s]", session->GetPlayerInfo().c_str());
2030 }
LogHolder * m_eventLog
Definition: Guild.h:899
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
GuildLog * GetGuildLog()
Definition: Guild.h:563
WorldPacket const * Write() override
Definition: GuildPackets.cpp:245
uint8 GetSize() const
Definition: Guild.h:555
void SendPacket(WorldPacket const *packet, bool forced=false)
Send a packet to the client.
Definition: WorldSession.cpp:211
std::string GetPlayerInfo() const
Definition: WorldSession.cpp:195
std::vector< GuildEventEntry > Entry
Definition: GuildPackets.h:325
std::list< LogEntry * > GuildLog
Definition: Guild.h:547

+ Here is the call graph for this function:

void Guild::SendEventMOTD ( WorldSession session,
bool  broadcast = false 
)
2182 {
2184  eventPacket.MotdText = GetMOTD();
2185 
2186  if (broadcast)
2187  BroadcastPacket(eventPacket.Write());
2188  else
2189  {
2190  session->SendPacket(eventPacket.Write());
2191  TC_LOG_DEBUG("guild", "SMSG_GUILD_EVENT_MOTD [%s] ", session->GetPlayerInfo().c_str());
2192  }
2193 }
std::string const & GetMOTD() const
Definition: Guild.h:767
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
void BroadcastPacket(WorldPacket const *packet) const
Definition: Guild.cpp:2520
Definition: GuildPackets.h:243
WorldPacket const * Write() override
Definition: GuildPackets.cpp:208
std::string MotdText
Definition: GuildPackets.h:250
void SendPacket(WorldPacket const *packet, bool forced=false)
Send a packet to the client.
Definition: WorldSession.cpp:211
std::string GetPlayerInfo() const
Definition: WorldSession.cpp:195

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Guild::SendEventNewLeader ( Member newLeader,
Member oldLeader,
bool  isSelfPromoted = false 
)
2196 {
2198  eventPacket.SelfPromoted = isSelfPromoted;
2199  if (newLeader)
2200  {
2201  eventPacket.NewLeaderGUID = newLeader->GetGUID();
2202  eventPacket.NewLeaderName = newLeader->GetName();
2204  }
2205 
2206  if (oldLeader)
2207  {
2208  eventPacket.OldLeaderGUID = oldLeader->GetGUID();
2209  eventPacket.OldLeaderName = oldLeader->GetName();
2211  }
2212 
2213  BroadcastPacket(eventPacket.Write());
2214 }
uint32 OldLeaderVirtualRealmAddress
Definition: GuildPackets.h:356
uint32 NewLeaderVirtualRealmAddress
Definition: GuildPackets.h:353
std::string OldLeaderName
Definition: GuildPackets.h:355
void BroadcastPacket(WorldPacket const *packet) const
Definition: Guild.cpp:2520
std::string NewLeaderName
Definition: GuildPackets.h:352
ObjectGuid OldLeaderGUID
Definition: GuildPackets.h:354
uint32 GetVirtualRealmAddress()
Definition: World.cpp:3487
Definition: GuildPackets.h:344
ObjectGuid NewLeaderGUID
Definition: GuildPackets.h:351
WorldPacket const * Write() override
Definition: GuildPackets.cpp:323
bool SelfPromoted
Definition: GuildPackets.h:357

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Guild::SendEventPlayerLeft ( Member leaver,
Member remover = nullptr,
bool  isRemoved = false 
)
2217 {
2219  eventPacket.Removed = isRemoved;
2220  eventPacket.LeaverGUID = leaver->GetGUID();
2221  eventPacket.LeaverName = leaver->GetName();
2223 
2224  if (isRemoved && remover != nullptr)
2225  {
2226  eventPacket.RemoverGUID = remover->GetGUID();
2227  eventPacket.RemoverName = remover->GetName();
2229  }
2230 
2231  BroadcastPacket(eventPacket.Write());
2232 }
uint32 RemoverVirtualRealmAddress
Definition: GuildPackets.h:340
ObjectGuid LeaverGUID
Definition: GuildPackets.h:335
void BroadcastPacket(WorldPacket const *packet) const
Definition: Guild.cpp:2520
bool Removed
Definition: GuildPackets.h:341
uint32 LeaverVirtualRealmAddress
Definition: GuildPackets.h:337
WorldPacket const * Write() override
Definition: GuildPackets.cpp:263
std::string LeaverName
Definition: GuildPackets.h:336
Definition: GuildPackets.h:328
uint32 GetVirtualRealmAddress()
Definition: World.cpp:3487
std::string RemoverName
Definition: GuildPackets.h:339
ObjectGuid RemoverGUID
Definition: GuildPackets.h:338

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Guild::SendEventPresenceChanged ( WorldSession session,
bool  loggedOn,
bool  broadcast = false 
)
2235 {
2236  Player* player = session->GetPlayer();
2237 
2239  eventPacket.Guid = player->GetGUID();
2240  eventPacket.Name = player->GetName();
2242  eventPacket.LoggedOn = loggedOn;
2243  eventPacket.Mobile = false;
2244 
2245  if (broadcast)
2246  BroadcastPacket(eventPacket.Write());
2247  else
2248  session->SendPacket(eventPacket.Write());
2249 }
Player * GetPlayer() const
Definition: WorldSession.h:927
void BroadcastPacket(WorldPacket const *packet) const
Definition: Guild.cpp:2520
bool LoggedOn
Definition: GuildPackets.h:240
uint32 VirtualRealmAddress
Definition: GuildPackets.h:237
void SendPacket(WorldPacket const *packet, bool forced=false)
Send a packet to the client.
Definition: WorldSession.cpp:211
WorldPacket const * Write() override
Definition: GuildPackets.cpp:193
std::string Name
Definition: GuildPackets.h:238
bool Mobile
Definition: GuildPackets.h:239
uint32 GetVirtualRealmAddress()
Definition: World.cpp:3487
Definition: GuildPackets.h:229
ObjectGuid Guid
Definition: GuildPackets.h:236

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Guild::SendGuildRankInfo ( WorldSession session) const
1352 {
1354 
1355  ranks.Ranks.reserve(_GetRanksSize());
1356 
1357  for (uint8 i = 0; i < _GetRanksSize(); i++)
1358  {
1359  RankInfo const* rankInfo = GetRankInfo(i);
1360  if (!rankInfo)
1361  continue;
1362 
1364 
1365  rankData.RankID = uint32(rankInfo->GetId());
1366  rankData.RankOrder = uint32(i);
1367  rankData.Flags = rankInfo->GetRights();
1368  rankData.WithdrawGoldLimit = uint32(rankInfo->GetBankMoneyPerDay());
1369  rankData.RankName = rankInfo->GetName();
1370 
1371  for (uint8 j = 0; j < GUILD_BANK_MAX_TABS; ++j)
1372  {
1373  rankData.TabFlags[j] = uint32(rankInfo->GetBankTabRights(j));
1374  rankData.TabWithdrawItemLimit[j] = uint32(rankInfo->GetBankTabSlotsPerDay(j));
1375  }
1376 
1377  ranks.Ranks.push_back(rankData);
1378  }
1379 
1380  session->SendPacket(ranks.Write());
1381  TC_LOG_DEBUG("guild", "SMSG_GUILD_RANK [%s]", session->GetPlayerInfo().c_str());
1382 }
uint32 RankOrder
Definition: GuildPackets.h:488
uint32 WithdrawGoldLimit
Definition: GuildPackets.h:490
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
std::string RankName
Definition: GuildPackets.h:491
Definition: Guild.h:44
WorldPacket const * Write() override
Definition: GuildPackets.cpp:408
uint8 _GetRanksSize() const
Definition: Guild.h:907
std::vector< GuildRankData > Ranks
Definition: GuildPackets.h:503
void SendPacket(WorldPacket const *packet, bool forced=false)
Send a packet to the client.
Definition: WorldSession.cpp:211
Definition: GuildPackets.h:485
const RankInfo * GetRankInfo(uint8 rankId) const
Definition: Guild.h:908
Definition: GuildPackets.h:496
std::string GetPlayerInfo() const
Definition: WorldSession.cpp:195
uint8_t uint8
Definition: Define.h:152
uint32 RankID
Definition: GuildPackets.h:487
uint32 TabWithdrawItemLimit[GUILD_BANK_MAX_TABS]
Definition: GuildPackets.h:493
uint32_t uint32
Definition: g3dmath.h:168
uint32 TabFlags[GUILD_BANK_MAX_TABS]
Definition: GuildPackets.h:492
uint32 Flags
Definition: GuildPackets.h:489

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Guild::SendGuildRanksUpdate ( ObjectGuid  setterGuid,
ObjectGuid  targetGuid,
uint32  rank 
)
private
3338 {
3339  Member* member = GetMember(targetGuid);
3340  ASSERT(member);
3341 
3343  rankChange.Officer = setterGuid;
3344  rankChange.Other = targetGuid;
3345  rankChange.RankID = rank;
3346  rankChange.Promote = (rank < member->GetRankId());
3347  BroadcastPacket(rankChange.Write());
3348 
3349  member->ChangeRank(rank);
3350 
3351  TC_LOG_DEBUG("network", "SMSG_GUILD_RANKS_UPDATE [Broadcast] Target: %s, Issuer: %s, RankId: %u",
3352  targetGuid.ToString().c_str(), setterGuid.ToString().c_str(), rank);
3353 }
Definition: GuildPackets.h:506
WorldPacket const * Write() override
Definition: GuildPackets.cpp:418
const Member * GetMember(ObjectGuid guid) const
Definition: Guild.h:924
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
void BroadcastPacket(WorldPacket const *packet) const
Definition: Guild.cpp:2520
bool Promote
Definition: GuildPackets.h:515
uint32 RankID
Definition: GuildPackets.h:516
ObjectGuid Other
Definition: GuildPackets.h:513
#define ASSERT
Definition: Errors.h:55
std::string ToString() const
Definition: ObjectGuid.cpp:99
ObjectGuid Officer
Definition: GuildPackets.h:514

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Guild::SendLoginInfo ( WorldSession session)
2131 {
2132  Player* player = session->GetPlayer();
2133  Member* member = GetMember(player->GetGUID());
2134  if (!member)
2135  return;
2136 
2137  /*
2138  Login sequence:
2139  SMSG_GUILD_EVENT_MOTD
2140  SMSG_GUILD_RANK
2141  SMSG_GUILD_EVENT_PRESENCE_CHANGE - LoggedOn: True
2142  -- learn perks
2143  SMSG_ALL_GUILD_ACHIEVEMENTS
2144  SMSG_GUILD_MEMBER_DAILY_RESET // bank withdrawal reset
2145  */
2146 
2147  SendEventMOTD(session);
2148  SendGuildRankInfo(session);
2149  SendEventPresenceChanged(session, true, true); // Broadcast
2150 
2151  // Send to self separately, player is not in world yet and is not found by _BroadcastEvent
2152  SendEventPresenceChanged(session, true);
2153 
2154  if (member->GetGUID() == GetLeaderGUID())
2155  {
2157  renameFlag.FlagSet = false;
2158  player->GetSession()->SendPacket(renameFlag.Write());
2159  }
2160 
2161  for (GuildPerkSpellsEntry const* entry : sGuildPerkSpellsStore)
2162  if (entry->GuildLevel <= GetLevel())
2163  player->LearnSpell(entry->SpellID, true);
2164 
2166 
2167  WorldPackets::Guild::GuildMemberDailyReset packet; // tells the client to request bank withdrawal limit
2168  player->GetSession()->SendPacket(packet.Write());
2169 
2170  member->SetStats(player);
2171  member->AddFlag(GUILDMEMBER_STATUS_ONLINE);
2172 }
ObjectGuid GetLeaderGUID() const
Definition: Guild.h:765
AchievementMgr< Guild > m_achievementMgr
Definition: Guild.h:902
const Member * GetMember(ObjectGuid guid) const
Definition: Guild.h:924
bool FlagSet
Definition: GuildPackets.h:635
void SendGuildRankInfo(WorldSession *session) const
Definition: Guild.cpp:1351
Player * GetPlayer() const
Definition: WorldSession.h:927
void SendAllAchievementData(Player *receiver) const
Definition: AchievementMgr.cpp:1865
void SendEventPresenceChanged(WorldSession *session, bool loggedOn, bool broadcast=false)
Definition: Guild.cpp:2234
uint8 GetLevel() const
Definition: Guild.h:872
Definition: GuildPackets.h:564
Definition: DB2Structure.h:579
DB2Storage< GuildPerkSpellsEntry > sGuildPerkSpellsStore("GuildPerkSpells.db2", GuildPerkSpellsFormat, HOTFIX_SEL_GUILD_PERK_SPELLS)
WorldPacket const * Write() override
Definition: GuildPackets.h:569
Definition: GuildPackets.h:628
Definition: Guild.h:226
void SendEventMOTD(WorldSession *session, bool broadcast=false)
Definition: Guild.cpp:2181
WorldPacket const * Write() override
Definition: GuildPackets.cpp:488

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Guild::SendMoneyInfo ( WorldSession session) const
2116 {
2117  Member const* member = GetMember(session->GetPlayer()->GetGUID());
2118  if (!member)
2119  return;
2120 
2121  int32 amount = _GetMemberRemainingMoney(member);
2122 
2124  packet.RemainingWithdrawMoney = int64(amount);
2125  session->SendPacket(packet.Write());
2126 
2127  TC_LOG_DEBUG("guild", "SMSG_GUILD_BANK_MONEY_WITHDRAWN [%s] Money: %u", session->GetPlayerInfo().c_str(), amount);
2128 }
const Member * GetMember(ObjectGuid guid) const
Definition: Guild.h:924
int64 RemainingWithdrawMoney
Definition: GuildPackets.h:767
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
Player * GetPlayer() const
Definition: WorldSession.h:927
int32_t int32
Definition: Define.h:146
void SendPacket(WorldPacket const *packet, bool forced=false)
Send a packet to the client.
Definition: WorldSession.cpp:211
int64_t int64
Definition: g3dmath.h:169
std::string GetPlayerInfo() const
Definition: WorldSession.cpp:195
int32 _GetMemberRemainingMoney(Member const *member) const
Definition: Guild.cpp:2971
WorldPacket const * Write() override
Definition: GuildPackets.cpp:583

+ Here is the call graph for this function:

void Guild::SendNewsUpdate ( WorldSession session)
2033 {
2034  GuildLog* logs = m_newsLog->GetGuildLog();
2035 
2036  if (!logs)
2037  return;
2038 
2040  packet.NewsEvents.reserve(m_newsLog->GetSize());
2041 
2042  for (GuildLog::const_iterator itr = logs->begin(); itr != logs->end(); ++itr)
2043  {
2044  NewsLogEntry* eventLog = (NewsLogEntry*)(*itr);
2045  eventLog->WritePacket(packet);
2046  }
2047 
2048  session->SendPacket(packet.Write());
2049 
2050  TC_LOG_DEBUG("guild", "SMSG_GUILD_NEWS_UPDATE [%s]", session->GetPlayerInfo().c_str());
2051 }
Definition: GuildPackets.h:932
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
GuildLog * GetGuildLog()
Definition: Guild.h:563
uint8 GetSize() const
Definition: Guild.h:555
WorldPacket const * Write() override
Definition: GuildPackets.cpp:763
void SendPacket(WorldPacket const *packet, bool forced=false)
Send a packet to the client.
Definition: WorldSession.cpp:211
std::string GetPlayerInfo() const
Definition: WorldSession.cpp:195
std::list< LogEntry * > GuildLog
Definition: Guild.h:547
std::vector< GuildNewsEvent > NewsEvents
Definition: GuildPackets.h:939
LogHolder * m_newsLog
Definition: Guild.h:901

+ Here is the call graph for this function:

void Guild::SendPermissions ( WorldSession session) const
2089 {
2090  Member const* member = GetMember(session->GetPlayer()->GetGUID());
2091  if (!member)
2092  return;
2093 
2094  uint8 rankId = member->GetRankId();
2095 
2097  queryResult.RankID = rankId;
2098  queryResult.WithdrawGoldLimit = _GetMemberRemainingMoney(member);
2099  queryResult.Flags = _GetRankRights(rankId);
2100  queryResult.NumTabs = _GetPurchasedTabsSize();
2101  queryResult.Tab.reserve(GUILD_BANK_MAX_TABS);
2102 
2103  for (uint8 tabId = 0; tabId < GUILD_BANK_MAX_TABS; ++tabId)
2104  {
2106  tabPerm.Flags = _GetRankBankTabRights(rankId, tabId);
2107  tabPerm.WithdrawItemLimit = _GetMemberRemainingSlots(member, tabId);
2108  queryResult.Tab.push_back(tabPerm);
2109  }
2110 
2111  session->SendPacket(queryResult.Write());
2112  TC_LOG_DEBUG("guild", "SMSG_GUILD_PERMISSIONS_QUERY_RESULTS [%s] Rank: %u", session->GetPlayerInfo().c_str(), rankId);
2113 }
int32 WithdrawGoldLimit
Definition: GuildPackets.h:420
const Member * GetMember(ObjectGuid guid) const
Definition: Guild.h:924
int8 _GetRankBankTabRights(uint8 rankId, uint8 tabId) const
Definition: Guild.cpp:2947
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
Player * GetPlayer() const
Definition: WorldSession.h:927
Definition: Guild.h:44
uint8 GetRankId() const
Definition: Guild.h:369
uint8 _GetPurchasedTabsSize() const
Definition: Guild.h:920
uint32 RankID
Definition: GuildPackets.h:422
int32 _GetMemberRemainingSlots(Member const *member, uint8 tabId) const
Definition: Guild.cpp:2954
uint32 _GetRankRights(uint8 rankId) const
Definition: Guild.cpp:2925
void SendPacket(WorldPacket const *packet, bool forced=false)
Send a packet to the client.
Definition: WorldSession.cpp:211
int32 NumTabs
Definition: GuildPackets.h:419
int32 Flags
Definition: GuildPackets.h:421
WorldPacket const * Write() override
Definition: GuildPackets.cpp:286
std::string GetPlayerInfo() const
Definition: WorldSession.cpp:195
std::vector< GuildRankTabPermissions > Tab
Definition: GuildPackets.h:423
uint8_t uint8
Definition: Define.h:152
int32 _GetMemberRemainingMoney(Member const *member) const
Definition: Guild.cpp:2971

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Guild::SendQueryResponse ( WorldSession session)
1324 {
1326  response.GuildGuid = GetGUID();
1327  response.Info = boost::in_place();
1328 
1329  response.Info->GuildGUID = GetGUID();
1330  response.Info->VirtualRealmAddress = GetVirtualRealmAddress();
1331 
1332  response.Info->EmblemStyle = m_emblemInfo.GetStyle();
1333  response.Info->EmblemColor = m_emblemInfo.GetColor();
1334  response.Info->BorderStyle = m_emblemInfo.GetBorderStyle();
1335  response.Info->BorderColor = m_emblemInfo.GetBorderColor();
1336  response.Info->BackgroundColor = m_emblemInfo.GetBackgroundColor();
1337 
1338  for (uint8 i = 0; i < _GetRanksSize(); ++i)
1339  {
1341  (m_ranks[i].GetId(), i, m_ranks[i].GetName());
1342  response.Info->Ranks.insert(info);
1343  }
1344 
1345  response.Info->GuildName = m_name;
1346 
1347  session->SendPacket(response.Write());
1348  TC_LOG_DEBUG("guild", "SMSG_GUILD_QUERY_RESPONSE [%s]", session->GetPlayerInfo().c_str());
1349 }
EmblemInfo m_emblemInfo
Definition: Guild.h:890
ObjectGuid GuildGuid
Definition: GuildPackets.h:80
std::string const & GetName() const
Definition: Guild.h:766
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
uint32 GetBorderColor() const
Definition: Guild.h:277
uint32 GetBorderStyle() const
Definition: Guild.h:276
Optional< GuildInfo > Info
Definition: GuildPackets.h:81
uint8 _GetRanksSize() const
Definition: Guild.h:907
uint32 GetColor() const
Definition: Guild.h:275
ObjectGuid::LowType GetId() const
Definition: Guild.h:763
std::string m_name
Definition: Guild.h:884
uint32 GetStyle() const
Definition: Guild.h:274
ObjectGuid GetGUID() const
Definition: Guild.h:764
void SendPacket(WorldPacket const *packet, bool forced=false)
Send a packet to the client.
Definition: WorldSession.cpp:211
Ranks m_ranks
Definition: Guild.h:894
Definition: GuildPackets.h:41
std::string GetPlayerInfo() const
Definition: WorldSession.cpp:195
uint32 GetVirtualRealmAddress()
Definition: World.cpp:3487
uint8_t uint8
Definition: Define.h:152
uint32 GetBackgroundColor() const
Definition: Guild.h:278
WorldPacket const * Write() override
Definition: GuildPackets.cpp:29

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Guild::SendSaveEmblemResult ( WorldSession session,
GuildEmblemError  errCode 
)
static
66 {
68  saveResponse.Error = int32(errCode);
69  session->SendPacket(saveResponse.Write());
70 
71  TC_LOG_DEBUG("guild", "Sent SMSG_SAVE_GUILD_EMBLEM [%s] Code: %u", session->GetPlayerInfo().c_str(), errCode);
72 }
int32 Error
Definition: GuildPackets.h:1007
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
Definition: GuildPackets.h:1000
void SendPacket(WorldPacket const *packet, bool forced=false)
Send a packet to the client.
Definition: WorldSession.cpp:211
std::string GetPlayerInfo() const
Definition: WorldSession.cpp:195
int32_t int32
Definition: g3dmath.h:167
WorldPacket const * Write() override
Definition: GuildPackets.cpp:811

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Guild::SetBankTabText ( uint8  tabId,
std::string const text 
)
2755 {
2756  if (BankTab* pTab = GetBankTab(tabId))
2757  {
2758  pTab->SetText(text);
2759  pTab->SendText(this, NULL);
2760 
2762  eventPacket.Tab = tabId;
2763  BroadcastPacket(eventPacket.Write());
2764  }
2765 }
int32 Tab
Definition: GuildPackets.h:387
WorldPacket const * Write() override
Definition: GuildPackets.cpp:355
arena_t NULL
Definition: jemalloc_internal.h:624
BankTab * GetBankTab(uint8 tabId)
Definition: Guild.h:921
void BroadcastPacket(WorldPacket const *packet) const
Definition: Guild.cpp:2520
Definition: GuildPackets.h:380

+ Here is the call graph for this function:

bool Guild::SetName ( std::string const name)
1238 {
1239  if (m_name == name || name.empty() || name.length() > 24 || sObjectMgr->IsReservedName(name) || !ObjectMgr::IsValidCharterName(name))
1240  return false;
1241 
1242  m_name = name;
1244  stmt->setString(0, m_name);
1245  stmt->setUInt64(1, GetId());
1246  CharacterDatabase.Execute(stmt);
1247 
1248  /* TODO 6.x update me
1249  ObjectGuid guid = GetGUID();
1250  WorldPacket data(SMSG_GUILD_NAME_CHANGED, 24 + 8 + 1);
1251  data.WriteBit(guid[5]);
1252  data.WriteBits(name.length(), 8);
1253  data.WriteBit(guid[4]);
1254  data.WriteBit(guid[0]);
1255  data.WriteBit(guid[6]);
1256  data.WriteBit(guid[3]);
1257  data.WriteBit(guid[1]);
1258  data.WriteBit(guid[7]);
1259  data.WriteBit(guid[2]);
1260 
1261  data.WriteByteSeq(guid[3]);
1262  data.WriteByteSeq(guid[2]);
1263  data.WriteByteSeq(guid[7]);
1264  data.WriteByteSeq(guid[1]);
1265  data.WriteByteSeq(guid[0]);
1266  data.WriteByteSeq(guid[6]);
1267  data.WriteString(name);
1268  data.WriteByteSeq(guid[4]);
1269  data.WriteByteSeq(guid[5]);
1270 
1271  BroadcastPacket(&data); */
1272  return true;
1273 }
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
void setString(const uint8 index, const std::string &value)
Definition: PreparedStatement.cpp:187
#define sObjectMgr
Definition: ObjectMgr.h:1567
Definition: PreparedStatement.h:74
Definition: CharacterDatabase.h:160
ObjectGuid::LowType GetId() const
Definition: Guild.h:763
std::string m_name
Definition: Guild.h:884
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
static bool IsValidCharterName(std::string const &name)
Definition: ObjectMgr.cpp:7605
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:

+ Here is the caller graph for this function:

void Guild::SwapItems ( Player player,
uint8  tabId,
uint8  slotId,
uint8  destTabId,
uint8  destSlotId,
uint32  splitedAmount 
)
2727 {
2728  if (tabId >= _GetPurchasedTabsSize() || slotId >= GUILD_BANK_MAX_SLOTS ||
2729  destTabId >= _GetPurchasedTabsSize() || destSlotId >= GUILD_BANK_MAX_SLOTS)
2730  return;
2731 
2732  if (tabId == destTabId && slotId == destSlotId)
2733  return;
2734 
2735  BankMoveItemData from(this, player, tabId, slotId);
2736  BankMoveItemData to(this, player, destTabId, destSlotId);
2737  _MoveItems(&from, &to, splitedAmount);
2738 }
void _MoveItems(MoveItemData *pSrc, MoveItemData *pDest, uint32 splitedAmount)
Definition: Guild.cpp:3057
uint8 _GetPurchasedTabsSize() const
Definition: Guild.h:920
Definition: Guild.h:45

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Guild::SwapItemsWithInventory ( Player player,
bool  toChar,
uint8  tabId,
uint8  slotId,
uint8  playerBag,
uint8  playerSlotId,
uint32  splitedAmount 
)
2741 {
2742  if ((slotId >= GUILD_BANK_MAX_SLOTS && slotId != NULL_SLOT) || tabId >= _GetPurchasedTabsSize())
2743  return;
2744 
2745  BankMoveItemData bankData(this, player, tabId, slotId);
2746  PlayerMoveItemData charData(this, player, playerBag, playerSlotId);
2747  if (toChar)
2748  _MoveItems(&bankData, &charData, splitedAmount);
2749  else
2750  _MoveItems(&charData, &bankData, splitedAmount);
2751 }
Definition: Unit.h:379
void _MoveItems(MoveItemData *pSrc, MoveItemData *pDest, uint32 splitedAmount)
Definition: Guild.cpp:3057
uint8 _GetPurchasedTabsSize() const
Definition: Guild.h:920
Definition: Guild.h:45

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Guild::UpdateAchievementCriteria ( AchievementCriteriaTypes  type,
uint64  miscValue1,
uint64  miscValue2,
uint64  miscValue3,
Unit unit,
Player player 
)
3388 {
3389  m_achievementMgr.UpdateAchievementCriteria(type, miscValue1, miscValue2, miscValue3, unit, player);
3390 }
AchievementMgr< Guild > m_achievementMgr
Definition: Guild.h:902
void UpdateAchievementCriteria(AchievementCriteriaTypes type, uint64 miscValue1=0, uint64 miscValue2=0, uint64 miscValue3=0, Unit const *unit=NULL, Player *referencePlayer=NULL)
Definition: AchievementMgr.cpp:969

+ Here is the call graph for this function:

void Guild::UpdateMemberData ( Player player,
uint8  dataid,
uint32  value 
)
1205 {
1206  if (Member* member = GetMember(player->GetGUID()))
1207  {
1208  switch (dataid)
1209  {
1211  member->SetZoneId(value);
1212  break;
1214  member->SetAchievementPoints(value);
1215  break;
1217  member->SetLevel(value);
1218  break;
1219  default:
1220  TC_LOG_ERROR("guild", "Guild::UpdateMemberData: Called with incorrect DATAID %u (value %u)", dataid, value);
1221  return;
1222  }
1223  //HandleRoster();
1224  }
1225 }
const Member * GetMember(ObjectGuid guid) const
Definition: Guild.h:924
Definition: Guild.h:58
Definition: Guild.h:60
const FieldDescriptor value
Definition: descriptor.h:1522
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207

+ Here is the call graph for this function:

bool Guild::Validate ( )
2410 {
2411  // Validate ranks data
2412  // GUILD RANKS represent a sequence starting from 0 = GUILD_MASTER (ALL PRIVILEGES) to max 9 (lowest privileges).
2413  // The lower rank id is considered higher rank - so promotion does rank-- and demotion does rank++
2414  // Between ranks in sequence cannot be gaps - so 0, 1, 2, 4 is impossible
2415  // Min ranks count is 2 and max is 10.
2416  bool broken_ranks = false;
2417  uint8 ranks = _GetRanksSize();
2418  if (ranks < GUILD_RANKS_MIN_COUNT || ranks > GUILD_RANKS_MAX_COUNT)
2419  {
2420  TC_LOG_ERROR("guild", "Guild " UI64FMTD " has invalid number of ranks, creating new...", m_id);
2421  broken_ranks = true;
2422  }
2423  else
2424  {
2425  for (uint8 rankId = 0; rankId < ranks; ++rankId)
2426  {
2427  RankInfo* rankInfo = GetRankInfo(rankId);
2428  if (rankInfo->GetId() != rankId)
2429  {
2430  TC_LOG_ERROR("guild", "Guild " UI64FMTD " has broken rank id %u, creating default set of ranks...", m_id, rankId);
2431  broken_ranks = true;
2432  }
2433  else
2434  {
2436  rankInfo->CreateMissingTabsIfNeeded(_GetPurchasedTabsSize(), trans, true);
2438  }
2439  }
2440  }
2441 
2442  if (broken_ranks)
2443  {
2444  m_ranks.clear();
2446  }
2447 
2448  // Validate members' data
2449  for (Members::iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
2450  if (itr->second->GetRankId() > _GetRanksSize())
2451  itr->second->ChangeRank(_GetLowestRankId());
2452 
2453  // Repair the structure of the guild.
2454  // If the guildmaster doesn't exist or isn't member of the guild
2455  // attempt to promote another member.
2456  Member* pLeader = GetMember(m_leaderGuid);
2457  if (!pLeader)
2458  {
2460  // If no more members left, disband guild
2461  if (m_members.empty())
2462  {
2463  Disband();
2464  return false;
2465  }
2466  }
2467  else if (!pLeader->IsRank(GR_GUILDMASTER))
2468  _SetLeaderGUID(pLeader);
2469 
2470  // Check config if multiple guildmasters are allowed
2471  if (!sConfigMgr->GetBoolDefault("Guild.AllowMultipleGuildMaster", 0))
2472  for (Members::iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
2473  if (itr->second->GetRankId() == GR_GUILDMASTER && !itr->second->IsSamePlayer(m_leaderGuid))
2474  itr->second->ChangeRank(GR_OFFICER);
2475 
2477  return true;
2478 }
Definition: Guild.h:66
const Member * GetMember(ObjectGuid guid) const
Definition: Guild.h:924
uint8 _GetLowestRankId() const
Definition: Guild.h:918
SQLTransaction BeginTransaction()
Begins an automanaged transaction pointer that will automatically rollback if not commited...
Definition: DatabaseWorkerPool.h:221
#define sConfigMgr
Definition: Config.h:61
void DeleteMember(ObjectGuid guid, bool isDisbanding=false, bool isKicked=false, bool canDeleteGuild=false)
Definition: Guild.cpp:2646
void Disband()
Definition: Guild.cpp:1140
void CommitTransaction(SQLTransaction transaction)
Definition: DatabaseWorkerPool.cpp:179
uint8 _GetPurchasedTabsSize() const
Definition: Guild.h:920
ObjectGuid m_leaderGuid
Definition: Guild.h:885
uint8 _GetRanksSize() const
Definition: Guild.h:907
Definition: Guild.h:67
#define UI64FMTD
Definition: Define.h:137
Members m_members
Definition: Guild.h:895
void _SetLeaderGUID(Member *pLeader)
Definition: Guild.cpp:2889
Ranks m_ranks
Definition: Guild.h:894
const RankInfo * GetRankInfo(uint8 rankId) const
Definition: Guild.h:908
ObjectGuid::LowType m_id
Definition: Guild.h:883
void _UpdateAccountsNumber()
Definition: Guild.cpp:2837
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
Definition: Guild.h:48
#define DEFAULT_LOCALE
Definition: Common.h:134
void _CreateDefaultGuildRanks(LocaleConstant loc)
Definition: Guild.cpp:2800
std::shared_ptr< Transaction > SQLTransaction
Definition: Transaction.h:58

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

uint8 Guild::_level
protected
uint32 Guild::m_accountsNumber
protected
AchievementMgr<Guild> Guild::m_achievementMgr
protected
LogHolder* Guild::m_bankEventLog[GUILD_BANK_MAX_TABS+1]
protected
uint64 Guild::m_bankMoney
protected
BankTabs Guild::m_bankTabs
protected
time_t Guild::m_createdDate
protected
EmblemInfo Guild::m_emblemInfo
protected
LogHolder* Guild::m_eventLog
protected
ObjectGuid::LowType Guild::m_id
protected
std::string Guild::m_info
protected
ObjectGuid Guild::m_leaderGuid
protected
Members Guild::m_members
protected
std::string Guild::m_motd
protected
std::string Guild::m_name
protected
LogHolder* Guild::m_newsLog
protected
Ranks Guild::m_ranks
protected

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