本文整理汇总了C++中ArenaTeam::SendPacket方法的典型用法代码示例。如果您正苦于以下问题:C++ ArenaTeam::SendPacket方法的具体用法?C++ ArenaTeam::SendPacket怎么用?C++ ArenaTeam::SendPacket使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArenaTeam
的用法示例。
在下文中一共展示了ArenaTeam::SendPacket方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleArenaTeamRemoveMemberOpcode
void WorldSession::HandleArenaTeamRemoveMemberOpcode(WorldPacket & recv_data)
{
CHECK_INWORLD_RETURN
ArenaTeam* team;
uint8 slot;
uint32 teamId;
string name;
PlayerInfo* inf;
recv_data >> teamId >> name;
team = objmgr.GetArenaTeamById(teamId);
if(!team)
{
GetPlayer()->SoftDisconnect();
return;
}
slot = static_cast<uint8>(team->m_type);
if((team = _player->m_arenaTeams[slot]) == NULL)
{
SystemMessage("You are not in an arena team of this type.");
return;
}
if(team->m_leader != _player->GetLowGUID())
{
SystemMessage("You are not the leader of this team.");
return;
}
if((inf = objmgr.GetPlayerInfoByName(name.c_str())) == NULL)
{
SystemMessage("That player cannot be found.");
return;
}
if(!team->HasMember(inf->guid))
{
SystemMessage("That player is not in your arena team.");
return;
}
if(team->RemoveMember(inf))
{
char buffer[1024];
WorldPacket* data;
snprintf(buffer, 1024, "%s was removed from the arena team '%s'.", inf->name, team->m_name.c_str());
data = sChatHandler.FillSystemMessageData(buffer);
team->SendPacket(data);
delete data;
SystemMessage("Removed %s from the arena team '%s'.", inf->name, team->m_name.c_str());
}
}
示例2: HandleArenaTeamLeaveOpcode
void WorldSession::HandleArenaTeamLeaveOpcode(WorldPacket & recv_data)
{
ArenaTeam * team;
uint32 teamId;
recv_data >> teamId;
team = objmgr.GetArenaTeamById(teamId);
if( !team || team->m_type >= NUM_ARENA_TEAM_TYPES )
{
GetPlayer()->SoftDisconnect();
return;
}
team = _player->m_arenaTeams[team->m_type];
if( team == NULL )
{
SystemMessage("You are not in an arena team of this type.");
return;
}
//if there is anyone inside an arena match then do not destroy it
if( _player->m_bg && IS_ARENA( _player->m_bg->GetType() ) )
{
SystemMessage("You cannot leave team while inside arena.");
return;
}
if (team->m_leader == _player->GetLowGUID() && team->m_memberCount == 1)
{
team->Destroy();
return;
}
if(team->m_leader == _player->GetLowGUID())
{
SystemMessage("You cannot leave the team yet, promote someone else to captain first.");
return;
}
if(team->RemoveMember(_player->m_playerInfo))
{
char buffer[1024];
WorldPacket * data;
snprintf(buffer,1024,"%s left the arena team, '%s'.", _player->GetName(), team->m_name.c_str());
data = sChatHandler.FillSystemMessageData(buffer);
team->SendPacket(data);
delete data;
data = NULL;
SystemMessage("You have left the arena team, '%s'.", team->m_name.c_str());
}
}
示例3: 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.");
}
}
示例4: HandleArenaTeamLeaveOpcode
void WorldSession::HandleArenaTeamLeaveOpcode(WorldPacket & recv_data)
{
CHECK_INWORLD_RETURN
ArenaTeam* team;
uint32 teamId;
recv_data >> teamId;
team = objmgr.GetArenaTeamById(teamId);
if(!team)
{
GetPlayer()->SoftDisconnect();
return;
}
if((team = _player->m_arenaTeams[team->m_type]) == NULL)
{
SystemMessage("You are not in an arena team of this type.");
return;
}
if(team->m_leader == _player->GetLowGUID() && team->m_memberCount == 1)
{
team->Destroy();
return;
}
if(team->m_leader == _player->GetLowGUID())
{
SystemMessage("You cannot leave the team yet, promote someone else to captain first.");
return;
}
if(team->RemoveMember(_player->m_playerInfo))
{
char buffer[1024];
WorldPacket* data;
snprintf(buffer, 1024, "%s left the arena team, '%s'.", _player->GetName(), team->m_name.c_str());
data = sChatHandler.FillSystemMessageData(buffer);
team->SendPacket(data);
delete data;
SystemMessage("You have left the arena team, '%s'.", team->m_name.c_str());
}
}
示例5: HandleArenaTeamRemoveMemberOpcode
void WorldSession::HandleArenaTeamRemoveMemberOpcode(WorldPacket & recv_data)
{
ArenaTeam * team;
uint8 slot;
uint32 teamId;
string name;
PlayerInfo * inf;
recv_data >> teamId >> name;
team = objmgr.GetArenaTeamById(teamId);
if( !team || team->m_type >= NUM_ARENA_TEAM_TYPES )
{
GetPlayer()->SoftDisconnect();
return;
}
slot = team->m_type;
if( (team = _player->m_arenaTeams[slot]) == NULL )
{
SystemMessage("You are not in an arena team of this type.");
return;
}
if(team->m_leader != _player->GetLowGUID())
{
SystemMessage("You are not the leader of this team.");
return;
}
if( (inf = objmgr.GetPlayerInfoByName(name.c_str())) == NULL )
{
SystemMessage("That player cannot be found.");
return;
}
if(!team->HasMember(inf->guid))
{
SystemMessage("That player is not in your arena team.");
return;
}
//if there is anyone inside an arena match then do not destroy it
if( inf->m_loggedInPlayer && inf->m_loggedInPlayer->m_bg && IS_ARENA( inf->m_loggedInPlayer->m_bg->GetType() ) )
{
SystemMessage("The player is playing an active match.");
return;
}
if(team->RemoveMember(inf))
{
char buffer[1024];
WorldPacket * data;
snprintf(buffer,1024,"%s was removed from the arena team '%s'.", inf->name, team->m_name.c_str());
data = sChatHandler.FillSystemMessageData(buffer);
team->SendPacket(data);
delete data;
data = NULL;
SystemMessage("Removed %s from the arena team '%s'.", inf->name, team->m_name.c_str());
}
}