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


C++ CreatureGroup::GetLeaderGuid方法代码示例

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


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

示例1: GetWaveFromCreature

    uint8 GetWaveFromCreature(Creature* creature)
    {
        CreatureGroup* group = creature->GetCreatureGroup();
        if (!group)
        {
//sLog.nostalrius("no group");
            return 0;
        }
//sLog.nostalrius("group leader : %u",group->GetLeaderGuid().GetEntry());
        switch (group->GetLeaderGuid().GetEntry())
        {
            case NPC_CAPTAIN_QEEZ:
                return 1;
            case NPC_CAPTAIN_TUUBID:
                return 2;
            case NPC_CAPTAIN_DRENN:
                return 3;
            case NPC_CAPTAIN_XURREM:
                return 4;
            case NPC_MAJOR_YEGGETH:
                return 5;
            case NPC_MAJOR_PAKKON:
                return 6;
            case NPC_COLONEL_ZERRAN:
                return 7;
            default:
                return 0;
        }
    }
开发者ID:Maduse,项目名称:server,代码行数:29,代码来源:instance_ruins_of_ahnqiraj.cpp

示例2: Load

void CreatureGroupsManager::Load()
{
    uint32 oldMSTime = WorldTimer::getMSTime();

    // Memory leak, but we cannot delete the loaded groups, since pointer may be present at loaded creatures
    _groups.clear();

    QueryResult* result = WorldDatabase.Query("SELECT leaderGUID, memberGUID, dist, angle, flags FROM creature_groups ORDER BY leaderGUID");

    if (!result)
    {
        sLog.outErrorDb(">>  Loaded 0 creature groups. DB table `creature_groups` is empty!");
        sLog.outString();
        return;
    }

    uint32 count = 0;
    Field *fields;
    CreatureGroup *currentGroup = NULL;

    do
    {
        fields = result->Fetch();

        //Load group member data
        ObjectGuid leaderGuid = ConvertDBGuid(fields[0].GetUInt32());
        ObjectGuid memberGuid = ConvertDBGuid(fields[1].GetUInt32());
        if (leaderGuid.IsEmpty())
            sLog.outErrorDb("CREATURE GROUPS: Bad leader guid %u", fields[0].GetUInt32());
        else if (memberGuid.IsEmpty())
            sLog.outErrorDb("CREATURE GROUPS: Bad member guid %u", fields[1].GetUInt32());
        else
        {
            if (!currentGroup || leaderGuid != currentGroup->GetLeaderGuid())
            {
                currentGroup = new CreatureGroup(leaderGuid);
                RegisterNewGroup(currentGroup);
            }
            currentGroup->AddMember(memberGuid, fields[2].GetFloat(), fields[3].GetFloat(), fields[4].GetUInt8());
            ++count;
        }
    }
    while (result->NextRow());
    delete result;

    sLog.outString(">> Loaded %u creature groups in %u ms", count, WorldTimer::getMSTime() - oldMSTime);
    sLog.outString();
}
开发者ID:Maduse,项目名称:server,代码行数:48,代码来源:CreatureGroups.cpp


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