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

#include <GuildFinderMgr.h>

Public Member Functions

void LoadFromDB ()
 
void SetGuildSettings (ObjectGuid const &guildGuid, LFGuildSettings const &settings)
 Stores guild settings and begins an asynchronous database insert. More...
 
LFGuildSettings constGetGuildSettings (ObjectGuid const &guildGuid)
 Returns settings for a guild. More...
 
void AddMembershipRequest (ObjectGuid const &guildGuid, MembershipRequest const &request)
 Files a membership request to a guild. More...
 
void RemoveAllMembershipRequestsFromPlayer (ObjectGuid const &playerId)
 Removes all membership request from a player. More...
 
void RemoveMembershipRequest (ObjectGuid const &playerId, ObjectGuid const &guildId)
 Removes a membership request to a guild. More...
 
void DeleteGuild (ObjectGuid const &guildId)
 Wipes everything related to a guild. Used when that guild is disbanded. More...
 
std::unordered_map< ObjectGuid,
MembershipRequest > const
GetAllMembershipRequestsForGuild (ObjectGuid const &guildGuid)
 Returns a set of membership requests for a guild. More...
 
std::vector< MembershipRequest
const * > 
GetAllMembershipRequestsForPlayer (ObjectGuid const &playerGuid)
 Returns a list of membership requests for a player. More...
 
std::vector< LFGuildSettings
const * > 
GetGuildsMatchingSetting (LFGuildPlayer &settings, TeamId faction)
 Returns a store of guilds matching the settings provided, using bitmask operators. More...
 
bool HasRequest (ObjectGuid const &playerId, ObjectGuid const &guildId)
 Provided a player guid and a guild guid, determines if a pending request is filed with these keys. More...
 
uint8 CountRequestsFromPlayer (ObjectGuid const &playerId)
 Counts the amount of pending membership requests, given the player's db guid. More...
 

Static Public Member Functions

static void SendApplicantListUpdate (Guild *guild)
 
static void SendMembershipRequestListUpdate (Player *player)
 
static GuildFinderMgrinstance ()
 

Private Member Functions

 GuildFinderMgr ()
 
 ~GuildFinderMgr ()
 
void LoadGuildSettings ()
 
void LoadMembershipRequests ()
 

Private Attributes

LFGuildStore _guildSettings
 
std::unordered_map< ObjectGuid,
std::unordered_map< ObjectGuid,
MembershipRequest > > 
_membershipRequestsByGuild
 
std::unordered_map< ObjectGuid,
std::unordered_map< ObjectGuid,
MembershipRequest > > 
_membershipRequestsByPlayer
 

Constructor & Destructor Documentation

GuildFinderMgr::GuildFinderMgr ( )
private
25 {
26 }
GuildFinderMgr::~GuildFinderMgr ( )
private
29 {
30 }

Member Function Documentation

void GuildFinderMgr::AddMembershipRequest ( ObjectGuid const guildGuid,
MembershipRequest const request 
)

Files a membership request to a guild.

Parameters
guildGuidThe guild's database GUID.
MembershipRequestAn object storing all data related to the request.
117 {
118  _membershipRequestsByGuild[guildGuid][request.GetPlayerGUID()] = request;
119  _membershipRequestsByPlayer[request.GetPlayerGUID()][guildGuid] = request;
120 
123  stmt->setUInt64(0, request.GetGuildGuid().GetCounter());
124  stmt->setUInt64(1, request.GetPlayerGUID().GetCounter());
125  stmt->setUInt8(2, request.GetAvailability());
126  stmt->setUInt8(3, request.GetClassRoles());
127  stmt->setUInt8(4, request.GetInterests());
128  stmt->setString(5, request.GetComment());
129  stmt->setUInt32(6, request.GetSubmitTime());
130  trans->Append(stmt);
132 
133  // Notify the applicant his submittion has been added
134  if (Player* player = ObjectAccessor::FindPlayer(request.GetPlayerGUID()))
136 
137  // Notify the guild master and officers the list changed
138  if (Guild* guild = sGuildMgr->GetGuildByGuid(guildGuid))
140 }
#define sGuildMgr
Definition: GuildMgr.h:61
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
void setString(const uint8 index, const std::string &value)
Definition: PreparedStatement.cpp:187
Definition: PreparedStatement.h:74
void CommitTransaction(SQLTransaction transaction)
Definition: DatabaseWorkerPool.cpp:179
Definition: CharacterDatabase.h:513
TC_GAME_API Player * FindPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:209
std::unordered_map< ObjectGuid, std::unordered_map< ObjectGuid, MembershipRequest > > _membershipRequestsByGuild
Definition: GuildFinderMgr.h:191
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
static void SendApplicantListUpdate(Guild *guild)
Definition: GuildFinderMgr.cpp:330
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
std::unordered_map< ObjectGuid, std::unordered_map< ObjectGuid, MembershipRequest > > _membershipRequestsByPlayer
Definition: GuildFinderMgr.h:192
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
Definition: Guild.h:320
static void SendMembershipRequestListUpdate(Player *player)
Definition: GuildFinderMgr.cpp:338
std::shared_ptr< Transaction > SQLTransaction
Definition: Transaction.h:58

