本文整理汇总了C++中Guild::GetMembersCount方法的典型用法代码示例。如果您正苦于以下问题:C++ Guild::GetMembersCount方法的具体用法?C++ Guild::GetMembersCount怎么用?C++ Guild::GetMembersCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Guild
的用法示例。
在下文中一共展示了Guild::GetMembersCount方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleGuildInfoCommand
static bool HandleGuildInfoCommand(ChatHandler* handler, char const* args)
{
Guild* guild = nullptr;
if (args && args[0] != '\0')
{
if (isNumeric(args))
guild = sGuildMgr->GetGuildById(strtoull(args, nullptr, 10));
else
guild = sGuildMgr->GetGuildByName(args);
}
else if (Player* target = handler->getSelectedPlayerOrSelf())
guild = target->GetGuild();
if (!guild)
return false;
// Display Guild Information
handler->PSendSysMessage(LANG_GUILD_INFO_NAME, guild->GetName().c_str(), std::to_string(guild->GetId()).c_str()); // Guild Id + Name
std::string guildMasterName;
if (ObjectMgr::GetPlayerNameByGUID(guild->GetLeaderGUID(), guildMasterName))
handler->PSendSysMessage(LANG_GUILD_INFO_GUILD_MASTER, guildMasterName.c_str(), guild->GetLeaderGUID().ToString().c_str()); // Guild Master
// Format creation date
char createdDateStr[20];
time_t createdDate = guild->GetCreatedDate();
tm localTm;
strftime(createdDateStr, 20, "%Y-%m-%d %H:%M:%S", localtime_r(&createdDate, &localTm));
handler->PSendSysMessage(LANG_GUILD_INFO_CREATION_DATE, createdDateStr); // Creation Date
handler->PSendSysMessage(LANG_GUILD_INFO_MEMBER_COUNT, guild->GetMembersCount()); // Number of Members
handler->PSendSysMessage(LANG_GUILD_INFO_BANK_GOLD, std::to_string(guild->GetBankMoney() / 100 / 100).c_str()); // Bank Gold (in gold coins)
handler->PSendSysMessage(LANG_GUILD_INFO_LEVEL, guild->GetLevel()); // Level
handler->PSendSysMessage(LANG_GUILD_INFO_MOTD, guild->GetMOTD().c_str()); // Message of the Day
handler->PSendSysMessage(LANG_GUILD_INFO_EXTRA_INFO, guild->GetInfo().c_str()); // Extra Information
return true;
}
示例2: HandleGuildFinderBrowse
//.........这里部分代码省略.........
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());
bufferData << uint32(guild->GetEmblemInfo().GetBorderColor());
bufferData << uint32(guild->GetMembersCount());
bufferData.WriteByteSeq(guildGUID[1]);
bufferData.WriteByteSeq(guildGUID[4]);
}
data.FlushBits();
data.append(bufferData);
player->SendDirectMessage(&data);
}
示例3: 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);
}
示例4: 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);
}