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


C++ Group::IsLeader方法代码示例

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


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

示例1: HandleGroupSetLeaderOpcode

void WorldSession::HandleGroupSetLeaderOpcode(WorldPacket & recv_data)
{
    sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_SET_LEADER");

    Group* group = GetPlayer()->GetGroup();
    if(!group)
        return;

    uint64 guid;
    recv_data >> guid;

    Player* player = sObjectMgr->GetPlayer(guid);

    /** error handling **/
    if(!player || !group->IsLeader(GetPlayer()->GetGUID()) || player->GetGroup() != group)
        return;
    /********************/

    // Everything's fine, do it
    group->ChangeLeader(guid);

    group->SendUpdate();
}
开发者ID:Naios,项目名称:MythCore,代码行数:23,代码来源:GroupHandler.cpp

示例2: HandleGroupAssistantLeaderOpcode

void WorldSession::HandleGroupAssistantLeaderOpcode( WorldPacket & recv_data )
{
    ObjectGuid guid;
    uint8 apply;
    recv_data >> guid;
    recv_data >> apply;

    DEBUG_LOG("CMSG_GROUP_ASSISTANT_LEADER: guid %u, apply %u",guid.GetCounter(),apply);

    Group *group = GetPlayer()->GetGroup();

    if (!group || !group->isRaidGroup())                    // Only raid groups may have assistant
        return;

    /** error handling **/
    if (!group->IsLeader(GetPlayer()->GetObjectGuid()))
        return;
    /********************/

    // everything is fine, do it
    group->SetGroupUniqueFlag(guid, GROUP_ASSIGN_ASSISTANT, apply);

}
开发者ID:xiaojie,项目名称:mangos,代码行数:23,代码来源:GroupHandler.cpp

示例3: HandleUpdateRaidTargetOpcode

void WorldSession::HandleUpdateRaidTargetOpcode(WorldPackets::Party::UpdateRaidTarget& packet)
{
    Group* group = GetPlayer()->GetGroup();
    if (!group)
        return;

    if (packet.Symbol == -1)                  // target icon request
        group->SendTargetIconList(this, packet.PartyIndex);
    else                                        // target icon update
    {
        if (group->isRaidGroup() && !group->IsLeader(GetPlayer()->GetGUID()) && !group->IsAssistant(GetPlayer()->GetGUID()))
            return;

        if (packet.Target.IsPlayer())
        {
            Player* target = ObjectAccessor::FindConnectedPlayer(packet.Target);
            if (!target || target->IsHostileTo(GetPlayer()))
                return;
        }

        group->SetTargetIcon(packet.Symbol, packet.Target, GetPlayer()->GetGUID(), packet.PartyIndex);
    }
}
开发者ID:welder1976,项目名称:DraenorCore,代码行数:23,代码来源:GroupHandler.cpp

示例4: HandleGroupChangeSubGroupOpcode

void WorldSession::HandleGroupChangeSubGroupOpcode(WorldPacket & recv_data)
{
    // we will get correct pointer for group here, so we don't have to check if group is BG raid
    Group *group = GetPlayer()->GetGroup();
    if (!group)
        return;

    std::string name;
    uint8 groupNr;
    recv_data >> name;
    recv_data >> groupNr;

    if (groupNr >= MAX_RAID_SUBGROUPS)
        return;

    /** error handling **/
    uint64 senderGuid = GetPlayer()->GetGUID();
    if (!group->IsLeader(senderGuid) && !group->IsAssistant(senderGuid))
        return;

    if (!group->HasFreeSlotSubGroup(groupNr))
        return;
    /********************/

    Player *movedPlayer = sObjectMgr->GetPlayer(name.c_str());
    if (movedPlayer)
    {
        //Do not allow leader to change group of player in combat
        if (movedPlayer->isInCombat())
            return;

        // everything's fine, do it
        group->ChangeMembersGroup(movedPlayer, groupNr);
    }
    else
        group->ChangeMembersGroup(sObjectMgr->GetPlayerGUIDByName(name.c_str()), groupNr);
}
开发者ID:Azazel,项目名称:TrinityCore,代码行数:37,代码来源:GroupHandler.cpp

示例5: HandleRaidReadyCheckOpcode