+ Here is the call graph for this function:

uint8 GuildFinderMgr::CountRequestsFromPlayer ( ObjectGuid const playerId)

Counts the amount of pending membership requests, given the player's db guid.

225 {
226  auto playerItr = _membershipRequestsByPlayer.find(playerId);
227  return playerItr != _membershipRequestsByPlayer.end() ? playerItr->second.size() : 0;
228 }
std::unordered_map< ObjectGuid, std::unordered_map< ObjectGuid, MembershipRequest > > _membershipRequestsByPlayer
Definition: GuildFinderMgr.h:192
void GuildFinderMgr::DeleteGuild ( ObjectGuid const guildId)

Wipes everything related to a guild. Used when that guild is disbanded.

290 {
292  auto guildItr = _membershipRequestsByGuild.find(guildId);
293  if (guildItr != _membershipRequestsByGuild.end())
294  {
295  for (auto playerRequestPair : guildItr->second)
296  {
298  stmt->setUInt64(0, guildId.GetCounter());
299  stmt->setUInt64(1, playerRequestPair.first.GetCounter());
300  trans->Append(stmt);
301 
302  auto playerItr = _membershipRequestsByPlayer.find(playerRequestPair.first);
303  if (playerItr != _membershipRequestsByPlayer.end())
304  {
305  playerItr->second.erase(guildId);
306  if (playerItr->second.empty())
307  _membershipRequestsByPlayer.erase(playerItr);
308  }
309 
310  // Notify the applicant his submition has been removed
311  if (Player* player = ObjectAccessor::FindPlayer(playerRequestPair.first))
313  }
314  }
315 
317  stmt->setUInt64(0, guildId.GetCounter());
318  trans->Append(stmt);
319 
321 
322  _membershipRequestsByGuild.erase(guildId);
323  _guildSettings.erase(guildId);
324 
325  // Notify the guild master the list changed (even if he's not a GM any more, not sure if needed)
326  if (Guild* guild = sGuildMgr->GetGuildByGuid(guildId))
328 }
LFGuildStore _guildSettings
Definition: GuildFinderMgr.h:189
#define sGuildMgr
Definition: GuildMgr.h:61
SQLTransaction BeginTransaction()
Begins an automanaged transaction pointer that will automatically rollback if not commited...
Definition: DatabaseWorkerPool.h:221
Definition: CharacterDatabase.h:514
Definition: PreparedStatement.h:74
void CommitTransaction(SQLTransaction transaction)
Definition: DatabaseWorkerPool.cpp:179
TC_GAME_API Player * FindPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:209
std::unordered_map< ObjectGuid, std::unordered_map< ObjectGuid, MembershipRequest > > _membershipRequestsByGuild
Definition: GuildFinderMgr.h:191
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
static void SendApplicantListUpdate(Guild *guild)
Definition: GuildFinderMgr.cpp:330
Definition: CharacterDatabase.h:516
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
std::unordered_map< ObjectGuid, std::unordered_map< ObjectGuid, MembershipRequest > > _membershipRequestsByPlayer
Definition: GuildFinderMgr.h:192
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
Definition: Guild.h:320
static void SendMembershipRequestListUpdate(Player *player)
Definition: GuildFinderMgr.cpp:338
std::shared_ptr< Transaction > SQLTransaction
Definition: Transaction.h:58

+ Here is the call graph for this function:

std::unordered_map<ObjectGuid, MembershipRequest> const* GuildFinderMgr::GetAllMembershipRequestsForGuild ( ObjectGuid const guildGuid)
inline

Returns a set of membership requests for a guild.

