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:
@@ -1614,7 +1614,8 @@ namespace Game.BattleGrounds
|
|||||||
RewardXPAtKill(killer, victim);
|
RewardXPAtKill(killer, victim);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public virtual void HandleKillUnit(Creature creature, Player killer) { }
|
|
||||||
|
public virtual void HandleKillUnit(Creature creature, Unit killer) { }
|
||||||
|
|
||||||
// Return the player's team based on Battlegroundplayer info
|
// Return the player's team based on Battlegroundplayer info
|
||||||
// Used in same faction arena matches mainly
|
// Used in same faction arena matches mainly
|
||||||
|
|||||||
@@ -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)
|
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;
|
uint worldStateId = Attackers == BatttleGroundTeamId.Horde ? SAWorldStateIds.DestroyedHordeVehicles : SAWorldStateIds.DestroyedAllianceVehicles;
|
||||||
int currentDestroyedVehicles = Global.WorldStateMgr.GetValue((int)worldStateId, GetBgMap());
|
int currentDestroyedVehicles = Global.WorldStateMgr.GetValue((int)worldStateId, GetBgMap());
|
||||||
UpdateWorldState(worldStateId, currentDestroyedVehicles + 1);
|
UpdateWorldState(worldStateId, currentDestroyedVehicles + 1);
|
||||||
|
|||||||
@@ -998,17 +998,21 @@ namespace Game.Entities
|
|||||||
bf.HandleKill(player, victim);
|
bf.HandleKill(player, victim);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Battlegroundthings (do this at the end, so the death state flag will be properly set to handle in the bg.handlekill)
|
// battleground things (do this at the end, so the death state flag will be properly set to handle in the bg->handlekill)
|
||||||
if (player != null && player.InBattleground())
|
if (attacker != null)
|
||||||
{
|
{
|
||||||
Battleground bg = player.GetBattleground();
|
BattlegroundMap bgMap = victim.GetMap().ToBattlegroundMap();
|
||||||
if (bg != null)
|
if (bgMap != null)
|
||||||
{
|
{
|
||||||
Player playerVictim = victim.ToPlayer();
|
Battleground bg = bgMap.GetBG();
|
||||||
if (playerVictim != null)
|
if (bg != null)
|
||||||
bg.HandleKillPlayer(playerVictim, player);
|
{
|
||||||
else
|
Player playerVictim = victim.ToPlayer();
|
||||||
bg.HandleKillUnit(victim.ToCreature(), player);
|
if (playerVictim != null)
|
||||||
|
bg.HandleKillPlayer(playerVictim, player);
|
||||||
|
else
|
||||||
|
bg.HandleKillUnit(victim.ToCreature(), player);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user