예제 #1
0
    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;
        }
    }
예제 #2
0
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();
}