Parameters
guildGuidThe guild's database guid.
241  {
242  auto itr = _membershipRequestsByGuild.find(guildGuid);
243  return itr != _membershipRequestsByGuild.end() ? &itr->second : nullptr;
244  }
std::unordered_map< ObjectGuid, std::unordered_map< ObjectGuid, MembershipRequest > > _membershipRequestsByGuild
Definition: GuildFinderMgr.h:191
std::vector< MembershipRequest const * > GuildFinderMgr::GetAllMembershipRequestsForPlayer ( ObjectGuid const playerGuid)

Returns a list of membership requests for a player.

Parameters
playerGuidThe player's database guid.
211 {
212  std::vector<MembershipRequest const*> resultSet;
213  auto playerItr = _membershipRequestsByPlayer.find(playerGuid);
214  if (playerItr == _membershipRequestsByPlayer.end())
215  return resultSet;
216 
217  resultSet.reserve(playerItr->second.size());
218  for (auto const& guildRequestPair : playerItr->second)
219  resultSet.push_back(&guildRequestPair.second);
220 
221  return resultSet;
222 }
std::unordered_map< ObjectGuid, std::unordered_map< ObjectGuid, MembershipRequest > > _membershipRequestsByPlayer
Definition: GuildFinderMgr.h:192
LFGuildSettings const& GuildFinderMgr::GetGuildSettings ( ObjectGuid const guildGuid)
inline

Returns settings for a guild.

Parameters
guildGuidThe guild's database guid.
211 { return _guildSettings[guildGuid]; }
LFGuildStore _guildSettings
Definition: GuildFinderMgr.h:189
std::vector< LFGuildSettings const * > GuildFinderMgr::GetGuildsMatchingSetting ( LFGuildPlayer settings,
TeamId  faction 
)

Returns a store of guilds matching the settings provided, using bitmask operators.

Parameters
settingsThe player's finder settings
teamIdThe player's faction (TEAM_ALLIANCE or TEAM_HORDE)
231 {
232  std::vector<LFGuildSettings const*> resultSet;
233  for (LFGuildStore::const_iterator itr = _guildSettings.begin(); itr != _guildSettings.end(); ++itr)
234  {
235  LFGuildSettings const& guildSettings = itr->second;
236 
237  if (!guildSettings.IsListed())
238  continue;
239 
240  if (guildSettings.GetTeam() != faction)
241  continue;
242 
243  if (!(guildSettings.GetAvailability() & settings.GetAvailability()))
244  continue;
245 
246  if (!(guildSettings.GetClassRoles() & settings.GetClassRoles()))
247  continue;
248 
249  if (!(guildSettings.GetInterests() & settings.GetInterests()))
250  continue;
251 
252  if (!(guildSettings.GetLevel() & settings.GetLevel()))
253  continue;
254 
255  resultSet.push_back(&itr->second);
256  }
257 
258  return resultSet;
259 }
LFGuildStore _guildSettings
Definition: GuildFinderMgr.h:189
uint8 GetClassRoles() const
Definition: GuildFinderMgr.h:140
uint8 GetLevel() const
Definition: GuildFinderMgr.h:143
bool IsListed() const
Definition: GuildFinderMgr.h:172
Holds settings for a guild in the finder system. Saved to database.
Definition: GuildFinderMgr.h:156
uint8 GetAvailability() const
Definition: GuildFinderMgr.h:141
TeamId GetTeam() const
Definition: GuildFinderMgr.h:175
uint8 GetInterests() const
Definition: GuildFinderMgr.h:142

+ Here is the call graph for this function:

bool GuildFinderMgr::HasRequest ( ObjectGuid const playerId,
ObjectGuid const guildId 
)

Provided a player guid and a guild guid, determines if a pending request is filed with these keys.

262 {
263  auto guildItr = _membershipRequestsByGuild.find(guildId);
264  if (guildItr == _membershipRequestsByGuild.end())
265  return false;
266 
267  return guildItr->second.count(playerId) > 0;
268 }
std::unordered_map< ObjectGuid, std::unordered_map< ObjectGuid, MembershipRequest > > _membershipRequestsByGuild
Definition: GuildFinderMgr.h:191
GuildFinderMgr * GuildFinderMgr::instance ( )
static
344 {
345  static GuildFinderMgr instance;
346  return &instance;
347 }
static GuildFinderMgr * instance()
Definition: GuildFinderMgr.cpp:343
Definition: GuildFinderMgr.h:183
void GuildFinderMgr::LoadFromDB ( )
33 {
36 }
void LoadMembershipRequests()
Definition: GuildFinderMgr.cpp:79
void LoadGuildSettings()
Definition: GuildFinderMgr.cpp:38

