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


C++ ArenaTeam::AddMember方法代码示例

本文整理汇总了C++中ArenaTeam::AddMember方法的典型用法代码示例。如果您正苦于以下问题:C++ ArenaTeam::AddMember方法的具体用法?C++ ArenaTeam::AddMember怎么用?C++ ArenaTeam::AddMember使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ArenaTeam的用法示例。


在下文中一共展示了ArenaTeam::AddMember方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: HandleArenaTeamInviteAcceptOpcode

void WorldSession::HandleArenaTeamInviteAcceptOpcode(WorldPacket & /*recv_data*/)
{
    sLog->outDebug("CMSG_ARENA_TEAM_INVITE_ACCEPT");         // empty opcode

    ArenaTeam *at = sObjectMgr->GetArenaTeamById(_player->GetArenaTeamIdInvited());
    if (!at)
        return;

    if (_player->GetArenaTeamId(at->GetSlot()))
    {
        // already in arena team that size
        SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ALREADY_IN_ARENA_TEAM);
        return;
    }

    if (!sWorld->getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && _player->GetTeam() != sObjectMgr->GetPlayerTeamByGUID(at->GetCaptain()))
    {
        // not let enemies sign petition
        SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_NOT_ALLIED);
        return;
    }

    if (!at->AddMember(_player->GetGUID()))
    {
        // arena team not found
        SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_INTERNAL);
        return;
    }

    // event
    at->BroadcastEvent(ERR_ARENA_TEAM_JOIN_SS, _player->GetGUID(), _player->GetName(), at->GetName().c_str());
}
开发者ID:Maczuga,项目名称:SkyFire_one,代码行数:32,代码来源:ArenaTeamHandler.cpp

示例2: HandleArenaTeamAcceptOpcode

void WorldSession::HandleArenaTeamAcceptOpcode(WorldPacket & /*recv_data*/)
{
    sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_ARENA_TEAM_ACCEPT");                // empty opcode

    ArenaTeam* arenaTeam = sArenaTeamMgr->GetArenaTeamById(_player->GetArenaTeamIdInvited());
    if (!arenaTeam)
        return;

    // Check if player is already in another team of the same size
    if (_player->GetArenaTeamId(arenaTeam->GetSlot()))
    {
        SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ALREADY_IN_ARENA_TEAM);
        return;
    }

    // Only allow members of the other faction to join the team if cross faction interaction is enabled
    if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && _player->GetTeam() != sObjectMgr->GetPlayerTeamByGUID(arenaTeam->GetCaptain()))
    {
        SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_NOT_ALLIED);
        return;
    }

    // Add player to team
    if (!arenaTeam->AddMember(_player->GetGUID()))
    {
        SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_INTERNAL);
        return;
    }

    // Broadcast event
    arenaTeam->BroadcastEvent(ERR_ARENA_TEAM_JOIN_SS, _player->GetGUID(), 2, _player->GetName(), arenaTeam->GetName(), "");
}
开发者ID:kmN666,项目名称:Leroy,代码行数:32,代码来源:ArenaTeamHandler.cpp

示例3: HandleArenaTeamInviteAcceptOpcode

void WorldSession::HandleArenaTeamInviteAcceptOpcode(WorldPacket & /*recv_data*/)
{
    sLog.outDebug("CMSG_ARENA_TEAM_INVITE_ACCEPT");         // empty opcode

    ArenaTeam *at = objmgr.GetArenaTeamById(_player->GetArenaTeamIdInvited());
    if(!at)
    {
        // arena team not exist
        return;
    }

    if(_player->GetArenaTeamId(at->GetSlot()))
    {
        // already in arena team that size
        return;
    }

    // not let enemies sign petition
    if (!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && _player->GetTeam() != objmgr.GetPlayerTeamByGUID(at->GetCaptain()))
        return;

    if(!at->AddMember(_player->GetGUID()))
        return;

    // event
    WorldPacket data;
    BuildArenaTeamEventPacket(&data, ERR_ARENA_TEAM_JOIN_SS, 2, _player->GetName(), at->GetName(), "");
    at->BroadcastPacket(&data);
}
开发者ID:Crashuncle,项目名称:mangos,代码行数:29,代码来源:ArenaTeamHandler.cpp

