本文整理汇总了C++中ArenaTeam::BroadcastPacket方法的典型用法代码示例。如果您正苦于以下问题:C++ ArenaTeam::BroadcastPacket方法的具体用法?C++ ArenaTeam::BroadcastPacket怎么用?C++ ArenaTeam::BroadcastPacket使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArenaTeam
的用法示例。
在下文中一共展示了ArenaTeam::BroadcastPacket方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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->GetArenaTeamIdFromDB(_player->GetGUIDLow(), at->GetType()))
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S,"","",ERR_ALREADY_IN_ARENA_TEAM); // already in arena team that size
return;
}
if (!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && _player->GetTeam() != sObjectMgr.GetPlayerTeamByGUID(at->GetCaptain()))
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S,"","",ERR_ARENA_TEAM_NOT_ALLIED);// not let enemies sign petition
return;
}
if (!at->AddMember(_player->GetGUID()))
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S,"","",ERR_ARENA_TEAM_INTERNAL);// arena team not found
return;
}
// event
WorldPacket data;
BuildArenaTeamEventPacket(&data, ERR_ARENA_TEAM_JOIN_SS, 2, _player->GetName(), at->GetName(), "");
at->BroadcastPacket(&data);
}
示例2: 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);
}
示例3: HandleArenaTeamRemoveFromTeamOpcode
void WorldSession::HandleArenaTeamRemoveFromTeamOpcode(WorldPacket & recv_data)
{
sLog.outDebug("CMSG_ARENA_TEAM_REMOVE_FROM_TEAM");
//recv_data.hexlike();
CHECK_PACKET_SIZE(recv_data, 1+1);
uint8 team_slot;
std::string name;
recv_data >> team_slot;
recv_data >> name;
uint32 at_id = _player->GetArenaTeamId(team_slot);
if(!at_id)
{
// arena team id not found
return;
}
ArenaTeam *at = objmgr.GetArenaTeamById(at_id);
if(!at)
{
// arena team not found
return;
}
uint64 guid = objmgr.GetPlayerGUIDByName(name);
if(!guid)
{
// player guid not found
return;
}
if(at->GetCaptain() == guid)
{
// unsure
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_PERMISSIONS);
return;
}
if(at->GetCaptain() != _player->GetGUID())
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_PERMISSIONS);
return;
}
if(at->GetCaptain() == guid)
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_LEADER_LEAVE_S);
return;
}
at->DelMember(guid);
// event
WorldPacket data;
BuildArenaTeamEventPacket(&data, ERR_ARENA_TEAM_REMOVE_SSS, 3, name, at->GetName(), _player->GetName());
at->BroadcastPacket(&data);
}
示例4: HandleArenaTeamPromoteToCaptainOpcode
void WorldSession::HandleArenaTeamPromoteToCaptainOpcode(WorldPacket & recv_data)
{
sLog.outDebug("CMSG_ARENA_TEAM_PROMOTE_TO_CAPTAIN");
//recv_data.hexlike();
CHECK_PACKET_SIZE(recv_data, 1+1);
uint8 team_slot;
std::string name;
recv_data >> team_slot;
recv_data >> name;
uint32 at_id = _player->GetArenaTeamId(team_slot);
if(!at_id)
{
// arena team id not found
return;
}
ArenaTeam *at = objmgr.GetArenaTeamById(at_id);
if(!at)
{
// arena team not found
return;
}
uint64 guid = objmgr.GetPlayerGUIDByName(name);
if(!guid)
{
// player guid not found
return;
}
if(at->GetCaptain() == guid)
{
// target player already captain
return;
}
if(at->GetCaptain() != _player->GetGUID())
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_PERMISSIONS);
return;
}
at->SetCaptain(guid);
// event
WorldPacket data;
BuildArenaTeamEventPacket(&data, ERR_ARENA_TEAM_LEADER_CHANGED_SSS, 3, _player->GetName(), name, at->GetName());
at->BroadcastPacket(&data);
}
示例5: HandleArenaTeamRemoveFromTeamOpcode
void WorldSession::HandleArenaTeamRemoveFromTeamOpcode(WorldPacket & recv_data)
{
sLog.outDebug("CMSG_ARENA_TEAM_REMOVE_FROM_TEAM");
CHECK_PACKET_SIZE(recv_data, 4+1);
uint32 ArenaTeamId;
std::string name;
recv_data >> ArenaTeamId;
recv_data >> name;
ArenaTeam *at = sObjectMgr.GetArenaTeamById(ArenaTeamId);
if (!at) // arena team not found
return;
if (at->GetCaptain() != _player->GetGUID())
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_PERMISSIONS);
return;
}
if (!normalizePlayerName(name))
return;
ArenaTeamMember* member = at->GetMember(name);
if (!member) // member not found
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", name, ERR_ARENA_TEAM_PLAYER_NOT_FOUND_S);
return;
}
if (at->GetCaptain() == member->guid)
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, "", "", ERR_ARENA_TEAM_LEADER_LEAVE_S);
return;
}
Player *player = ObjectAccessor::FindPlayer(member->guid);
if (player && player->InArena())
return;
at->DelMember(member->guid);
// event
WorldPacket data;
BuildArenaTeamEventPacket(&data, ERR_ARENA_TEAM_REMOVE_SSS, 3, name, at->GetName(), _player->GetName());
at->BroadcastPacket(&data);
}
示例6: HandleArenaTeamLeaveOpcode
void WorldSession::HandleArenaTeamLeaveOpcode(WorldPacket & recv_data)
{
sLog.outDebug("CMSG_ARENA_TEAM_LEAVE");
//recv_data.hexlike();
CHECK_PACKET_SIZE(recv_data, 1);
uint8 team_slot; // slot?
recv_data >> team_slot;
uint32 at_id = _player->GetArenaTeamId(team_slot);
if(!at_id) // not in arena team
{
// send command result
return;
}
ArenaTeam *at = objmgr.GetArenaTeamById(at_id);
if(!at)
{
// send command result
return;
}
if(_player->GetGUID() == at->GetCaptain() && at->GetMembersSize() > 1)
{
// check for correctness
SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, "", "", ERR_ARENA_TEAM_LEADER_LEAVE_S);
return;
}
// arena team has only one member (=captain)
if(_player->GetGUID() == at->GetCaptain())
{
at->Disband(this);
delete at;
return;
}
at->DelMember(_player->GetGUID());
// event
WorldPacket data;
BuildArenaTeamEventPacket(&data, ERR_ARENA_TEAM_LEAVE_SS, 2, _player->GetName(), at->GetName(), "");
at->BroadcastPacket(&data);
//SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, at->GetName(), "", 0);
}
示例7: HandleArenaTeamPromoteToCaptainOpcode
void WorldSession::HandleArenaTeamPromoteToCaptainOpcode(WorldPacket & recv_data)
{
sLog.outDebug("CMSG_ARENA_TEAM_PROMOTE_TO_CAPTAIN");
CHECK_PACKET_SIZE(recv_data, 4+1);
uint32 ArenaTeamId;
std::string name;
recv_data >> ArenaTeamId;
recv_data >> name;
ArenaTeam *at = sObjectMgr.GetArenaTeamById(ArenaTeamId);
if (!at) // arena team not found
return;
if (at->GetCaptain() != _player->GetGUID())
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_PERMISSIONS);
return;
}
if (!normalizePlayerName(name))
return;
ArenaTeamMember* member = at->GetMember(name);
if (!member) // member not found
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", name, ERR_ARENA_TEAM_PLAYER_NOT_FOUND_S);
return;
}
if (at->GetCaptain() == member->guid) // target player already captain
return;
at->SetCaptain(member->guid);
// event
WorldPacket data;
BuildArenaTeamEventPacket(&data, ERR_ARENA_TEAM_LEADER_CHANGED_SSS, 3, _player->GetName(), name, at->GetName());
at->BroadcastPacket(&data);
}