void WorldSession::HandleRaidReadyCheckOpcode( WorldPacket & recv_data )
{
    if(recv_data.empty())                                   // request
    {
        Group *group = GetPlayer()->GetGroup();
        if(!group)
            return;

        /** error handling **/
        if (!group->IsLeader(GetPlayer()->GetObjectGuid()) &&
            !group->IsAssistant(GetPlayer()->GetObjectGuid()))
            return;
        /********************/

        // everything is fine, do it
        WorldPacket data(MSG_RAID_READY_CHECK, 8);
        data << ObjectGuid(GetPlayer()->GetObjectGuid());
        group->BroadcastPacket(&data, false, -1);

        group->OfflineReadyCheck();
    }
    else                                                    // answer
    {
        uint8 state;
        recv_data >> state;

        Group *group = GetPlayer()->GetGroup();
        if(!group)
            return;

        // everything is fine, do it
        WorldPacket data(MSG_RAID_READY_CHECK_CONFIRM, 9);
        data << GetPlayer()->GetObjectGuid();
        data << uint8(state);
        group->BroadcastReadyCheck(&data);
    }
}
开发者ID:gc,项目名称:mangos,代码行数:37,代码来源:GroupHandler.cpp

示例6: HandlePartyAssignmentOpcode

void WorldSession::HandlePartyAssignmentOpcode( WorldPacket & recv_data )
{
    uint8 role;
    uint8 apply;
    ObjectGuid guid;
    recv_data >> role >> apply;                             // role 0 = Main Tank, 1 = Main Assistant
    recv_data >> guid;

    DEBUG_LOG("MSG_PARTY_ASSIGNMENT");

    Group *group = GetPlayer()->GetGroup();
    if (!group)
        return;

    /** error handling **/
    if (!group->IsLeader(GetPlayer()->GetObjectGuid()))
        return;
    /********************/

    // everything is fine, do it
    if (apply)
    {
        switch(role)
        {
            case 0: group->SetMainTank(guid); break;
            case 1: group->SetMainAssistant(guid); break;
            default: break;
        }
    }
    else
    {
        if (group->GetMainTankGuid() == guid)
            group->SetMainTank(ObjectGuid());
        if (group->GetMainAssistantGuid() == guid)
            group->SetMainAssistant(ObjectGuid());
    }
}
开发者ID:marx123,项目名称:core,代码行数:37,代码来源:GroupHandler.cpp

示例7: HandleGroupChangeSubGroupOpcode

void WorldSession::HandleGroupChangeSubGroupOpcode(WorldPacket& recvData)
{
    TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_CHANGE_SUB_GROUP");

    // we will get correct pointer for group here, so we don't have to check if group is BG raid
    Group* group = GetPlayer()->GetGroup();
    if (!group)
        return;

    std::string name;
    uint8 groupNr;
    recvData >> name;
    recvData >> groupNr;

    if (groupNr >= MAX_RAID_SUBGROUPS)
        return;

    uint64 senderGuid = GetPlayer()->GetGUID();
    if (!group->IsLeader(senderGuid) && !group->IsAssistant(senderGuid))
        return;

    if (!group->HasFreeSlotSubGroup(groupNr))
        return;

    Player* movedPlayer = sObjectAccessor->FindPlayerByName(name);
    uint64 guid;

    if (movedPlayer)
        guid = movedPlayer->GetGUID();
    else
    {
        CharacterDatabase.EscapeString(name);
        guid = sObjectMgr->GetPlayerGUIDByName(name.c_str());
    }

    group->ChangeMembersGroup(guid, groupNr);
}
开发者ID:Drasgon,项目名称:WoD,代码行数:37,代码来源:GroupHandler.cpp

示例8: HandleLootMethodOpcode

void WorldSession::HandleLootMethodOpcode( WorldPacket & recv_data )
{
    CHECK_PACKET_SIZE(recv_data,4+8+4);

    Group *group = GetPlayer()->GetGroup();
    if(!group)
        return;

    uint32 lootMethod;
    uint64 lootMaster;
    uint32 lootThreshold;
    recv_data >> lootMethod >> lootMaster >> lootThreshold;

    /** error handling **/
    if(!group->IsLeader(GetPlayer()->GetGUID()))
        return;
    /********************/

    // everything's fine, do it
    group->SetLootMethod((LootMethod)lootMethod);
    group->SetLooterGuid(lootMaster);
    group->SetLootThreshold((ItemQualities)lootThreshold);
    group->SendUpdate();
}
开发者ID:Actionfox,项目名称:mangos,代码行数:24,代码来源:GroupHandler.cpp

