Core/Battleground: Changed HandleKillUnit hook to accept any Unit as killer

Port From (https://github.com/TrinityCore/TrinityCore/commit/bf107e0581c58f767b21f15fe7f75cb7eac95d97)
This commit is contained in:
hondacrx
2024-02-05 13:31:24 -05:00
parent 49cf411e04
commit 35f46bea57
3 changed files with 20 additions and 12 deletions
@@ -580,11 +580,14 @@ namespace Game.BattleGrounds.Zones
}
}
public override void HandleKillUnit(Creature creature, Player killer)
public override void HandleKillUnit(Creature creature, Unit killer)
{
if (creature.GetEntry() == SACreatureIds.Demolisher)
{
UpdatePvpStat(killer, (uint)StrandOfTheAncientsPvpStats.DemolishersDestroyed, 1);
Player killerPlayer = killer.GetCharmerOrOwnerPlayerOrPlayerItself();
if (killerPlayer != null)
UpdatePvpStat(killerPlayer, (uint)StrandOfTheAncientsPvpStats.DemolishersDestroyed, 1);
uint worldStateId = Attackers == BatttleGroundTeamId.Horde ? SAWorldStateIds.DestroyedHordeVehicles : SAWorldStateIds.DestroyedAllianceVehicles;
int currentDestroyedVehicles = Global.WorldStateMgr.GetValue((int)worldStateId, GetBgMap());
UpdateWorldState(worldStateId, currentDestroyedVehicles + 1);