[4.3.4] Missing pet stats data #11639

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
6 participants
Contributor

msoky commented Feb 21, 2014

missing pet stats data 81-85 level

msoky added some commits Feb 21, 2014

-- db errors - missing pet stats data
-- db errors - missing pet stats data 81-85 level
Member

Warpten commented on fb35f22 Feb 22, 2014

Creature entry 1 is not a pet, why is it even here ?

Member

Shauren replied Feb 22, 2014

Probably some hack, check code

Contributor

msoky replied Feb 22, 2014

because 1-80 lvl creature id1 is here, only 81-85lvl added, in DBErrors.txt is report, that this data is missing

Member

Warpten replied Feb 22, 2014

void ObjectMgr::LoadPetLevelInfo()
{
    uint32 oldMSTime = getMSTime();

    //                                                 0               1      2   3     4    5    6    7     8    9
    QueryResult result = WorldDatabase.Query("SELECT creature_entry, level, hp, mana, str, agi, sta, inte, spi, armor FROM pet_levelstats");

    if (!result)
    {
        TC_LOG_ERROR("server.loading", ">> Loaded 0 level pet stats definitions. DB table `pet_levelstats` is empty.");
        return;
    }

    uint32 count = 0;

    do
    {
        Field* fields = result->Fetch();

        uint32 creature_id = fields[0].GetUInt32();
        if (!sObjectMgr->GetCreatureTemplate(creature_id))
        {
            TC_LOG_ERROR("sql.sql", "Wrong creature id %u in `pet_levelstats` table, ignoring.", creature_id);
            continue;
        }

        uint32 current_level = fields[1].GetUInt8();
        if (current_level > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
        {
            if (current_level > STRONG_MAX_LEVEL)        // hardcoded level maximum
                TC_LOG_ERROR("sql.sql", "Wrong (> %u) level %u in `pet_levelstats` table, ignoring.", STRONG_MAX_LEVEL, current_level);
            else
            {
                TC_LOG_INFO("misc", "Unused (> MaxPlayerLevel in worldserver.conf) level %u in `pet_levelstats` table, ignoring.", current_level);
                ++count;                                // make result loading percent "expected" correct in case disabled detail mode for example.
            }
            continue;
        }
        else if (current_level < 1)
        {
            TC_LOG_ERROR("sql.sql", "Wrong (<1) level %u in `pet_levelstats` table, ignoring.", current_level);
            continue;
        }

        PetLevelInfo*& pInfoMapEntry = _petInfoStore[creature_id];

        if (pInfoMapEntry == NULL)
            pInfoMapEntry = new PetLevelInfo[sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)];

        // data for level 1 stored in [0] array element, ...
        PetLevelInfo* pLevelInfo = &pInfoMapEntry[current_level-1];

        pLevelInfo->health = fields[2].GetUInt16();
        pLevelInfo->mana   = fields[3].GetUInt16();
        pLevelInfo->armor  = fields[9].GetUInt32();

        for (int i = 0; i < MAX_STATS; i++)
        {
            pLevelInfo->stats[i] = fields[i+4].GetUInt16();
        }

        ++count;
    }
    while (result->NextRow());

    // Fill gaps and check integrity
    for (PetLevelInfoContainer::iterator itr = _petInfoStore.begin(); itr != _petInfoStore.end(); ++itr)
    {
        PetLevelInfo* pInfo = itr->second;

        // fatal error if no level 1 data
        if (!pInfo || pInfo[0].health == 0)
        {
            TC_LOG_ERROR("sql.sql", "Creature %u does not have pet stats data for Level 1!", itr->first);
            exit(1);
        }

        // fill level gaps
        for (uint8 level = 1; level < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL); ++level)
        {
            if (pInfo[level].health == 0)
            {
                TC_LOG_ERROR("sql.sql", "Creature %u has no data for Level %i pet stats data, using data of Level %i.", itr->first, level + 1, level);
                pInfo[level] = pInfo[level - 1];
            }
        }
    }

    TC_LOG_INFO("server.loading", ">> Loaded %u level pet stats definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}

If there's a hack, it's not around here. (And I really cannot look much deeper on this half broken piece of crap laptop)

Someone should check the code and remove all the entries for npc 1, because fuck hacks, this is an npc used to visualize waypoints.

Contributor

MrSmite commented Mar 7, 2014

In the 335 core, Hunter pets all use creature entry 1 when loading their base stats from the DB because Blizz normalized all Hunter pets.

From Guardian::InitStatsForLevel()

uint32 creature_ID = (petType == HUNTER_PET) ? 1 : cinfo->Entry;

// SNIP

PetLevelInfo const* pInfo = sObjectMgr->GetPetLevelInfo(creature_ID, petlevel);

Maybe this applies to 434 as well? Or maybe I'm talking about something completely different?

Contributor

msoky commented Jun 18, 2014

any news? there is a lot of DB errors...and this will fix it

@msoky msoky changed the title from DB/Creature: db errors - missing pet stats data to missing pet stats data Jun 23, 2014

@msoky msoky changed the title from missing pet stats data to Missing pet stats data Jun 23, 2014

@msoky msoky changed the title from Missing pet stats data to 4.3.4 Missing pet stats data Jun 23, 2014

@msoky msoky changed the title from 4.3.4 Missing pet stats data to [4.3.4] Missing pet stats data Jun 23, 2014

DDuarte added a commit that referenced this pull request Jul 24, 2014

@DDuarte DDuarte closed this Jul 24, 2014

Contributor

msoky commented Jul 31, 2014

DB errors, missing for pet 1 (default template), errors:
Creature 1 has no data for Level 81 pet stats data, using data of Level 80.
Creature 1 has no data for Level 82 pet stats data, using data of Level 81.
Creature 1 has no data for Level 83 pet stats data, using data of Level 82.
Creature 1 has no data for Level 84 pet stats data, using data of Level 83.
Creature 1 has no data for Level 85 pet stats data, using data of Level 84.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment