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


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

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


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

示例1: HandleArenaTeamRemoveOpcode

void WorldSession::HandleArenaTeamRemoveOpcode(WorldPacket& recvData)
{
    TC_LOG_DEBUG("network", "CMSG_ARENA_TEAM_REMOVE");

    uint32 arenaTeamId;
    std::string name;

    recvData >> arenaTeamId;
    recvData >> name;

    // Check for valid arena team
    ArenaTeam* arenaTeam = sArenaTeamMgr->GetArenaTeamById(arenaTeamId);
    if (!arenaTeam)
        return;

    // Only captain can remove members
    if (arenaTeam->GetCaptain() != _player->GetGUID())
    {
        SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_PERMISSIONS);
        return;
    }

    if (!normalizePlayerName(name))
        return;

    // Check if team member exists
    ArenaTeamMember* member = arenaTeam->GetMember(name);
    if (!member)
    {
        SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", name, ERR_ARENA_TEAM_PLAYER_NOT_FOUND_S);
        return;
    }

    // Captain cannot be removed
    if (arenaTeam->GetCaptain() == member->Guid)
    {
        SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, "", "", ERR_ARENA_TEAM_LEADER_LEAVE_S);
        return;
    }
    
        
   // Player cannot be removed during fights
    if (arenaTeam->IsFighting())
        return;

    arenaTeam->DelMember(member->Guid, true);

    // Broadcast event
    arenaTeam->BroadcastEvent(ERR_ARENA_TEAM_REMOVE_SSS, 0, 3, name, arenaTeam->GetName(), _player->GetName());
}
开发者ID:bahajan95,项目名称:deffender-fun-3.3.5a,代码行数:50,代码来源:ArenaTeamHandler.cpp

示例2: HandleArenaTeamLeaderOpcode

void WorldSession::HandleArenaTeamLeaderOpcode(WorldPacket & recvData)
{
    sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_ARENA_TEAM_LEADER");

    time_t now = time(NULL);
    if (now - timeLastArenaTeamCommand < 5)
        return;
    else
       timeLastArenaTeamCommand = now;

    uint32 arenaTeamId;
    std::string name;

    recvData >> arenaTeamId;
    recvData >> name;

    // Check for valid arena team
    ArenaTeam* arenaTeam = sArenaTeamMgr->GetArenaTeamById(arenaTeamId);
    if (!arenaTeam)
        return;

    // Only captain can pass leadership
    if (arenaTeam->GetCaptain() != _player->GetGUID())
    {
        SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_PERMISSIONS);
        return;
    }

    if (!normalizePlayerName(name))
        return;

    // Check if team member exists
    ArenaTeamMember* member = arenaTeam->GetMember(name);
    if (!member)
    {
        SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", name, ERR_ARENA_TEAM_PLAYER_NOT_FOUND_S);
        return;
    }

    // Check if the target is already team captain
    if (arenaTeam->GetCaptain() == member->Guid)
        return;

    arenaTeam->SetCaptain(member->Guid);

    // Broadcast event
    arenaTeam->BroadcastEvent(ERR_ARENA_TEAM_LEADER_CHANGED_SSS, 0, 3, _player->GetName(), name, arenaTeam->GetName());
}
开发者ID:AwkwardDev,项目名称:MistCore,代码行数:48,代码来源:ArenaTeamHandler.cpp

示例3: HandleArenaTeamLeaveOpcode