示例4: CreateArenateam

    bool CreateArenateam(Player* player, Creature* me)
    {
        if (!player || !me)
            return false;

        uint8 slot = ArenaTeam::GetSlotByType(ARENA_TEAM_5v5);
        if (slot >= MAX_ARENA_SLOT)
            return false;

        // Check if player is already in an arena team
        if (player->GetArenaTeamId(slot))
        {
            player->GetSession()->SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, player->GetName(), "", ERR_ALREADY_IN_ARENA_TEAM);
            return false;
        }

        // Teamname = playername
        // if team name exist, we have to choose another name (playername + number)
        int i = 1;
        std::stringstream teamName;
        //teamName << "3vs3 Solo - " << player->GetName();
        teamName << player->GetName();
        do
        {
            if (sArenaTeamMgr->GetArenaTeamByName(teamName.str()) != NULL) // teamname exist, so choose another name
            {
                teamName.str(std::string());
                teamName << player->GetName() << i++;
            }
            else
                break;
        } while (i < 100); // should never happen

        // Create arena team
        ArenaTeam* arenaTeam = new ArenaTeam();

        if (!arenaTeam->Create(player->GetGUID(), ARENA_TEAM_5v5, teamName.str(), 4283124816, 45, 4294242303, 5, 4294705149))
        {
            delete arenaTeam;
            return false;
        }

        // Register arena team
        sArenaTeamMgr->AddArenaTeam(arenaTeam);
        arenaTeam->AddMember(player->GetGUID());

        ChatHandler(player->GetSession()).SendSysMessage("Arena team successful created!");

        return true;
    }
开发者ID:tinymac,项目名称:123,代码行数:50,代码来源:npc_solo3v3.cpp

示例5: HandleArenaTeamInviteAcceptOpcode

void WorldSession::HandleArenaTeamInviteAcceptOpcode(WorldPacket & recv_data)
{
	CHECK_INWORLD_RETURN

	ArenaTeam* team;

	if(_player->m_arenateaminviteguid == 0)
	{
		SystemMessage("You have not been invited into another arena team.");
		return;
	}

	team = objmgr.GetArenaTeamById(_player->m_arenateaminviteguid);
	_player->m_arenateaminviteguid = 0;
	if(team == 0)
	{
		SystemMessage("That arena team no longer exists.");
		return;
	}

	if(team->m_memberCount >= team->m_slots)
	{
		SystemMessage("That team is now full.");
		return;
	}

	if(_player->m_arenaTeams[team->m_type] != NULL)		/* shouldn't happen */
	{
		SystemMessage("You have already been in an arena team of that size.");
		return;
	}

	if(team->AddMember(_player->m_playerInfo))
	{
		char buffer[1024];
		WorldPacket* data;
		snprintf(buffer, 1024, "%s joined the arena team, '%s'.", _player->GetName(), team->m_name.c_str());
		data = sChatHandler.FillSystemMessageData(buffer);
		team->SendPacket(data);
		delete data;
	}
	else
	{
		SendNotification("Internal error.");
	}
}
开发者ID:Desch,项目名称:Edge-of-Chaos,代码行数:46,代码来源:ArenaTeam.cpp

示例6: HandleArenaTeamInviteAcceptOpcode

void WorldSession::HandleArenaTeamInviteAcceptOpcode(WorldPacket & recv_data)
{
	ArenaTeam * team;

	if(_player->m_arenateaminviteguid == 0)
	{
		SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_INTERNAL);
		return;
	}

	team = objmgr.GetArenaTeamById(_player->m_arenateaminviteguid);
	_player->m_arenateaminviteguid=0;
	if(team == 0)
	{
		return;
	}

	if(team->m_memberCount >= team->m_slots)
	{
		SystemMessage("That team is now full.");
		return;
	}

	if(_player->m_playerInfo->arenaTeam[team->m_type] != NULL)		/* shouldn't happen */
	{
		SendArenaTeamCommandResult(ERR_ARENA_TEAM_JOIN, "", "", ERR_ALREADY_IN_ARENA_TEAM);
		return;
	}

	if(team->AddMember(_player->m_playerInfo))
	{
		team->SendArenaTeamEventPacket(ERR_ARENA_TEAM_JOIN, 2, _player->GetName(), team->m_name);
	}
	else
	{
		SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_INTERNAL);
	}
}
开发者ID:pfchrono,项目名称:rs-ascent,代码行数:38,代码来源:ArenaTeam.cpp

示例7: HandleTurnInPetitionOpcode


