azerothcore-wotlk icon indicating copy to clipboard operation
azerothcore-wotlk copied to clipboard

fix(Core/BG): Fix double method call on removing a player

Open Nefertumm opened this issue 4 months ago • 2 comments

Changes Proposed:

This PR proposes changes to:

  • [x] Core (units, players, creatures, game systems).
  • [ ] Scripts (bosses, spell scripts, creature scripts).
  • [ ] Database (SAI, creatures, etc).

Issues Addressed:

  • Closes none.- Idk how or why this is not causing some other issues tbh.

SOURCE:

Myself. I was creating a module I had in mind and noticed the hook OnBattlegroundRemovePlayerAtLeave was executed twice when a player left a bg. I put a breakpoint on the code and these are the two call stacks:

  1. The wrong one. image

  2. The good one. image

Basically this method shouldn't be called by Player::LeaveBattleground and should be called by BattlegroundMap.

Tests Performed:

This PR has been:

  • [x] Tested in-game by the author.
  • [ ] Tested in-game by other community members/someone else other than the author/has been live on production servers.
  • [ ] This pull request requires further testing and may have edge cases to be tested.

How to Test the Changes:

  • [ ] This pull request can be tested by following the reproduction steps provided in the linked issue
  • [ ] This pull request requires further testing. Provide steps to test your changes. If it requires any specific setup e.g multiple players please specify it as well.
  1. Use some module that uses BGScript::OnBattlegroundRemovePlayerAtLeave hook and log something, you should see it twice.
  2. Make sure it doesn't break anything else.

Nefertumm avatar Oct 07 '24 04:10 Nefertumm