void WorldSession::HandleArenaTeamLeaveOpcode(WorldPacket & recvData)
{
    sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_ARENA_TEAM_LEAVE");

    time_t now = time(NULL);
    if (now - timeLastArenaTeamCommand < 5)
        return;
    else
       timeLastArenaTeamCommand = now;

    uint32 arenaTeamId;
    recvData >> arenaTeamId;

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

    // Disallow leave team while in arena
    if (_player->InArena())
    {
        SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, "", "", ERR_ARENA_TEAM_CREATED);
        return;
    }

    // Team captain can't leave the team if other members are still present
    if (_player->GetGUID() == arenaTeam->GetCaptain() && arenaTeam->GetMembersSize() > 1)
    {
        SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, "", "", ERR_ARENA_TEAM_LEADER_LEAVE_S);
        return;
    }

    // If team consists only of the captain, disband the team
    if (_player->GetGUID() == arenaTeam->GetCaptain())
    {
        arenaTeam->Disband(this);
        delete arenaTeam;
        return;
    }
    else
        arenaTeam->DelMember(_player->GetGUID(), true);

    // Broadcast event
    arenaTeam->BroadcastEvent(ERR_ARENA_TEAM_LEAVE_SS, _player->GetGUID(), 2, _player->GetName(), arenaTeam->GetName(), "");

    // Inform player who left
    SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, arenaTeam->GetName(), "", 0);
}
开发者ID:AwkwardDev,项目名称:MistCore,代码行数:47,代码来源:ArenaTeamHandler.cpp

示例4: HandleArenaTeamRemoveOpcode

void WorldSession::HandleArenaTeamRemoveOpcode(WorldPacket& recv_data)
{
    sLog->outDebug("CMSG_ARENA_TEAM_REMOVE_FROM_TEAM");

    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
    at->BroadcastEvent(ERR_ARENA_TEAM_REMOVE_SSS, name.c_str(), at->GetName().c_str(), _player->GetName());
}
开发者ID:Maczuga,项目名称:SkyFire_one,代码行数:45,代码来源:ArenaTeamHandler.cpp

示例5: HandleArenaTeamAcceptOpcode

void WorldSession::HandleArenaTeamAcceptOpcode(WorldPacket & /*recv_data*/)
{
    DEBUG_LOG("CMSG_ARENA_TEAM_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_BOOL_ALLOW_TWO_SIDE_INTERACTION_GUILD) &&
        _player->GetTeam() != sObjectMgr.GetPlayerTeamByGUID(at->GetCaptainGuid()))
    {
        // not let enemies sign petition
        SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_NOT_ALLIED);
        return;
    }

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

    // event
    at->BroadcastEvent(ERR_ARENA_TEAM_JOIN_SS, _player->GetObjectGuid(), _player->GetName(), at->GetName().c_str());
}
开发者ID:z3usleo,项目名称:easy-mangos,代码行数:45,代码来源:ArenaTeamHandler.cpp

示例6: HandleArenaTeamLeaveOpcode

void WorldSession::HandleArenaTeamLeaveOpcode(WorldPacket & recvData)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
    sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_ARENA_TEAM_LEAVE");
#endif

    uint32 arenaTeamId;
    recvData >> arenaTeamId;

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

    // Disallow leave team while in arena
    if (arenaTeam->IsFighting())
    {
        SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, "", "", ERR_ARENA_TEAM_INTERNAL);
        return;
    }

    // Team captain can't leave the team if other members are still present
    if (_player->GetGUID() == arenaTeam->GetCaptain() && arenaTeam->GetMembersSize() > 1)
    {
        SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, "", "", ERR_ARENA_TEAM_LEADER_LEAVE_S);
        return;
    }

    // If team consists only of the captain, disband the team
    if (_player->GetGUID() == arenaTeam->GetCaptain())
    {
        arenaTeam->Disband(this);
        delete arenaTeam;
        return;
    }
    else
        arenaTeam->DelMember(_player->GetGUID(), true);

    // Broadcast event
    arenaTeam->BroadcastEvent(ERR_ARENA_TEAM_LEAVE_SS, _player->GetGUID(), 2, _player->GetName().c_str(), arenaTeam->GetName(), "");

    // Inform player who left
    SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, arenaTeam->GetName(), "", 0);
}
开发者ID:Helias,项目名称:azerothcore-wotlk,代码行数:43,代码来源:ArenaTeamHandler.cpp

示例7: HandleArenaTeamLeaderOpcode

