本文整理汇总了C++中Guild::AddGuildMember方法的典型用法代码示例。如果您正苦于以下问题:C++ Guild::AddGuildMember方法的具体用法?C++ Guild::AddGuildMember怎么用?C++ Guild::AddGuildMember使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Guild
的用法示例。
在下文中一共展示了Guild::AddGuildMember方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleGuildAccept
void WorldSession::HandleGuildAccept(WorldPacket & recv_data)
{
CHECK_INWORLD_RETURN
Player* plyr = GetPlayer();
if(!plyr)
return;
Player* inviter = objmgr.GetPlayer(plyr->GetGuildInvitersGuid());
plyr->UnSetGuildInvitersGuid();
if(!inviter)
{
return;
}
Guild* pGuild = inviter->m_playerInfo->guild;
if(!pGuild)
{
return;
}
pGuild->getLock().Acquire();
uint32 memberCount = pGuild->GetNumMembers();
pGuild->getLock().Release();
if( memberCount >= MAX_GUILD_MEMBERS ){
plyr->UnSetGuildInvitersGuid();
SystemMessage( "That guild is full." );
return;
}
pGuild->AddGuildMember(plyr->m_playerInfo, NULL);
}
示例2: HandleGuildAccept
void WorldSession::HandleGuildAccept(WorldPacket & recv_data)
{
Player *plyr = GetPlayer();
if(!plyr)
return;
Player *inviter = objmgr.GetPlayer( plyr->GetGuildInvitersGuid() );
plyr->UnSetGuildInvitersGuid();
if(!inviter)
{
return;
}
Guild *pGuild = inviter->m_playerInfo->guild;
if(!pGuild)
{
return;
}
if(pGuild->GetNumMembers() >= MAX_GUILD_MEMBERS)
{
return;
}
pGuild->AddGuildMember(plyr->m_playerInfo, NULL);
}
示例3: HandleGuildAccept
void WorldSession::HandleGuildAccept(WorldPacket & recv_data)
{
CHECK_INWORLD_RETURN
Player* plyr = GetPlayer();
if(!plyr)
return;
Player* inviter = objmgr.GetPlayer(plyr->GetGuildInvitersGuid());
plyr->UnSetGuildInvitersGuid();
if(!inviter)
{
return;
}
Guild* pGuild = inviter->m_playerInfo->guild;
if(!pGuild)
{
return;
}
pGuild->AddGuildMember(plyr->m_playerInfo, NULL);
}
示例4: HandleGuildJoinCommand
//.guild join
bool ChatHandler::HandleGuildJoinCommand(const char* args, WorldSession* m_session)
{
Player* selected_player = GetSelectedPlayer(m_session, true, true);
if (selected_player == nullptr)
return true;
#if VERSION_STRING != Cata
if (selected_player->IsInGuild())
{
RedSystemMessage(m_session, "%s is already in a guild.", selected_player->GetName());
return true;
}
#else
if (selected_player->GetGuild())
{
RedSystemMessage(m_session, "%s is already in a guild.", selected_player->GetName());
return true;
}
#endif
if (!*args)
return false;
#if VERSION_STRING != Cata
Guild* guild = objmgr.GetGuildByGuildName(std::string(args));
if (guild != nullptr)
{
guild->getLock().Acquire();
uint32 memberCount = static_cast<uint32>(guild->GetNumMembers());
guild->getLock().Release();
if (memberCount >= MAX_GUILD_MEMBERS)
{
m_session->SystemMessage("That guild is full.");
return true;
}
guild->AddGuildMember(selected_player->getPlayerInfo(), m_session, -2);
GreenSystemMessage(m_session, "You have joined the guild '%s'", guild->getGuildName());
sGMLog.writefromsession(m_session, "Force joined guild '%s'", guild->getGuildName());
return true;
}
else
{
RedSystemMessage(m_session, "Guild %s is not a valid guildname!", args);
}
#else
Guild* guild = sGuildMgr.getGuildByName(std::string(args));
if (guild != nullptr)
{
uint32 memberCount = guild->getMembersCount();
if (memberCount >= worldConfig.guild.maxMembers)
{
m_session->SystemMessage("That guild is full.");
return true;
}
guild->addMember(selected_player->getGuid(), 4);
GreenSystemMessage(m_session, "You have joined the guild '%s'", guild->getName().c_str());
sGMLog.writefromsession(m_session, "Force joined guild '%s'", guild->getName().c_str());
return true;
}
else
{
RedSystemMessage(m_session, "Guild %s is not a valid guildname!", args);
}
#endif
return false;
}