azerothcore / mod-autobalance

Module for AzerothCore(MaNGOS -> TrinityCore -> SunwellCore)
http://www.azerothcore.org
102 stars 109 forks source link

Bug: You don't receive credit when triggering a creature update. #143

Closed lewpar closed 1 year ago

lewpar commented 1 year ago

Current Behaviour

When you trigger a creature update (ModifyCreatureAttributes(Creature* creature)) the creatures damage requirement resets for the player, this resets back to 50% of the creatures health even if you have already done damage to the creature.

If you have done more than 50% of the creatures HP in damage when this occurs and then finish killing the creature you will not get credit as you have not met the damage requirement.

Forgive me if this is not how the system works but this is what I have observed while testing which makes me believe calling creature->ResetPlayerDamageReq(); on L2857 is the culprit.

Expected Behaviour

You should receive credit for the creatures you have damaged.

Steps to reproduce the problem

  1. Enter a dungeon (I tested stockades)
  2. Damage a creature to below 50%
  3. Force a ModifyCreatureAttributes update (I level my player from 20 to 25)
  4. Finish off the creature
  5. Observe no credit

Extra Notes

No response

AC rev. hash/commit

AzerothCore #bdba972 AutoBalance #db19dfc

Operating system

Windows 11 x64

Custom changes or Modules

No other modules.

lewpar commented 1 year ago

One way I would fix this is to track what the players previous damage requirement was before the change and apply that damage % to the new damage requirement. I'm unsure if this would totally fix this issue but it makes sense in my head.

jshplayer commented 1 year ago

We're experiencing this issue on our servers currently, this has taken some time to isolate but we've had over 15 reports of dungeon scaled bosses producing no loot or kill credit after the auto balance overhaul went live on our server.

pangolp commented 1 year ago

The truth is that I have used the module very little. I studied the code from above, but if this currently happens, it should be reviewed. It's a big module, and it has many configurations and customizations.

OverlordQ commented 1 year ago

I (think) my PR should fix this. If you've done the damage threshold before it scales, it'll subtract it back out, if you haven't, it'll scale it back down. I (think) my math should be about correct.

lewpar commented 1 year ago

I (think) my PR should fix this. If you've done the damage threshold before it scales, it'll subtract it back out, if you haven't, it'll scale it back down. I (think) my math should be about correct.

The code looks good, can you comment here again when it's merged? Thanks!

OverlordQ commented 1 year ago

Actually, I think it's scaling the wrong way. Right idea, just slightly wrong numbers.

Since if you level up, the creatures would scale to higher health, so playerDamageRequired should get tweaked slightly higher. Right now my PR is tweaking downward. ~I'll have to run some more tests~

Latest commit should be good.

jshplayer commented 1 year ago

@OverlordQ thanks for your work i'm applying this and testing it currently.

pangolp commented 1 year ago

Do you know in the end if it is solved with the last pull request? To be able to merge the changes.

jshplayer commented 1 year ago

Should know in the next day or so once our players report it đź‘Ť

pangolp commented 1 year ago

Ok, if they report it then we'll try to get it approved. Keep me posted.

jshplayer commented 1 year ago

So far so good, we'll give it a full day to be sure.

jshplayer commented 1 year ago

I believe this has fixed it, we're yet to have any reports of loot issues but i'll mention it if we do.