Jump to content
  • Defias Pillager - Missing mana


    madmax
    • Status: Completed
      Main Category: Database
      Sub-Category: Creature
      Version: 2.0.11 Milestone: 20 Priority: New
      Implemented Version: 21.5

    Defias Pillager - Missing mana

    Defias Pillager at Moonbrook are manaless, they can only attack with melee, they cannot use there other abilities.

    All spawn from ID: 589

    Listed as high due to lack of mana breaking there abilities.


    User Feedback

    Recommended Comments

    Perfectly fine on Rel19 (full mana bars), but on Rel20 the Pilligers have 0 mana.

    I'll check the database.

    EDIT:
    Mana related fields in both Rel19 and Rel20 versions of the database are the same:
    creature table: curmana 324
    creature_template table: ManaMiltiplier 1 MinLevelMana 324 MaxLevelMana 324

    I've no idea if any other tables are involved with this, as yet.

    Link to comment
    Share on other sites

    [B][COLOR="#008000"]IF STILL AN ISSUE, POSSIBLE PART FIX INCLUDED (19:31hrs BST - VERY CLOSE TO FULL FIX)[/COLOR][/B]
    I'm afraid the database update for mana did not fix the issue for me on Rel20 of the core and database. PowerMultiplier / ManaMultiplier neither fixed it.

    I checked the code and after a lot of commenting out and testing values, I found in the Creatures.cpp file, SetLevel( ) function the following:

    [B]IN BRIEF:[/B] Check for if the power does not regenerate: should use POWER_RAGE, not POWER_MANA

    [B]IN DETAIL[/B]


    // For non regenerating powers set 0
    if ((i == POWER_ENERGY || i == POWER_MANA) && !IsRegeneratingPower())
    value = 0;


    This looks like it says to set value to 0, if the power the creature uses is energy like a rogue or mana like a mage. Meaning mana/energy level should start at 0.
    Wrong, me thinks... mana needs to start at max value, surely! (don't call me... !)
    Me also thinks that they meant to have used POWER_RAGE, not POWER_MANA

    So, the code should be:

    // For non regenerating powers set 0
    if ((i == POWER_ENERGY || i == POWER_RAGE) && !IsRegeneratingPower())
    value = 0;


    This code ensures that the power is set to 0 for creatures that use rogue type energy and warrior type rage.

    This code change resulted in the mana appearing and the Defias Pillager using magic, BUT

    [B]ISSUE STILL:[/B] The mana does not appear to be regenerating, and it's only starting out at about 45% of the total mana.

    I'll continue my studies of the system and see if I can figure out for why (no regen and only 45% of total mana at the start)!

    EDIT: Just adding that health works fine on the Pillager - sets to full amount of health at realm start up and regenerates.

    EDIT: This code, in the Creature.cpp file, RegeneratePower() function, is evaluating to TRUE for Defias Pillagers, thus preventing the regeneration of their mana:

    if (!IsRegeneratingPower())
    return;


    If I understand this right, the call to IsRegeneratingPower() is returning FALSE, meaning that it thinks Defias Pllagers do not regen mana.

    Changing the code to:

    if (IsRegeneratingPower())
    return;


    Results in the mana regenerating as it should.

    Of course that means that code reads wrong. Me confuzzled. Damn hayfever addled noggin!

    Either IsRegeneratingPower() is not working as it should, or there is a database entry that is incorrect for the Defias Pillager. There does not seem to be an entry for mana regeneration, only health (creature_template: RegenerateHealth).

    Link to comment
    Share on other sites

    My final input re this :D Time to look more into Rexxar!

    [B][SIZE=4][COLOR="#008000"]FIX INCLUDED - see below [/COLOR][/SIZE][/B]

    I believe, but could be wrong, that this issue doe exist in the Rel20 version of the core, and that patching up from Rel19 does not actually give you a Rel20, at least not completely. Whether meant or not, I do not know.
    I COULD BE TOTALLY WRONG! but hey ho, here we go...

    If you grab the Rel20 version, thus:
    git clone --recursive git://github.com/mangoszero/server -b Rel20

    the file Creature.cpp has faults in it that prevent the mana from showing and regenerating. The code related to this differs to the Rel19 verion of the core.

    So, 2 problems actually occur:
    1) mana is not set for the creature
    2) mana does not regenerate (even after applying fix that makes the mana show)

    [B][SIZE=5][COLOR="#008000"]THE FIXES[/COLOR][/SIZE][/B]

    [B][SIZE=3]1) mana not showing[/SIZE][/B]

    file: Creature.cpp
    function: SelectLevel(const CreatureInfo* cinfo, float percentHealth, float /*percentMana*/)
    line: 1254

    [B][COLOR="#B22222"]code at fault: [/COLOR][/B]

    // For non regenerating powers set 0
    if ((i == POWER_ENERGY || i == POWER_MANA) && !IsRegeneratingPower())
    value = 0;


    [B][COLOR="#800080"]reason:[/COLOR][/B] The purpose of this code is to set the level of the power to 0, which is what should happen for rogue energy and warrior rage, but not for a caster's mana.

    [B][COLOR="#008000"]proposed fix:[/COLOR][/B]

    // For non regenerating powers set 0
    if ((i == POWER_ENERGY || i == POWER_RAGE) && !IsRegeneratingPower())
    value = 0;


    We are now using the correct constants here, for the rogue type creatures and warrior type creatures :)

    Swapping POWER_MANA for POWER_RAGE results in mana showing up on the caster.

    [B][SIZE=3] 2)mana not regenerating[/SIZE][/B]

    file: Creature.cpp
    function: RegeneratePower()
    line: 652

    [B][COLOR="#B22222"]code at fault: [/COLOR][/B]

    if (!IsRegeneratingPower())
    return;


    [B][COLOR="#800080"]reason:[/COLOR][/B] it's incorrectly evaluating the mana state.
    I don't even think it actually evaluates anything to do with mana, seeing as there is no database entry/field, that I can find, that relates to mana regeneration, only health.
    Looking at the function IsRegeneratingPower(), this uses the database field RegenerateHealth (creature_template table), via CreatureInfo::RegenerateStats (RegenerateHealth field's contents is stored here). Therefore not using anything mana related, unless I am misunderstanding how this works.

    [B][COLOR="#008000"]proposed fix: delete it[/COLOR][/B]

    Deleting this results in the caster's mana regenerating as it should.

    Looking at Rel19 of the code that deals with regeneration of mana, it has no check on whether or not the creature can regenerate mana.

    -------------------------------------------------
    [B]Seeing as there's no confirmation by others on this fault still occuring, I will go no further than to post the proposed fixes here (above).[/B]

    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