+ Here is the call graph for this function:

void GuildFinderMgr::LoadGuildSettings ( )
private
39 {
40  TC_LOG_INFO("server.loading", "Loading guild finder guild-related settings...");
41  // 0 1 2 3 4 5 6 7
42  QueryResult result = CharacterDatabase.Query("SELECT gfgs.guildId, gfgs.availability, gfgs.classRoles, gfgs.interests, gfgs.level, gfgs.listed, gfgs.comment, c.race "
43  "FROM guild_finder_guild_settings gfgs "
44  "LEFT JOIN guild_member gm ON gm.guildid=gfgs.guildId "
45  "LEFT JOIN characters c ON c.guid = gm.guid LIMIT 1");
46 
47  if (!result)
48  {
49  TC_LOG_INFO("server.loading", ">> Loaded 0 guild finder guild-related settings. Table `guild_finder_guild_settings` is empty.");
50  return;
51  }
52 
53  uint32 count = 0;
54  uint32 oldMSTime = getMSTime();
55  do
56  {
57  Field* fields = result->Fetch();
58  ObjectGuid guildId = ObjectGuid::Create<HighGuid::Guild>(fields[0].GetUInt64());
59  uint8 availability = fields[1].GetUInt8();
60  uint8 classRoles = fields[2].GetUInt8();
61  uint8 interests = fields[3].GetUInt8();
62  uint8 level = fields[4].GetUInt8();
63  bool listed = (fields[5].GetUInt8() != 0);
64  std::string comment = fields[6].GetString();
65 
66  TeamId guildTeam = TEAM_NEUTRAL;
67  if (ChrRacesEntry const* raceEntry = sChrRacesStore.LookupEntry(fields[7].GetUInt8()))
68  guildTeam = (TeamId)raceEntry->TeamID;
69 
70  LFGuildSettings settings(listed, guildTeam, guildId, classRoles, availability, interests, level, comment);
71  _guildSettings[guildId] = settings;
72 
73  ++count;
74  } while (result->NextRow());
75 
76  TC_LOG_INFO("server.loading", ">> Loaded %u guild finder guild-related settings in %u ms.", count, GetMSTimeDiffToNow(oldMSTime));
77 }
DBCStorage< ChrRacesEntry > sChrRacesStore(ChrRacesfmt)
uint64 GetUInt64() const
Definition: Field.h:184
Definition: DBCStructure.h:204
LFGuildStore _guildSettings
Definition: GuildFinderMgr.h:189
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
Holds settings for a guild in the finder system. Saved to database.
Definition: GuildFinderMgr.h:156
Definition: SharedDefines.h:994
uint8 GetUInt8() const
Definition: Field.h:70
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
TeamId
Definition: SharedDefines.h:990
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint8_t uint8
Definition: Define.h:152
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
Definition: ObjectGuid.h:189
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 GuildFinderMgr::LoadMembershipRequests ( )
private
80 {
81  TC_LOG_INFO("server.loading", "Loading guild finder membership requests...");
82  // 0 1 2 3 4 5 6
83  QueryResult result = CharacterDatabase.Query("SELECT guildId, playerGuid, availability, classRole, interests, comment, submitTime "
84  "FROM guild_finder_applicant");
85 
86  if (!result)
87  {
88  TC_LOG_INFO("server.loading", ">> Loaded 0 guild finder membership requests. Table `guild_finder_applicant` is empty.");
89  return;
90  }
91 
92  uint32 count = 0;
93  uint32 oldMSTime = getMSTime();
94  do
95  {
96  Field* fields = result->Fetch();
97  ObjectGuid guildId = ObjectGuid::Create<HighGuid::Guild>(fields[0].GetUInt64());
98  ObjectGuid playerId = ObjectGuid::Create<HighGuid::Player>(fields[1].GetUInt64());
99  uint8 availability = fields[2].GetUInt8();
100  uint8 classRoles = fields[3].GetUInt8();
101  uint8 interests = fields[4].GetUInt8();
102  std::string comment = fields[5].GetString();
103  uint32 submitTime = fields[6].GetUInt32();
104 
105  MembershipRequest request(playerId, guildId, availability, classRoles, interests, comment, time_t(submitTime));
106 
107  _membershipRequestsByGuild[guildId][playerId] = request;
108  _membershipRequestsByPlayer[playerId][guildId] = request;
109 
110  ++count;
111  } while (result->NextRow());
112 
113  TC_LOG_INFO("server.loading", ">> Loaded %u guild finder membership requests in %u ms.", count, GetMSTimeDiffToNow(oldMSTime));
114 }
uint64 GetUInt64() const
Definition: Field.h:184
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
uint8 GetUInt8() const
Definition: Field.h:70
uint32_t uint32
Definition: Define.h:150
Holds all required informations about a membership request.
Definition: GuildFinderMgr.h:58
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
std::unordered_map< ObjectGuid, std::unordered_map< ObjectGuid, MembershipRequest > > _membershipRequestsByGuild
Definition: GuildFinderMgr.h:191
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint32 GetUInt32() const
Definition: Field.h:146
uint8_t uint8
Definition: Define.h:152
std::unordered_map< ObjectGuid, std::unordered_map< ObjectGuid, MembershipRequest > > _membershipRequestsByPlayer
Definition: GuildFinderMgr.h:192
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
Definition: ObjectGuid.h:189
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 GuildFinderMgr::RemoveAllMembershipRequestsFromPlayer ( ObjectGuid const playerId)

