Jump to content

Recommended Posts

Hi,

As default in sources, you cannot exceed mob hp's by ~21,4 million because there some part of the game where a percentage calculation happens. When calculating the percentage it multiplies the current HP with 100 then divide by the full HP. At the multiplying part it runs out of Int limits and because of that things get buggy. I dont really want to change the datatype of HP stuff in the whole source. I've made a "ghetto" fix but im looking for better solutions. Suggestions?

 

Or just multiply after dividing? Like (currentHP / maxHP) * 100?

 

WARNING: !!GHETTO CODE!!

Spoiler

spacer.png

 

Thanks!

Edited by Metin2 Dev
Core X - External 2 Internal

System Administrator @ Hungarian Government
System Administrator @ Vibestro
Freelancer Developer @ Various projects

Link to comment
Share on other sites

bHPPercent = MINMAX(0, reinterpret_cast<uint64_t>((static_cast<int64_t>(TargetPacket.icurHP * static_cast<int64_t>(100)) / static_cast<int64_t>(TargetPacket.iMaxHP)), 100));

edit :

uint64_t limit = 18,446,744,073,709,551,615

 

ALSO BIG NOTE;

 

int MINMAX(int  min, int value, int max)
{
    int tv;

    tv = (min > value ? min : value);
    return (max < tv) ? max : tv;
}

Edited by Denizeri24
  • Love 1
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / 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.