//.........这里部分代码省略.........
            return;
        }
    }
    else
    {
        if (sObjectMgr.GetArenaTeamByName(name))
        {
            SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, name, "", ERR_ARENA_TEAM_NAME_EXISTS_S);
            delete result;
            return;
        }
    }

    // and at last charter item check
    Item* item = _player->GetItemByGuid(petitionGuid);
    if (!item)
    {
        delete result;
        return;
    }

    // OK!

    // delete charter item
    _player->DestroyItem(item->GetBagSlot(), item->GetSlot(), true);

    if (type == 9)                                          // create guild
    {
        Guild* guild = new Guild;
        if (!guild->Create(_player, name))
        {
            delete guild;
            delete result;
            return;
        }

        // register guild and add guildmaster
        sGuildMgr.AddGuild(guild);

        // add members
        for (uint8 i = 0; i < signs; ++i)
        {
            Field* fields = result->Fetch();

            ObjectGuid signGuid = ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32());
            if (!signGuid)
                continue;

            guild->AddMember(signGuid, guild->GetLowestRank());
            result->NextRow();
        }
    }
    else                                                    // or arena team
    {
        ArenaTeam* at = new ArenaTeam;
        if (!at->Create(_player->GetObjectGuid(), ArenaType(type), name))
        {
            sLog.outError("PetitionsHandler: arena team create failed.");
            delete at;
            delete result;
            return;
        }

        uint32 icon, iconcolor, border, bordercolor, backgroud;
        recv_data >> backgroud >> icon >> iconcolor >> border >> bordercolor;

        at->SetEmblem(backgroud, icon, iconcolor, border, bordercolor);

        // register team and add captain
        sObjectMgr.AddArenaTeam(at);
        DEBUG_LOG("PetitonsHandler: arena team added to objmrg");

        // add members
        for (uint8 i = 0; i < signs; ++i)
        {
            Field* fields = result->Fetch();
            ObjectGuid memberGUID = ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32());
            if (!memberGUID)
                continue;

            DEBUG_LOG("PetitionsHandler: adding arena member %s", memberGUID.GetString().c_str());
            at->AddMember(memberGUID);
            result->NextRow();
        }
    }

    delete result;

    CharacterDatabase.BeginTransaction();
    CharacterDatabase.PExecute("DELETE FROM petition WHERE petitionguid = '%u'", petitionGuid.GetCounter());
    CharacterDatabase.PExecute("DELETE FROM petition_sign WHERE petitionguid = '%u'", petitionGuid.GetCounter());
    CharacterDatabase.CommitTransaction();

    // created
    DEBUG_LOG("TURN IN PETITION %s", petitionGuid.GetString().c_str());

    WorldPacket data(SMSG_TURN_IN_PETITION_RESULTS, 4);
    data << uint32(PETITION_TURN_OK);
    SendPacket(data);
}
开发者ID:Ozerev,项目名称:mangos-tbc,代码行数:101,代码来源:PetitionsHandler.cpp

示例8: HandleTurnInPetitionOpcode