示例9: HandleGroupChangeSubGroupOpcode

void WorldSession::HandleGroupChangeSubGroupOpcode( WorldPacket & recv_data )
{
    // we will get correct pointer for group here, so we don't have to check if group is BG raid
    Group *group = GetPlayer()->GetGroup();
    if(!group)
        return;

    std::string name;
    uint8 groupNr;
    recv_data >> name;

    recv_data >> groupNr;

    /** error handling **/
    if(!group->IsLeader(GetPlayer()->GetGUID()) && !group->IsAssistant(GetPlayer()->GetGUID()))
        return;

    if (!group->HasFreeSlotSubGroup(groupNr))
        return;
    /********************/

    Player *movedPlayer=objmgr.GetPlayer(name.c_str());
    if(!movedPlayer)
        return;

    //Do not allow leader to change group of player in combat
    if (movedPlayer->isInCombat())
    {
        WorldPacket data(SMSG_GROUP_SWAP_FAILED, (0));
        SendPacket(&data);
        return;
    }

    // everything's fine, do it
    group->ChangeMembersGroup(movedPlayer, groupNr);
}
开发者ID:LordVoldemort,项目名称:Shindorei,代码行数:36,代码来源:GroupHandler.cpp

示例10: HandleRaidTargetUpdateOpcode

void WorldSession::HandleRaidTargetUpdateOpcode(WorldPacket& recvData)
{
    sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_RAID_TARGET_UPDATE");

    Group* group = GetPlayer()->GetGroup();
    if (!group)
        return;

    uint8 x, unk;
    recvData >> unk;
    recvData >> x;

    /** error handling **/
    /********************/

    // everything's fine, do it
    if (x == 0xFF)                                           // target icon request
        group->SendTargetIconList(this);
    else                                                    // target icon update
    {
        if (!group->IsLeader(GetPlayer()->GetGUID()) && !group->IsAssistant(GetPlayer()->GetGUID()) && !(group->GetGroupType() & GROUPTYPE_EVERYONE_IS_ASSISTANT))
            return;

        ObjectGuid guid;

        uint8 bitOrder[8] = { 2, 1, 6, 4, 5, 0, 7, 3 };
        recvData.ReadBitInOrder(guid, bitOrder);

        recvData.FlushBits();

        uint8 byteOrder[8] = { 5, 4, 6, 0, 1, 2, 3, 7 };
        recvData.ReadBytesSeq(guid, byteOrder);

        group->SetTargetIcon(x, _player->GetGUID(), guid);
    }
}
开发者ID:cooler-SAI,项目名称:PandaFire,代码行数:36,代码来源:GroupHandler.cpp

示例11: HandleRaidReadyCheckOpcode

void WorldSession::HandleRaidReadyCheckOpcode(WorldPacket& recvData)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
    sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received MSG_RAID_READY_CHECK");
#endif

    Group* group = GetPlayer()->GetGroup();
    if (!group)
        return;

    if (recvData.empty())                                   // request
    {
        /** error handling **/
        if (!group->IsLeader(GetPlayer()->GetGUID()) && !group->IsAssistant(GetPlayer()->GetGUID()))
            return;
        /********************/

        // everything's fine, do it
        WorldPacket data(MSG_RAID_READY_CHECK, 8);
        data << GetPlayer()->GetGUID();
        group->BroadcastPacket(&data, false, -1);

        group->OfflineReadyCheck();
    }
    else                                                    // answer
    {
        uint8 state;
        recvData >> state;

        // everything's fine, do it
        WorldPacket data(MSG_RAID_READY_CHECK_CONFIRM, 9);
        data << uint64(GetPlayer()->GetGUID());
        data << uint8(state);
        group->BroadcastReadyCheck(&data);
    }
}
开发者ID:Helias,项目名称:azerothcore-wotlk,代码行数:36,代码来源:GroupHandler.cpp

示例12: HandleLootMethodOpcode

void WorldSession::HandleLootMethodOpcode(WorldPacket& recvData)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
    sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_LOOT_METHOD");
