Jump to content
  • every field boss instant, raid hp is very low


    ascentu
    • Status: Completed
      Main Category: Database
      Sub-Category: Creature
      Version: 2.0.10 Milestone: 20 Priority: High
      Implemented Version: 0.20

    every field boss instant, raid hp is very low

    rare creature bla... every boss creature hp very low
    for example kazzhak hp is 2265 . what's my problem?
    but db data is fine(check creature, creature_template hp/mana looks good)

    screen shot.
    [url]https://scontent-b-pao.xx.fbcdn.net/hphotos-xpa1/v/t1.0-9/10393806_781423578572722_8700782061339965465_n.jpg?oh=1e7622b6f88cd874d2573c3771394f87&oe=54DE5A41[/url]


    User Feedback

    Recommended Comments

    If you haven't already, please try the Rel20 branch of the server and database.


    git clone [URL]https://github.com/mangoszero/server.git[/URL] --recursive -b Rel20



    git clone [URL]https://github.com/mangoszero/database.git[/URL] --recursive -b Rel20


    I believe this issue has been tidied up a lot

    Link to comment
    Share on other sites

    No chucksta, my fix only resolved the wrong damage values.

    This one is related to the new baseHP/baseMana calculation.
    I wrote a thread about this already here: [url]https://www.getmangos.eu/issue.php?issueid=182[/url]

    Link to comment
    Share on other sites

    Gonna check this one out now. Apply my obsessive personality to it and see what happens!!! :confused: :p :mad: :o ;)


    -------------------------------------------------------
    [B]Lord Kazzak[/B] Entry: 12397
    [url]http://db.vanillagaming.org/?npc=12397[/url]
    HP: 347,581
    This HP value is both on the above page and in the database ([B]creature_template [/B]table, [B][COLOR="#800080"]MinLevelHealth [/COLOR][/B]and [B][COLOR="#800080"]MaxLevelHealth[/COLOR][/B])
    And the [B][COLOR="#800080"]curhealth[/COLOR][/B] field in the [B]creature[/B] table.
    [B]SciptName[/B]: boss_kazzak

    I'll now check in-game.

    [B][COLOR="#FF0000"]PROOF OF THE ISSUE:[/COLOR][/B]
    [IMG]http://s23.postimg.org/hoe49btbv/Weedy_Lord_Kazzak.jpg[/IMG]
    [B][SIZE=3]One weedy Lord Kazzak![/SIZE][/B]

    The Dreadlord NPCs in the area are also showing a similar value for their HP, when it should be about 46k/47k

    -------------------------------
    Now boys and girls, 'ow be dis 'appening?!?!?!

    -------------------------------
    I just checked the normal mobs in the Blasted Lands and their HP was correct, but on checking a Rare that I can across (Magronos the Unyielding), I found his HP to be 2784, when it should be 8536
    Rank: 4 (Rare)

    [IMG]http://s24.postimg.org/k0oevg339/Magronos_The_Unyielding.jpg[/IMG]

    I'll now check other areas/maps to see what the stats of the elites/rares are there.

    -------------------------------
    Badlands

    The normal mobs' HP is as it should be, but HP of the elites is again way too low:

    [B]Scorched Guardian[/B]
    Rank: 1 (Elite)
    HP should be: 5195 - 5881
    Is in-game: 1716
    [IMG]http://s4.postimg.org/tb3in97cd/Scorched_Guardian.jpg[/IMG]

    ---------------------------------
    Hmm, I'll check the code in the core...

    Link to comment
    Share on other sites

    [B][SIZE=3][COLOR="#0000FF"]New Post - Looking at the Code[/COLOR][/SIZE][/B]

    [B]The ranks of the creatures:[/B]
    SharedDefines.h, lines 1772 to 1780

    enum CreatureEliteType
    {
    CREATURE_ELITE_NORMAL = 0,
    CREATURE_ELITE_ELITE = 1,
    CREATURE_ELITE_RAREELITE = 2,
    CREATURE_ELITE_WORLDBOSS = 3,
    CREATURE_ELITE_RARE = 4,
    CREATURE_UNKNOWN = 5 // found in 2.2.3 for 2 mobs
    };


    The code that sets the health and mana for the creatures is:
    Creature.cpp, line 1192 onwards

    if (cinfo->ArmorMultiplier > 0 && cCLS)
    {
    // Use Creature Stats to calculate stat values

    // health
    health = cCLS->BaseHealth * cinfo->HealthMultiplier;

    // mana
    mana = cCLS->BaseMana * cinfo->PowerMultiplier;
    }


    I forced the health and mana of the creatures to be 100 by including the following code, thus proving that this code does set the elite's health and mana
    if (cinfo->ArmorMultiplier > 0 && cCLS)
    {
    // Use Creature Stats to calculate stat values

    // health
    health = cCLS->BaseHealth * cinfo->HealthMultiplier;
    health = 100;

    // mana
    mana = cCLS->BaseMana * cinfo->PowerMultiplier;
    mana = 100;
    }


    NEXT: figure out what is actually happening there, and if it is in this code that is causing the fault.

    ------------------------------------------------------

    [B][COLOR="#008000"][SIZE=3]FIXED[/SIZE]![/COLOR][/B]
    [IMG]http://s18.postimg.org/uzez3mu3d/Load_Kazzak_Well_Ard.jpg[/IMG]

    [B][SIZE=3][COLOR="#0000FF"]LOL, FOOLED YOU :P[/COLOR][/SIZE][/B]

    I cheated...

    The above code that deals with setting the health and mana of the creature actually has another part to it:


    // TODO: Remove cinfo->ArmorMultiplier test workaround to disable classlevelstats when DB is ready
    CreatureClassLvlStats const* cCLS = sObjectMgr.GetCreatureClassLvlStats(level, cinfo->UnitClass);
    if (cinfo->ArmorMultiplier > 0 && cCLS)
    {
    // Use Creature Stats to calculate stat values

    // health
    health = cCLS->BaseHealth * cinfo->HealthMultiplier;

    // mana
    mana = cCLS->BaseMana * cinfo->PowerMultiplier;
    }
    else
    {
    // Use old style to calculate stat values
    float rellevel = maxlevel == minlevel ? 0 : (float(level - minlevel)) / (maxlevel - minlevel);

    // health
    uint32 minhealth = std::min(cinfo->MaxLevelHealth, cinfo->MinLevelHealth);
    uint32 maxhealth = std::max(cinfo->MaxLevelHealth, cinfo->MinLevelHealth);
    health = uint32(minhealth + uint32(rellevel * (maxhealth - minhealth)));

    // mana
    uint32 minmana = std::min(cinfo->MaxLevelMana, cinfo->MinLevelMana);
    uint32 maxmana = std::max(cinfo->MaxLevelMana, cinfo->MinLevelMana);
    mana = minmana + uint32(rellevel * (maxmana - minmana));
    }


    The second part, after [B][COLOR="#0000FF"]else[/COLOR][/B], is apparently the old way of working out the health and mana. I commented out the first part, thus making the system run the old code. This, as you can see, results in the correct health and mana for the creatures.

    Obviously there must be a reason why the new way to work out these values was implemented, but for some reason it only works for normal mobs (rank 0).

    The fault is occurring here:

    CreatureClassLvlStats const* cCLS = sObjectMgr.GetCreatureClassLvlStats(level, cinfo->UnitClass);

    Well, presumably the way the GetCreatureClassLvlStats( ) function is working out the values is wrong; at least for non rank 0 mobs.

    Link to comment
    Share on other sites

    [CENTER][B][SIZE=4][COLOR="#008000"]FIX[/COLOR][/SIZE][/B]

    [B][SIZE=3][COLOR="#008000"]For Real!!!![/COLOR][/SIZE][/B][/CENTER]


    Okay, this will result in the correct health and mana for the creatures, but does not fix the failing function. I could not interpret the meaning of the code (or be bothered to try?).

    What this fix does is only run the first part of the IF ELSE statement if the rank of the creature is 0. If the creature is of any other rank it will run the second part of the IF ELSE statement:

    [B][SIZE=3][COLOR="#008000"]How to:[/COLOR][/SIZE][/B]

    [B]Replace this code: [/B]
    file: Creature.cpp
    line: 1193
    [B][COLOR="#FF0000"]if (cinfo->ArmorMultiplier > 0 && cCLS)[/COLOR][/B]

    [B]with this code:[/B]
    [B][COLOR="#008000"]if (cinfo->Rank == 0 & cinfo->ArmorMultiplier > 0 && cCLS)[/COLOR][/B]


    [B][SIZE=3]CODE AS IT WILL APPEAR AFTER THE FIX IS ADDED (excluding a couple of comments)[/SIZE][/B]

    CreatureClassLvlStats const* cCLS = sObjectMgr.GetCreatureClassLvlStats(level, cinfo->UnitClass);
    if (cinfo->Rank == 0 & cinfo->ArmorMultiplier > 0 && cCLS) // this code only works on rank 0 creatures
    {
    // Use Creature Stats to calculate stat values

    // health
    health = cCLS->BaseHealth * cinfo->HealthMultiplier;

    // mana
    mana = cCLS->BaseMana * cinfo->PowerMultiplier;
    }
    else // this code works on all ranks
    {
    // Use old style to calculate stat values
    float rellevel = maxlevel == minlevel ? 0 : (float(level - minlevel)) / (maxlevel - minlevel);

    // health
    uint32 minhealth = std::min(cinfo->MaxLevelHealth, cinfo->MinLevelHealth);
    uint32 maxhealth = std::max(cinfo->MaxLevelHealth, cinfo->MinLevelHealth);
    health = uint32(minhealth + uint32(rellevel * (maxhealth - minhealth)));

    // mana
    uint32 minmana = std::min(cinfo->MaxLevelMana, cinfo->MinLevelMana);
    uint32 maxmana = std::max(cinfo->MaxLevelMana, cinfo->MinLevelMana);
    mana = minmana + uint32(rellevel * (maxmana - minmana));
    }


    I'm not sure that they would allow this fix to be PR'd, as ideally the function that is at fault should be fixed and not to just have a simple work-a-round like this.

    Link to comment
    Share on other sites

    Don't rewrite the wheel... This has been already analyzed and the issue was because everything to make calculation about monster hp/mana is ready within the DB but not populated (so basically they all have the same multiplier).

    Just update your DB with the correct SQL query and that will be solved. (Unfortunately, I don't remind it by heart... maybe someone can find it back since I posted it on Skype channel).

    Link to comment
    Share on other sites

    We should be posting stuff like that on the forum, or in a ticket. I can't use Skype since MS took it over and canned the 64bit Linux port. yes, we've had 64bit systems since 2003 but MS only writes 32bit code in 2014. Makes perfect sense.

    Anyhow, if you can get the SQL, I'll test it also.

    Link to comment
    Share on other sites

    UPDATE creature_template, creature_template_classlevelstats SET PowerMultiplier = MinLevelMana/BaseMana
    WHERE creature_template_classlevelstats.Level = MinLevel and BaseMana != 0;


    UPDATE creature_template, creature_template_classlevelstats SET HealthMultiplier = MinLevelHealth/BaseHealthExp0
    WHERE creature_template_classlevelstats.Level = MinLevel;


    It was something like this for health/mana.

    Link to comment
    Share on other sites

    [quote=Talendrys]UPDATE creature_template, creature_template_classlevelstats SET PowerMultiplier = MinLevelMana/BaseMana
    WHERE creature_template_classlevelstats.Level = MinLevel and BaseMana != 0;


    UPDATE creature_template, creature_template_classlevelstats SET HealthMultiplier = MinLevelHealth/BaseHealthExp0
    WHERE creature_template_classlevelstats.Level = MinLevel;


    It was something like this for health/mana.[/quote]

    To correct your SQL statement, it was
    UPDATE creature_template, creature_template_classlevelstats SET ManaMultiplier = MinLevelMana/BaseMana
    WHERE creature_template_classlevelstats.Level = MinLevel and BaseMana != 0;

    (ManaMultiplier instead of PowerMultiplier, which doesn't exist)
    for the Mana statement.

    Those two actually fixed the hp & mana issues :)
    Thank you very much!

    Taerar Screenshot:
    [url]http://postimg.org/image/rfvc2rwd7/full/[/url]

    Link to comment
    Share on other sites

    [B][SIZE=3][COLOR="#008000"]A Pull Request has now been made with the above fix for this issue:[/COLOR][/SIZE][/B]

    [url]https://github.com/Chuck5ta/database/commit/5456b16ba4382702514783ea41f3a02c953a8cdf[/url]

    Link to comment
    Share on other sites



    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use