Removes all membership request from a player.

Parameters
playerIdThe player's database guid whose application shall be deleted.
143 {
144  auto playerItr = _membershipRequestsByPlayer.find(playerId);
145  if (playerItr == _membershipRequestsByPlayer.end())
146  return;
147 
149  for (auto& guildRequestPair : playerItr->second)
150  {
152  stmt->setUInt64(0, guildRequestPair.first.GetCounter());
153  stmt->setUInt64(1, playerId.GetCounter());
154  trans->Append(stmt);
155 
156  // Notify the guild master and officers the list changed
157  if (Guild* guild = sGuildMgr->GetGuildByGuid(guildRequestPair.first))
159 
160  auto guildItr = _membershipRequestsByGuild.find(guildRequestPair.first);
161  if (guildItr == _membershipRequestsByGuild.end())
162  continue;
163 
164  guildItr->second.erase(playerId);
165  if (guildItr->second.empty())
166  _membershipRequestsByGuild.erase(guildItr);
167  }
168 
170 
171  _membershipRequestsByPlayer.erase(playerItr);
172 }
#define sGuildMgr
Definition: GuildMgr.h:61
SQLTransaction BeginTransaction()
Begins an automanaged transaction pointer that will automatically rollback if not commited...
Definition: DatabaseWorkerPool.h:221
Definition: CharacterDatabase.h:514
Definition: PreparedStatement.h:74
void CommitTransaction(SQLTransaction transaction)
Definition: DatabaseWorkerPool.cpp:179
std::unordered_map< ObjectGuid, std::unordered_map< ObjectGuid, MembershipRequest > > _membershipRequestsByGuild
Definition: GuildFinderMgr.h:191
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
static void SendApplicantListUpdate(Guild *guild)
Definition: GuildFinderMgr.cpp:330
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
std::unordered_map< ObjectGuid, std::unordered_map< ObjectGuid, MembershipRequest > > _membershipRequestsByPlayer
Definition: GuildFinderMgr.h:192
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
Definition: Guild.h:320
std::shared_ptr< Transaction > SQLTransaction
Definition: Transaction.h:58

+ Here is the call graph for this function:

void GuildFinderMgr::RemoveMembershipRequest ( ObjectGuid const playerId,
ObjectGuid const guildId 
)

Removes a membership request to a guild.