#endif

    uint32 lootMethod;
    uint64 lootMaster;
    uint32 lootThreshold;
    recvData >> lootMethod >> lootMaster >> lootThreshold;

    Group* group = GetPlayer()->GetGroup();
    if (!group)
        return;

    /** error handling **/
    // Xinef: Check if group is LFG
    if (!group->IsLeader(GetPlayer()->GetGUID()) || group->isLFGGroup())
        return;

    if (lootMethod > NEED_BEFORE_GREED)
        return;

    if (lootThreshold < ITEM_QUALITY_UNCOMMON || lootThreshold > ITEM_QUALITY_ARTIFACT)
        return;

    if (lootMethod == MASTER_LOOT && !group->IsMember(lootMaster))
        return;
    /********************/

    // everything's fine, do it
    group->SetLootMethod((LootMethod)lootMethod);
    group->SetMasterLooterGuid(lootMaster);
    group->SetLootThreshold((ItemQualities)lootThreshold);
    group->SendUpdate();
}
开发者ID:Helias,项目名称:azerothcore-wotlk,代码行数:36,代码来源:GroupHandler.cpp

示例13: HandleGroupSetLeaderOpcode

void WorldSession::HandleGroupSetLeaderOpcode(WorldPacket& recvData)
{
    sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_SET_LEADER");

    ObjectGuid guid;

    recvData.read_skip<uint8>();

    uint8 bitOrder[8] = { 1, 6, 5, 3, 0, 4, 2, 7 };
    recvData.ReadBitInOrder(guid, bitOrder);

    recvData.FlushBits();

    uint8 byteOrder[8] = { 4, 0, 6, 5, 1, 7, 2, 3 };
    recvData.ReadBytesSeq(guid, byteOrder);

    Player* player = ObjectAccessor::FindPlayer(guid);
    Group* group = GetPlayer()->GetGroup();

    if (!group || !player)
        return;

    if (!group->IsLeader(GetPlayer()->GetGUID()) || player->GetGroup() != group)
        return;

    // @TODO: find a better way to fix exploit, we must have possibility to change leader while group is in raid/instance
    // Prevent exploits with instance saves
    for (GroupReference *itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
        if (Player* plr = itr->getSource())
            if (plr->GetMap() && plr->GetMap()->Instanceable())
                return;

    // Everything's fine, accepted.
    group->ChangeLeader(guid);
    group->SendUpdate();
}
开发者ID:Expery,项目名称:Core,代码行数:36,代码来源:GroupHandler.cpp

示例14: HandleGroupChangeSubGroupOpcode

void WorldSession::HandleGroupChangeSubGroupOpcode( WorldPacket & recv_data )
{
    // we will get correct pointer for group here, so we don't have to check if group is BG raid
    Group *group = GetPlayer()->GetGroup();
    if(!group)
        return;

    std::string name;
    uint8 groupNr;
    recv_data >> name;

    recv_data >> groupNr;

    /** error handling **/
    if(!group->IsLeader(GetPlayer()->GetGUID()) && !group->IsAssistant(GetPlayer()->GetGUID()))
        return;

    if (!group->HasFreeSlotSubGroup(groupNr))
        return;
    /********************/

    // everything's fine, do it
    group->ChangeMembersGroup(sObjectMgr.GetPlayer(name.c_str()), groupNr);
}
开发者ID:Igroman256,项目名称:mangos,代码行数:24,代码来源:GroupHandler.cpp

示例15: HandleRaidReadyCheckOpcode

void WorldSession::HandleRaidReadyCheckOpcode( WorldPacket & recv_data )
{
    Group *group = GetPlayer()->GetGroup();
    if(!group)
        return;

    if(recv_data.empty())                                   // request
    {
        /** error handling **/
        if(!group->IsLeader(GetPlayer()->GetGUID()))
            return;
        /********************/

        // everything's fine, do it
        WorldPacket data(MSG_RAID_READY_CHECK, 0);
        group->BroadcastPacket(&data, -1, GetPlayer()->GetGUID());
    }
    else                                                    // answer
    {
        uint8 state;
        recv_data >> state;

        /** error handling **/
        /********************/

        // everything's fine, do it
        Player *leader = objmgr.GetPlayer(group->GetLeaderGUID());
        if(leader && leader->GetSession())
        {
            WorldPacket data(MSG_RAID_READY_CHECK, 9);
            data << GetPlayer()->GetGUID();
            data << state;
            leader->GetSession()->SendPacket(&data);
        }
    }
}
开发者ID:Artea,项目名称:mangos-svn,代码行数:36,代码来源:GroupHandler.cpp


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