//.........这里部分代码省略.........

    if(type == 9)
    {
        if(objmgr.GetGuildByName(name))
        {
            SendGuildCommandResult(GUILD_CREATE_S, name, GUILD_NAME_EXISTS);
            delete result;
            return;
        }
    }
    else
    {
        if(objmgr.GetArenaTeamByName(name))
        {
            SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, name, "", ERR_ARENA_TEAM_NAME_EXISTS_S);
            delete result;
            return;
        }
    }

    // and at last charter item check
    Item *item = _player->GetItemByGuid(petitionguid);
    if(!item)
    {
        delete result;
        return;
    }

    // OK!

    // delete charter item
    _player->DestroyItem(item->GetBagSlot(),item->GetSlot(), true);

    if(type == 9)                                           // create guild
    {
        Guild* guild = new Guild;
        if(!guild->create(_player->GetGUID(), name))
        {
            delete guild;
            delete result;
            return;
        }

        // register guild and add guildmaster
        objmgr.AddGuild(guild);

        // add members
        for(uint8 i = 0; i < signs; ++i)
        {
            Field* fields = result->Fetch();
            guild->AddMember(fields[0].GetUInt64(), guild->GetLowestRank());
            result->NextRow();
        }
    }
    else                                                    // or arena team
    {
        ArenaTeam* at = new ArenaTeam;
        if(!at->Create(_player->GetGUID(), type, name))
        {
            sLog.outError("PetitionsHandler: arena team create failed.");
            delete at;
            delete result;
            return;
        }

        CHECK_PACKET_SIZE(recv_data, 8+5*4);
        uint32 icon, iconcolor, border, bordercolor, backgroud;
        recv_data >> backgroud >> icon >> iconcolor >> border >> bordercolor;

        at->SetEmblem(backgroud, icon, iconcolor, border, bordercolor);

        // register team and add captain
        objmgr.AddArenaTeam(at);
        sLog.outDebug("PetitonsHandler: arena team added to objmrg");

        // add members
        for(uint8 i = 0; i < signs; ++i)
        {
            Field* fields = result->Fetch();
            uint64 memberGUID = fields[0].GetUInt64();
            sLog.outDebug("PetitionsHandler: adding arena member %u", GUID_LOPART(memberGUID));
            at->AddMember(memberGUID);
            result->NextRow();
        }
    }

    delete result;

    CharacterDatabase.BeginTransaction();
    CharacterDatabase.PExecute("DELETE FROM petition WHERE petitionguid = '%u'", GUID_LOPART(petitionguid));
    CharacterDatabase.PExecute("DELETE FROM petition_sign WHERE petitionguid = '%u'", GUID_LOPART(petitionguid));
    CharacterDatabase.CommitTransaction();

    // created
    sLog.outDebug("TURN IN PETITION GUID %u", GUID_LOPART(petitionguid));

    data.Initialize(SMSG_TURN_IN_PETITION_RESULTS, 4);
    data << (uint32)PETITION_TURN_OK;
    SendPacket(&data);
}
开发者ID:eyeless,项目名称:mangos,代码行数:101,代码来源:PetitionsHandler.cpp

示例9: HandleCharterTurnInCharter