Parameters
playerIdThe player's database guid whose application shall be deleted.
guildIdThe guild's database guid
175 {
176  auto guildItr = _membershipRequestsByGuild.find(guildId);
177  if (guildItr != _membershipRequestsByGuild.end())
178  {
179  guildItr->second.erase(playerId);
180  if (guildItr->second.empty())
181  _membershipRequestsByGuild.erase(guildItr);
182  }
183 
184  auto playerItr = _membershipRequestsByPlayer.find(playerId);
185  if (playerItr != _membershipRequestsByPlayer.end())
186  {
187  playerItr->second.erase(guildId);
188  if (playerItr->second.empty())
189  _membershipRequestsByPlayer.erase(playerItr);
190  }
191 
193 
195  stmt->setUInt64(0, guildId.GetCounter());
196  stmt->setUInt64(1, playerId.GetCounter());
197  trans->Append(stmt);
198 
200 
201  // Notify the applicant his submittion has been removed
202  if (Player* player = ObjectAccessor::FindPlayer(playerId))
204 
205  // Notify the guild master and officers the list changed
206  if (Guild* guild = sGuildMgr->GetGuildByGuid(guildId))
208 }
#define sGuildMgr
Definition: GuildMgr.h:61
SQLTransaction BeginTransaction()
Begins an automanaged transaction pointer that will automatically rollback if not commited...
Definition: DatabaseWorkerPool.h:221
Definition: CharacterDatabase.h:514
Definition: PreparedStatement.h:74
void CommitTransaction(SQLTransaction transaction)
Definition: DatabaseWorkerPool.cpp:179
TC_GAME_API Player * FindPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:209
std::unordered_map< ObjectGuid, std::unordered_map< ObjectGuid, MembershipRequest > > _membershipRequestsByGuild
Definition: GuildFinderMgr.h:191
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
static void SendApplicantListUpdate(Guild *guild)
Definition: GuildFinderMgr.cpp:330
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
std::unordered_map< ObjectGuid, std::unordered_map< ObjectGuid, MembershipRequest > > _membershipRequestsByPlayer
Definition: GuildFinderMgr.h:192
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
Definition: Guild.h:320
static void SendMembershipRequestListUpdate(Player *player)
Definition: GuildFinderMgr.cpp:338
std::shared_ptr< Transaction > SQLTransaction
Definition: Transaction.h:58

+ Here is the call graph for this function:

void GuildFinderMgr::SendApplicantListUpdate ( Guild guild)
static
331 {
333  guild->BroadcastPacketToRank(applicantListChanged.Write(), GR_OFFICER);
334  if (Player* player = ObjectAccessor::FindPlayer(guild->GetLeaderGUID()))
335  player->SendDirectMessage(applicantListChanged.GetRawPacket());
336 }
ObjectGuid GetLeaderGUID() const
Definition: Guild.h:765
void BroadcastPacketToRank(WorldPacket const *packet, uint8 rankId) const
Definition: Guild.cpp:2512
TC_GAME_API Player * FindPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:209
Definition: Guild.h:67
WorldPacket const * GetRawPacket() const
Definition: Packet.h:38
WorldPacket const * Write() override
Definition: GuildFinderPackets.h:55

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void GuildFinderMgr::SendMembershipRequestListUpdate ( Player player)
static
339 {
340  player->SendDirectMessage(WorldPackets::GuildFinder::LFGuildApplicationsListChanged().Write());
341 }

+ Here is the caller graph for this function:

void GuildFinderMgr::SetGuildSettings ( ObjectGuid const guildGuid,
LFGuildSettings const settings 
)

Stores guild settings and begins an asynchronous database insert.

Parameters
guildGuidThe guild's database guid.
LFGuildSettingsThe guild's settings storage.
271 {
272  _guildSettings[guildGuid] = settings;
273 
275 
277  stmt->setUInt64(0, settings.GetGUID().GetCounter());
278  stmt->setUInt8(1, settings.GetAvailability());
279  stmt->setUInt8(2, settings.GetClassRoles());
280  stmt->setUInt8(3, settings.GetInterests());
281  stmt->setUInt8(4, settings.GetLevel());
282  stmt->setUInt8(5, settings.IsListed());
283  stmt->setString(6, settings.GetComment());
284  trans->Append(stmt);
285 
287 }
LFGuildStore _guildSettings
Definition: GuildFinderMgr.h:189
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
void setString(const uint8 index, const std::string &value)
Definition: PreparedStatement.cpp:187
Definition: PreparedStatement.h:74
void CommitTransaction(SQLTransaction transaction)
Definition: DatabaseWorkerPool.cpp:179
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
Definition: CharacterDatabase.h:515
std::shared_ptr< Transaction > SQLTransaction
Definition: Transaction.h:58

+ Here is the call graph for this function:

Member Data Documentation

LFGuildStore GuildFinderMgr::_guildSettings
private
std::unordered_map<ObjectGuid , std::unordered_map<ObjectGuid , MembershipRequest> > GuildFinderMgr::_membershipRequestsByGuild
private
std::unordered_map<ObjectGuid , std::unordered_map<ObjectGuid , MembershipRequest> > GuildFinderMgr::_membershipRequestsByPlayer
private

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