本文整理汇总了C++中LFGuildSettings::GetAvailability方法的典型用法代码示例。如果您正苦于以下问题:C++ LFGuildSettings::GetAvailability方法的具体用法?C++ LFGuildSettings::GetAvailability怎么用?C++ LFGuildSettings::GetAvailability使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LFGuildSettings
的用法示例。
在下文中一共展示了LFGuildSettings::GetAvailability方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleGuildFinderPostRequest
void WorldSession::HandleGuildFinderPostRequest(WorldPacket& recvPacket)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_LF_GUILD_POST_REQUEST"); // Empty opcode
Player* player = GetPlayer();
if (!player->GetGuildId()) // Player must be in guild
return;
bool isGuildMaster = true;
if (Guild* guild = sGuildMgr->GetGuildById(player->GetGuildId()))
if (guild->GetLeaderGUID() != player->GetGUID())
isGuildMaster = false;
LFGuildSettings settings = sGuildFinderMgr->GetGuildSettings(player->GetGuildId());
WorldPacket data(SMSG_LF_GUILD_POST_UPDATED, 35);
data.WriteBit(isGuildMaster); // Guessed
if (isGuildMaster)
{
data.WriteBit(settings.IsListed());
data.WriteBits(settings.GetComment().size(), 11);
data << uint32(settings.GetLevel());
data << uint32(0); // Unk Int32
data << uint32(settings.GetAvailability());
data.WriteString(settings.GetComment());
data << uint32(settings.GetClassRoles());
data << uint32(settings.GetInterests());
}
else
data.FlushBits();
player->SendDirectMessage(&data);
}
示例2: HandleGuildFinderGetApplications
void WorldSession::HandleGuildFinderGetApplications(WorldPacket& /*recvPacket*/)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_LF_GUILD_GET_APPLICATIONS");
std::list<MembershipRequest> applicatedGuilds = sGuildFinderMgr->GetAllMembershipRequestsForPlayer(GetPlayer()->GetGUIDLow());
uint32 applicationsCount = applicatedGuilds.size();
WorldPacket data(SMSG_LF_GUILD_MEMBERSHIP_LIST_UPDATED);
data << uint32(10 - sGuildFinderMgr->CountRequestsFromPlayer(GetPlayer()->GetGUIDLow())); // Applications count left
data.WriteBits(applicationsCount, 19);
if (applicationsCount > 0)
{
ByteBuffer bufferData;
for (std::list<MembershipRequest>::const_iterator itr = applicatedGuilds.begin(); itr != applicatedGuilds.end(); ++itr)
{
Guild* guild = sGuildMgr->GetGuildById(itr->GetGuildId());
if (!guild)
continue;
LFGuildSettings guildSettings = sGuildFinderMgr->GetGuildSettings(itr->GetGuildId());
MembershipRequest request = *itr;
ObjectGuid guildGuid = ObjectGuid(guild->GetGUID());
data.WriteBits(request.GetComment().size(), 10);
data.WriteBits(guild->GetName().size(), 7);
data.WriteBitSeq<2, 1, 4, 0, 6, 3, 5, 7>(guildGuid);
bufferData << uint32(50397223); // unk Flags
bufferData.WriteByteSeq<1, 5, 6>(guildGuid);
bufferData.WriteString(request.GetComment());
bufferData.WriteByteSeq<0, 2>(guildGuid);
bufferData << uint32(guildSettings.GetClassRoles());
bufferData.WriteByteSeq<4>(guildGuid);
bufferData << uint32(guildSettings.GetAvailability());
bufferData.WriteString(guild->GetName());
bufferData << uint32(time(NULL) - request.GetSubmitTime()); // Time since application (seconds)
bufferData << uint32(guildSettings.GetInterests());
bufferData << uint32(request.GetExpiryTime() - time(NULL)); // Time left to application expiry (seconds)
bufferData.WriteByteSeq<7, 3>(guildGuid);
}
data.FlushBits();
data.append(bufferData);
}
else
{
data.FlushBits();
}
GetPlayer()->SendDirectMessage(&data);
}
示例3: HandleGuildFinderGetApplications
void WorldSession::HandleGuildFinderGetApplications(WorldPacket& /*recvPacket*/)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_LF_GUILD_GET_APPLICATIONS"); // Empty opcode
std::list<MembershipRequest> applicatedGuilds = sGuildFinderMgr->GetAllMembershipRequestsForPlayer(GetPlayer()->GetGUIDLow());
uint32 applicationsCount = applicatedGuilds.size();
WorldPacket data(SMSG_LF_GUILD_MEMBERSHIP_LIST_UPDATED, 7 + 54 * applicationsCount);
data.WriteBits(applicationsCount, 20);
if (applicationsCount > 0)
{
ByteBuffer bufferData(54 * applicationsCount);
for (std::list<MembershipRequest>::const_iterator itr = applicatedGuilds.begin(); itr != applicatedGuilds.end(); ++itr)
{
Guild* guild = sGuildMgr->GetGuildById(itr->GetGuildId());
LFGuildSettings guildSettings = sGuildFinderMgr->GetGuildSettings(itr->GetGuildId());
MembershipRequest request = *itr;
ObjectGuid guildGuid = ObjectGuid(guild->GetGUID());
data.WriteBit(guildGuid[1]);
data.WriteBit(guildGuid[0]);
data.WriteBit(guildGuid[5]);
data.WriteBits(request.GetComment().size(), 11);
data.WriteBit(guildGuid[3]);
data.WriteBit(guildGuid[7]);
data.WriteBit(guildGuid[4]);
data.WriteBit(guildGuid[6]);
data.WriteBit(guildGuid[2]);
data.WriteBits(guild->GetName().size(), 8);
bufferData.WriteByteSeq(guildGuid[2]);
bufferData.WriteString(request.GetComment());
bufferData.WriteByteSeq(guildGuid[5]);
bufferData.WriteString(guild->GetName());
bufferData << uint32(guildSettings.GetAvailability());
bufferData << uint32(request.GetExpiryTime() - time(NULL)); // Time left to application expiry (seconds)
bufferData.WriteByteSeq(guildGuid[0]);
bufferData.WriteByteSeq(guildGuid[6]);
bufferData.WriteByteSeq(guildGuid[3]);
bufferData.WriteByteSeq(guildGuid[7]);
bufferData << uint32(guildSettings.GetClassRoles());
bufferData.WriteByteSeq(guildGuid[4]);
bufferData.WriteByteSeq(guildGuid[1]);
bufferData << uint32(time(NULL) - request.GetSubmitTime()); // Time since application (seconds)
bufferData << uint32(guildSettings.GetInterests());
}
data.FlushBits();
data.append(bufferData);
}
data << uint32(10 - sGuildFinderMgr->CountRequestsFromPlayer(GetPlayer()->GetGUIDLow())); // Applications count left
GetPlayer()->SendDirectMessage(&data);
}
示例4: SetGuildSettings
void GuildFinderMgr::SetGuildSettings(uint32 guildGuid, LFGuildSettings const& settings)
{
m_guildSettings[guildGuid] = settings;
static SqlStatementID replaceGuildFinderSettings;
SqlStatement stmt = CharacterDatabase.CreateStatement(replaceGuildFinderSettings, "REPLACE INTO guild_finder_guild_settings (guildId, availability, classRoles, interests, level, listed, comment) VALUES(?, ?, ?, ?, ?, ?, ?)");
stmt.addUInt32(settings.GetGuid());
stmt.addUInt8(settings.GetAvailability());
stmt.addUInt8(settings.GetClassRoles());
stmt.addUInt8(settings.GetInterests());
stmt.addUInt8(settings.GetLevel());
stmt.addUInt8(settings.IsListed());
stmt.addString(settings.GetComment());
stmt.Execute();
}
示例5: SetGuildSettings
void GuildFinderMgr::SetGuildSettings(uint32 guildGuid, LFGuildSettings const& settings)
{
_guildSettings[guildGuid] = settings;
SQLTransaction trans = CharacterDatabase.BeginTransaction();
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_GUILD_FINDER_GUILD_SETTINGS);
stmt->setUInt32(0, settings.GetGUID());
stmt->setUInt8(1, settings.GetAvailability());
stmt->setUInt8(2, settings.GetClassRoles());
stmt->setUInt8(3, settings.GetInterests());
stmt->setUInt8(4, settings.GetLevel());
stmt->setUInt8(5, settings.IsListed());
stmt->setString(6, settings.GetComment());
trans->Append(stmt);
CharacterDatabase.CommitTransaction(trans);
}
示例6: HandleGuildFinderPostRequest
void WorldSession::HandleGuildFinderPostRequest(WorldPacket& /*recvPacket*/)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_LF_GUILD_POST_REQUEST"); // Empty opcode
Player* player = GetPlayer();
if (!player->GetGuildId()) // Player must be in guild
return;
bool isGuildMaster = true;
if (Guild* guild = sGuildMgr->GetGuildById(player->GetGuildId()))
if (guild->GetLeaderGUID() != player->GetGUID())
isGuildMaster = false;
LFGuildSettings settings = sGuildFinderMgr->GetGuildSettings(player->GetGuildId());
WorldPacket data(SMSG_LF_GUILD_POST_UPDATED);
data.WriteBit(isGuildMaster);
if (isGuildMaster)
{
data.WriteBit(settings.IsListed());
data.WriteBits(settings.GetComment().size(), 10);
data << uint32(0); // Unk Int32
if (settings.GetComment().size() > 0)
data.append(settings.GetComment().c_str(), settings.GetComment().size());
data << uint32(settings.GetAvailability());
data << uint32(settings.GetClassRoles());
data << uint32(settings.GetLevel());
data << uint32(settings.GetInterests());
}
else
data.FlushBits();
player->SendDirectMessage(&data);
}
示例7: HandleGuildFinderBrowse
void WorldSession::HandleGuildFinderBrowse(WorldPacket& recvPacket)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_LF_GUILD_BROWSE");
uint32 classRoles = 0;
uint32 availability = 0;
uint32 guildInterests = 0;
uint32 playerLevel = 0; // Raw player level (1-90), do they use MAX_FINDER_LEVEL when on level 90 ?
recvPacket >> playerLevel >> availability >> classRoles >> guildInterests;
Player* player = GetPlayer();
LFGuildPlayer settings(player->GetGUIDLow(), classRoles, availability, guildInterests, ANY_FINDER_LEVEL);
LFGuildStore guildList = sGuildFinderMgr->GetGuildsMatchingSetting(settings, player->GetTeamId());
uint32 guildCount = guildList.size();
if (guildCount == 0)
{
WorldPacket packet(SMSG_LF_GUILD_BROWSE_UPDATED);
packet.WriteBits(0, 18);
player->SendDirectMessage(&packet);
return;
}
bool returned = false;
if (!(classRoles & GUILDFINDER_ALL_ROLES) || classRoles > GUILDFINDER_ALL_ROLES)
returned = true;
if (!(availability & ALL_WEEK) || availability > ALL_WEEK)
returned = true;
if (!(guildInterests & ALL_INTERESTS) || guildInterests > ALL_INTERESTS)
returned = true;
if (playerLevel > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL) || playerLevel < 1)
returned = true;
if (returned)
{
WorldPacket packet(SMSG_LF_GUILD_BROWSE_UPDATED);
packet.WriteBits(0, 18);
player->SendDirectMessage(&packet);
return;
}
ByteBuffer bufferData;
WorldPacket data(SMSG_LF_GUILD_BROWSE_UPDATED);
data.WriteBits(guildCount, 18);
for (LFGuildStore::const_iterator itr = guildList.begin(); itr != guildList.end(); ++itr)
{
LFGuildSettings guildSettings = itr->second;
Guild* guild = sGuildMgr->GetGuildById(itr->first);
ObjectGuid guildGUID = ObjectGuid(guild->GetGUID());
data.WriteBit(guildGUID[6]);
data.WriteBit(guildGUID[5]);
data.WriteBit(guildGUID[4]);
data.WriteBit(guildGUID[0]);
data.WriteBit(guildGUID[1]);
data.WriteBits(guildSettings.GetComment().size(), 10);
data.WriteBit(guildGUID[3]);
data.WriteBits(guild->GetName().size(), 7);
data.WriteBit(guildGUID[7]);
data.WriteBit(guildGUID[2]);
bufferData.WriteByteSeq(guildGUID[3]);
bufferData << uint32(guild->GetEmblemInfo().GetStyle());
bufferData << uint8(sGuildFinderMgr->HasRequest(player->GetGUIDLow(), guild->GetGUID()));
bufferData.WriteByteSeq(guildGUID[0]);
bufferData << uint32(guild->GetAchievementMgr().GetAchievementPoints());
bufferData.WriteByteSeq(guildGUID[2]);
bufferData << uint32(guildSettings.GetInterests());
bufferData << int32(guild->GetEmblemInfo().GetBackgroundColor());
bufferData << guild->GetLevel();
bufferData << uint32(guildSettings.GetAvailability());
bufferData << uint32(guildSettings.GetClassRoles());
bufferData.WriteByteSeq(guildGUID[5]);
bufferData << uint32(0); // Unk
if (guild->GetName().size() > 0)
bufferData.append(guild->GetName().c_str(), guild->GetName().size());
bufferData << uint32(0); // Unk
bufferData << uint32(guild->GetEmblemInfo().GetBorderStyle());
bufferData.WriteByteSeq(guildGUID[7]);
bufferData << uint32(guild->GetEmblemInfo().GetColor());
bufferData.WriteByteSeq(guildGUID[6]);
bufferData << uint32(0); // Unk
if (guildSettings.GetComment().size() > 0)
bufferData.append(guildSettings.GetComment().c_str(), guildSettings.GetComment().size());
//.........这里部分代码省略.........
示例8: HandleGuildFinderBrowse
void WorldSession::HandleGuildFinderBrowse(WorldPacket& recvPacket)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_LF_GUILD_BROWSE");
uint32 classRoles = 0;
uint32 availability = 0;
uint32 guildInterests = 0;
uint32 playerLevel = 0;
recvPacket >> playerLevel >> guildInterests >> availability >> classRoles;
Player* player = GetPlayer();
LFGuildPlayer settings(player->GetGUIDLow(), classRoles, availability, guildInterests, ANY_FINDER_LEVEL);
LFGuildStore guildList = sGuildFinderMgr->GetGuildsMatchingSetting(settings, player->GetTeamId());
uint32 guildCount = guildList.size();
if (guildCount == 0)
{
WorldPacket packet(SMSG_LF_GUILD_BROWSE_UPDATED);
packet.WriteBits(0, 18);
packet.FlushBits();
player->SendDirectMessage(&packet);
return;
}
bool returned = false;
if (!(classRoles & GUILDFINDER_ALL_ROLES) || classRoles > GUILDFINDER_ALL_ROLES)
returned = true;
if (!(availability & ALL_WEEK) || availability > ALL_WEEK)
returned = true;
if (!(guildInterests & ALL_INTERESTS) || guildInterests > ALL_INTERESTS)
returned = true;
if (playerLevel > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL) || playerLevel < 1)
returned = true;
if (returned)
{
WorldPacket packet(SMSG_LF_GUILD_BROWSE_UPDATED);
packet.WriteBits(0, 18);
packet.FlushBits();
player->SendDirectMessage(&packet);
return;
}
ByteBuffer bufferData;
WorldPacket data(SMSG_LF_GUILD_BROWSE_UPDATED);
data.WriteBits(guildCount, 18);
for (LFGuildStore::const_iterator itr = guildList.begin(); itr != guildList.end(); ++itr)
{
LFGuildSettings guildSettings = itr->second;
Guild* guild = sGuildMgr->GetGuildById(itr->first);
ObjectGuid guildGUID = ObjectGuid(guild->GetGUID());
data.WriteBitSeq<4>(guildGUID);
data.WriteBits(guild->GetName().size(), 7);
data.WriteBitSeq<0, 1>(guildGUID);
data.WriteBits(guildSettings.GetComment().size(), 10);
data.WriteBitSeq<2, 7, 3, 6, 5>(guildGUID);
bufferData << uint8(sGuildFinderMgr->HasRequest(player->GetGUIDLow(), guild->GetGUID()));
bufferData << uint32(guild->GetLevel());
bufferData << uint32(guildSettings.GetInterests());
bufferData << uint32(0); // Unk
bufferData << uint32(guild->GetEmblemInfo().GetBorderStyle());
bufferData.WriteByteSeq<1, 4>(guildGUID);
bufferData << uint32(guild->GetEmblemInfo().GetStyle());
bufferData.WriteByteSeq<3>(guildGUID);
bufferData << uint32(50397223); // Unk Flags
bufferData << uint32(guild->GetEmblemInfo().GetColor());
bufferData.WriteString(guild->GetName());
bufferData << uint32(guildSettings.GetClassRoles());
bufferData << uint32(guildSettings.GetAvailability());
bufferData.WriteString(guildSettings.GetComment());
bufferData.WriteByteSeq<6, 7>(guildGUID);
bufferData << uint8(0); // Cached
bufferData.WriteByteSeq<5, 0>(guildGUID);
bufferData << uint32(guild->GetEmblemInfo().GetBorderColor());
bufferData << uint32(guild->GetMembersCount());
bufferData << uint32(guild->GetAchievementMgr().GetAchievementPoints());
bufferData.WriteByteSeq<2>(guildGUID);
bufferData << int32(guild->GetEmblemInfo().GetBackgroundColor());
}
data.FlushBits();
data.append(bufferData);
player->SendDirectMessage(&data);
}
示例9: HandleGuildFinderBrowse
void WorldSession::HandleGuildFinderBrowse(WorldPacket& recvPacket)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_LF_GUILD_BROWSE");
uint32 classRoles = 0;
uint32 availability = 0;
uint32 guildInterests = 0;
uint32 playerLevel = 0; // Raw player level (1-85), do they use MAX_FINDER_LEVEL when on level 85 ?
recvPacket >> classRoles >> availability >> guildInterests >> playerLevel;
if (!(classRoles & GUILDFINDER_ALL_ROLES) || classRoles > GUILDFINDER_ALL_ROLES)
return;
if (!(availability & AVAILABILITY_ALWAYS) || availability > AVAILABILITY_ALWAYS)
return;
if (!(guildInterests & ALL_INTERESTS) || guildInterests > ALL_INTERESTS)
return;
if (playerLevel > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL) || playerLevel < 1)
return;
Player* player = GetPlayer();
LFGuildPlayer settings(player->GetGUIDLow(), classRoles, availability, guildInterests, ANY_FINDER_LEVEL);
LFGuildStore guildList = sGuildFinderMgr->GetGuildsMatchingSetting(settings, player->GetTeamId());
uint32 guildCount = guildList.size();
if (guildCount == 0)
{
WorldPacket packet(SMSG_LF_GUILD_BROWSE_UPDATED, 0);
player->SendDirectMessage(&packet);
return;
}
ByteBuffer bufferData(65 * guildCount);
WorldPacket data(SMSG_LF_GUILD_BROWSE_UPDATED, 3 + guildCount * 65); // Estimated size
data.WriteBits(guildCount, 19);
for (LFGuildStore::const_iterator itr = guildList.begin(); itr != guildList.end(); ++itr)
{
LFGuildSettings guildSettings = itr->second;
Guild* guild = sGuildMgr->GetGuildById(itr->first);
ObjectGuid guildGUID = ObjectGuid(guild->GetGUID());
data.WriteBit(guildGUID[7]);
data.WriteBit(guildGUID[5]);
data.WriteBits(guild->GetName().size(), 8);
data.WriteBit(guildGUID[0]);
data.WriteBits(guildSettings.GetComment().size(), 11);
data.WriteBit(guildGUID[4]);
data.WriteBit(guildGUID[1]);
data.WriteBit(guildGUID[2]);
data.WriteBit(guildGUID[6]);
data.WriteBit(guildGUID[3]);
bufferData << uint32(guild->GetEmblemInfo().GetColor());
bufferData << uint32(guild->GetEmblemInfo().GetBorderStyle()); // Guessed
bufferData << uint32(guild->GetEmblemInfo().GetStyle());
bufferData.WriteString(guildSettings.GetComment());
bufferData << uint8(0); // Unk
bufferData.WriteByteSeq(guildGUID[5]);
bufferData << uint32(guildSettings.GetInterests());
bufferData.WriteByteSeq(guildGUID[6]);
bufferData.WriteByteSeq(guildGUID[4]);
bufferData << uint32(guild->GetLevel());
bufferData.WriteString(guild->GetName());
bufferData << uint32(guild->GetAchievementMgr().GetAchievementPoints());
bufferData.WriteByteSeq(guildGUID[7]);
bufferData << uint8(sGuildFinderMgr->HasRequest(player->GetGUIDLow(), guild->GetGUID())); // Request pending
bufferData.WriteByteSeq(guildGUID[2]);
bufferData.WriteByteSeq(guildGUID[0]);
bufferData << uint32(guildSettings.GetAvailability());
bufferData.WriteByteSeq(guildGUID[1]);
bufferData << uint32(guild->GetEmblemInfo().GetBackgroundColor());
bufferData << uint32(0); // Unk Int 2 (+ 128) // Always 0 or 1
bufferData << uint32(guild->GetEmblemInfo().GetBorderColor());
bufferData << uint32(guildSettings.GetClassRoles());
bufferData.WriteByteSeq(guildGUID[3]);
bufferData << uint32(guild->GetMembersCount());
}
data.FlushBits();
data.append(bufferData);
player->SendDirectMessage(&data);
}
示例10: SetGuildSettings
void GuildFinderMgr::SetGuildSettings(uint32 guildGuid, LFGuildSettings const& settings)
{
_guildSettings[guildGuid] = settings;
std::string comment = settings.GetComment();
CharacterDatabase.escape_string(comment);
CharacterDatabase.PExecute("REPLACE INTO guild_finder_guild_settings (guildId, availability, classRoles, interests, level, listed, comment) VALUES('%u', '%u', '%u', '%u', '%u', '%u', '%s')", settings.GetGUID(), settings.GetAvailability(), settings.GetClassRoles(), settings.GetInterests(), settings.GetLevel(), settings.IsListed(), comment.c_str());
}