void WorldSession::HandleCharterTurnInCharter(WorldPacket & recv_data)
{
	uint64 mooguid;
	recv_data >> mooguid;
	Charter * pCharter = objmgr.GetCharterByItemGuid(mooguid);
	if(!pCharter) return;

	if(pCharter->CharterType == CHARTER_TYPE_GUILD)
	{
		Charter * gc = pCharter;
		if(gc == NULL)
			return;

		if( gc->GetLeader() != _player->GetLowGUID() )
			return;

		if(gc->SignatureCount < 9 && Config.MainConfig.GetBoolDefault("Server", "RequireAllSignatures", false))
		{
			SendNotification("You don't have the required amount of signatures to turn in this petition.");
			return;
		}

		// dont know hacky or not but only solution for now
		// If everything is fine create guild

		Guild *pGuild = Guild::Create();
		pGuild->CreateFromCharter(gc, this);

		// Destroy the charter
		_player->m_playerInfo->charterId[CHARTER_TYPE_GUILD] = 0;
		gc->Destroy();

		_player->GetItemInterface()->RemoveItemAmt(ITEM_ENTRY_GUILD_CHARTER, 1);
		sHookInterface.OnGuildCreate(_player, pGuild);
	}
	else
	{
		/* Arena charter - TODO: Replace with correct messages */
		ArenaTeam * team;
		uint32 type;
		uint32 i;
		uint32 icon, iconcolor, bordercolor, border, background;
		recv_data >> iconcolor >>icon >> bordercolor >> border >> background;

		switch(pCharter->CharterType)
		{
		case CHARTER_TYPE_ARENA_2V2:
			type = ARENA_TEAM_TYPE_2V2;
			break;

		case CHARTER_TYPE_ARENA_3V3:
			type = ARENA_TEAM_TYPE_3V3;
			break;

		case CHARTER_TYPE_ARENA_5V5:
			type = ARENA_TEAM_TYPE_5V5;
			break;

		default:
			SendNotification("Internal Error");
			return;
		}

		if( pCharter->GetLeader() != _player->GetLowGUID() )
			return;

		if(_player->m_playerInfo->arenaTeam[pCharter->CharterType-1] != NULL)
		{
			sChatHandler.SystemMessage(this, "You are already in an arena team.");
			return;
		}

		if(pCharter->SignatureCount < pCharter->GetNumberOfSlotsByType() && Config.MainConfig.GetBoolDefault("Server", "RequireAllSignatures", false))
		{
			sChatHandler.SystemMessage(this, "You don't have the required amount of signatures to turn in this petition.");
			return;
		}

		team = new ArenaTeam(type, objmgr.GenerateArenaTeamId());
		team->m_name = pCharter->GuildName;
		team->m_emblemColour = iconcolor;
		team->m_emblemStyle = icon;
		team->m_borderColour = bordercolor;
		team->m_borderStyle = border;
		team->m_backgroundColour = background;
		team->m_leader=_player->GetLowGUID();
		team->m_stat_rating=1500;
        
		objmgr.AddArenaTeam(team);
		objmgr.UpdateArenaTeamRankings();
		team->AddMember(_player->m_playerInfo);
		

		/* Add the members */
		for(i = 0; i < pCharter->SignatureCount; ++i)
		{
			PlayerInfo * info = objmgr.GetPlayerInfo(pCharter->Signatures[i]);
			if(info)
			{
				team->AddMember(info);
//.........这里部分代码省略.........
开发者ID:Centraly,项目名称:SummitEmu,代码行数:101,代码来源:GuildHandler.cpp

示例10: HandleArenaTeamCreate

void WorldSession::HandleArenaTeamCreate(WorldPacket & recv_data)
{
/*
13329
{CLIENT} Packet: (0x0109) CMSG_ARENA_TEAM_CREATE PacketSize = 29 stamp = 3919291
05 00 00 00 - size
01 00 00 00 border
C9 7D F5 FF bordercolor
3E 00 00 00 icon
80 66 80 FF iconcolor
85 80 8A FF background
35 6D 61 6E 00  
144333
{CLIENT} Packet: (0x1050) CMSG_ARENA_TEAM_CREATE PacketSize = 33 stamp = 31580124
36 00 00 00 icon
BA 08 29 FF 
1F 6E AB FF 
E8 57 AD FF 
03 00 00 00 border
00 00 00 00 size 2
61 6C 6C 67 75 69 64 61 00                                              
*/
	uint32 icon, iconcolor, bordercolor, border, backgroundColour;
	recv_data >> icon >> iconcolor >> backgroundColour >> bordercolor >> border;
	uint32 type;
	recv_data >> type;
	switch(type)
	{
	case 0:
		type = ARENA_TEAM_TYPE_2V2;
		break;

	case 1:
		type = ARENA_TEAM_TYPE_3V3;
		break;

	case 2:
		type = ARENA_TEAM_TYPE_5V5;
		break;

	default:
		SendNotification("Internal Error");
		return;
	}
	string name;
	recv_data >> name;
	if( _player->m_arenaTeams[ type ] != NULL)
	{
		sChatHandler.SystemMessage(this, "You are already in an arena team.");
		return;
	}

	if( name.length() <= 1 )
	{
		_player->BroadcastMessage("Arena team name too short");
		return;
	}
	if( name.length() >= 20 )
	{
		_player->BroadcastMessage("Arena team name too long");
		return;
	}

	ArenaTeam * team;
	team = new ArenaTeam(type, objmgr.GenerateArenaTeamId());
	team->m_name = name;
	team->m_emblemColour = iconcolor;
	team->m_emblemStyle = icon;
	team->m_borderColour = bordercolor;
	team->m_borderStyle = border;
	team->m_backgroundColour = backgroundColour;
	team->m_leader = _player->GetLowGUID();
	team->m_stat_rating=ARENA_TEAM_START_RATING;
    
	objmgr.AddArenaTeam( team );
	objmgr.UpdateArenaTeamRankings();
	team->AddMember( _player->m_playerInfo );

	sStackWorldPacket( data, SMSG_ARENA_TEAM_COMMAND_RESULT, 19+20 );
	data << name;	
	data << uint32( CR_SUCCESS );	
	data << uint32( 0 );
	data << uint8( 0 );	//string for command result
	SendPacket( &data );

	data.Initialize( SMSG_ARENA_TEAM_COMMAND_RESULT );
	data << name;	
	data << uint32( CR_FOUNDING_OWNER );	
	data << uint32( 0 );
	data << uint8( 0 );	//string for command result
	SendPacket( &data );
/*
	{SERVER} Packet: (0x1898) SMSG_ARENA_TEAM_COMMAND_RESULT PacketSize = 13 TimeStamp = 21946407
	31 32 33 00 00 00 00 00 00 00 00 00 00
	{SERVER} Packet: (0x1898) SMSG_ARENA_TEAM_COMMAND_RESULT PacketSize = 13 TimeStamp = 21946610
	31 32 33 00 0E 00 00 00 00 00 00 00 00 
*/
}
开发者ID:AtVirus,项目名称:Descent-core,代码行数:98,代码来源:ArenaTeam.cpp


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