void WorldSession::HandleArenaTeamLeaderOpcode(WorldPacket& recvData)
{
    TC_LOG_DEBUG("network", "CMSG_ARENA_TEAM_LEADER");

    uint32 arenaTeamId;
    std::string name;

    recvData >> arenaTeamId;
    recvData >> name;

    // Check for valid arena team
    ArenaTeam* arenaTeam = sArenaTeamMgr->GetArenaTeamById(arenaTeamId);
    if (!arenaTeam)
        return;

    // Only captain can pass leadership
    if (arenaTeam->GetCaptain() != _player->GetGUID())
    {
        SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_PERMISSIONS);
        return;
    }

    if (!normalizePlayerName(name))
        return;

    // Check if team member exists
    ArenaTeamMember* member = arenaTeam->GetMember(name);
    if (!member)
    {
        SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", name, ERR_ARENA_TEAM_PLAYER_NOT_FOUND_S);
        return;
    }

    // Check if the target is already team captain
    if (arenaTeam->GetCaptain() == member->Guid)
        return;

    arenaTeam->SetCaptain(member->Guid);

    // Broadcast event
    arenaTeam->BroadcastEvent(ERR_ARENA_TEAM_LEADER_CHANGED_SSS, ObjectGuid::Empty, 3, _player->GetName(), name, arenaTeam->GetName());
}
开发者ID:Aravu,项目名称:Talador-Project,代码行数:42,代码来源:ArenaTeamHandler.cpp

示例8: HandleArenaTeamLeaveOpcode

void WorldSession::HandleArenaTeamLeaveOpcode(WorldPacket & recv_data)
{
    DEBUG_LOG("CMSG_ARENA_TEAM_LEAVE");

    uint32 ArenaTeamId;                                     // arena team id
    recv_data >> ArenaTeamId;

    ArenaTeam *at = sObjectMgr.GetArenaTeamById(ArenaTeamId);
    if (!at)
        return;

    // Disallow leave team while in arena
    if (_player->InArena())
    {
        SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, "", "", ERR_ARENA_TEAM_INTERNAL);
        return;
    }

    if (_player->GetObjectGuid() == at->GetCaptainGuid() && 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->GetObjectGuid() == at->GetCaptainGuid())
    {
        at->Disband(this);
        delete at;
        return;
    }

    at->DelMember(_player->GetObjectGuid());

    // event
    at->BroadcastEvent(ERR_ARENA_TEAM_LEAVE_SS, _player->GetObjectGuid(), _player->GetName(), at->GetName().c_str());

    // send you are no longer member of team
    SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, at->GetName(), "", 0);
}
开发者ID:gc,项目名称:mangos,代码行数:41,代码来源:ArenaTeamHandler.cpp

示例9: HandleArenaTeamLeaveOpcode

void WorldSession::HandleArenaTeamLeaveOpcode(WorldPacket & recv_data)
{
    sLog.outDebug("CMSG_ARENA_TEAM_LEAVE");

    uint32 ArenaTeamId;                                     // arena team id
    recv_data >> ArenaTeamId;

    if(GetPlayer()->InArena())
        return;

    ArenaTeam *at = objmgr.GetArenaTeamById(ArenaTeamId);

    if (!at)
       return;

    if (at->IsQueued())
        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
    at->BroadcastEvent(ERR_ARENA_TEAM_LEAVE_SS, _player->GetGUID(), _player->GetName(), at->GetName().c_str());

    // send you are no longer member of team
    SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, at->GetName(), "", 0);
}
开发者ID:romseguy,项目名称:Trinitycore_Azshara_2.4.3,代码行数:41,代码来源:ArenaTeamHandler.cpp

示例10: HandleArenaTeamLeaderOpcode

void WorldSession::HandleArenaTeamLeaderOpcode(WorldPacket & recv_data)
{
    DEBUG_LOG("CMSG_ARENA_TEAM_LEADER");

    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->GetCaptainGuid() != _player->GetObjectGuid())
    {
        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->GetCaptainGuid() == member->guid)               // target player already captain
        return;

    at->SetCaptain(member->guid);

    // event
    at->BroadcastEvent(ERR_ARENA_TEAM_LEADER_CHANGED_SSS, _player->GetName(), name.c_str(), at->GetName().c_str());
}
开发者ID:Aion2n,项目名称:mangos,代码行数:38,代码来源:ArenaTeamHandler.cpp


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