azerothcore-wotlk
azerothcore-wotlk copied to clipboard
fix(Core/BG): Fix double method call on removing a player
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:
-
The wrong one.
-
The good one.
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.
- Use some module that uses BGScript::OnBattlegroundRemovePlayerAtLeave hook and log something, you should see it twice.
- Make sure it doesn't break anything else.