当前位置: 首页>>代码示例>>C++>>正文


C++ Guild::AddGuildMember方法代码示例

本文整理汇总了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);
}
开发者ID:Carbinfibre,项目名称:ArcPro,代码行数:33,代码来源:GuildHandler.cpp

示例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);
}
开发者ID:Centraly,项目名称:SummitEmu,代码行数:28,代码来源:GuildHandler.cpp

示例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);
}
开发者ID:Favorite,项目名称:arcemu,代码行数:24,代码来源:GuildHandler.cpp

示例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;
}
开发者ID:armm77,项目名称:AscEmu,代码行数:72,代码来源:GuildCommands.cpp


注:本文中的Guild::AddGuildMember方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。