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


C++ CreatureGroup类代码示例

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


在下文中一共展示了CreatureGroup类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: CreatureGroup

void CreatureGroupManager::AddCreatureToGroup(uint32 groupId,
		Creature *member) {
	Map *map = member->FindMap();
	if (!map)
		return;

	CreatureGroupHolderType::iterator itr = map->CreatureGroupHolder.find(
			groupId);

	//Add member to an existing group
	if (itr != map->CreatureGroupHolder.end()) {
		sLog->outDebug(
				LOG_FILTER_UNITS,
				"Group found: %u, inserting creature GUID: %u, Group InstanceID %u",
				groupId, member->GetGUIDLow(), member->GetInstanceId());
		itr->second->AddMember(member);
	}
	//Create new group
	else {
		sLog->outDebug(LOG_FILTER_UNITS,
				"Group not found: %u. Creating new group.", groupId);
		CreatureGroup* group = new CreatureGroup(groupId);
		map->CreatureGroupHolder[groupId] = group;
		group->AddMember(member);
	}
}
开发者ID:ProjectStarGate,项目名称:StarGate-Plus-EMU,代码行数:26,代码来源:CreatureGroups.cpp

示例3: ConvertDBGuid

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

示例4: GetScript

void SmartAI::JustReachedHome()
{
    GetScript()->OnReset();
    GetScript()->ProcessEventsFor(SMART_EVENT_REACHED_HOME);

    CreatureGroup* formation = me->GetFormation();
    if (!formation || formation->GetLeader() == me || !formation->IsFormed())
    {
        if (me->GetMotionMaster()->GetCurrentMovementGeneratorType(MOTION_SLOT_DEFAULT) != WAYPOINT_MOTION_TYPE)
        {
            if (me->GetWaypointPath())
                me->GetMotionMaster()->MovePath(me->GetWaypointPath(), true);
        }
        else
            me->ResumeMovement();
    }
    else if (formation->IsFormed())
        me->GetMotionMaster()->MoveIdle(); // wait the order of leader
}
开发者ID:lasyan3,项目名称:TrinityCore,代码行数:19,代码来源:SmartAI.cpp

示例5: TC_LOG_DEBUG

void FormationMgr::AddCreatureToGroup(ObjectGuid::LowType leaderGuid, Creature* creature)
{
    Map* map = creature->FindMap();
    if (!map)
        return;

    CreatureGroupHolderType::iterator itr = map->CreatureGroupHolder.find(leaderGuid);

    //Add member to an existing group
    if (itr != map->CreatureGroupHolder.end())
    {
        TC_LOG_DEBUG("entities.unit", "Group found: " UI64FMTD ", inserting %s, Group InstanceID %u", leaderGuid, creature->GetGUID().ToString().c_str(), creature->GetInstanceId());
        itr->second->AddMember(creature);
    }
    //Create new group
    else
    {
        TC_LOG_DEBUG("entities.unit", "Group not found: " UI64FMTD ". Creating new group.", leaderGuid);
        CreatureGroup* group = new CreatureGroup(leaderGuid);
        map->CreatureGroupHolder[leaderGuid] = group;
        group->AddMember(creature);
    }
}
开发者ID:beyourself,项目名称:DeathCore_6.x,代码行数:23,代码来源:CreatureGroups.cpp

示例6: TC_LOG_DEBUG

void FormationMgr::AddCreatureToGroup(uint32 groupId, Creature* member)
{
    Map* map = member->FindMap();
    if (!map)
        return;

    CreatureGroupHolderType::iterator itr = map->CreatureGroupHolder.find(groupId);

    //Add member to an existing group
    if (itr != map->CreatureGroupHolder.end())
    {
        TC_LOG_DEBUG("entities.unit", "Group found: %u, inserting creature GUID: %u, Group InstanceID %u", groupId, member->GetGUIDLow(), member->GetInstanceId());
        itr->second->AddMember(member);
    }
    //Create new group
    else
    {
        TC_LOG_DEBUG("entities.unit", "Group not found: %u. Creating new group.", groupId);
        CreatureGroup* group = new CreatureGroup(groupId);
        map->CreatureGroupHolder[groupId] = group;
        group->AddMember(member);
    }
}
开发者ID:125125,项目名称:TrinityCore,代码行数:23,代码来源:CreatureGroups.cpp


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