Scripts/Battlefield: Move npc_wg_give_promotion_credit script to BattlefieldWG

Port From (https://github.com/TrinityCore/TrinityCore/commit/81a3c135a7ee688998b273034d0ba60dd7bb8158)
This commit is contained in:
hondacrx
2022-02-24 10:54:34 -05:00
parent 569232c3fe
commit b9720e3876
+20 -1
View File
@@ -22,6 +22,7 @@ using Game.Networking.Packets;
using Game.Spells;
using System.Collections.Generic;
using Game.Scripting;
using Game.AI;
namespace Game.BattleFields
{
@@ -606,7 +607,7 @@ namespace Game.BattleFields
UpdateVehicleCountWG();
}
void HandlePromotion(Player playerKiller, Unit unitKilled)
public void HandlePromotion(Player playerKiller, Unit unitKilled)
{
int teamId = playerKiller.GetTeamId();
@@ -1646,4 +1647,22 @@ namespace Game.BattleFields
return new BattlefieldWG();
}
}
[Script]
class npc_wg_give_promotion_credit : ScriptedAI
{
public npc_wg_give_promotion_credit(Creature creature) : base(creature) { }
public override void JustDied(Unit killer)
{
if (!killer || !killer.IsPlayer())
return;
BattlefieldWG wintergrasp = (BattlefieldWG)Global.BattleFieldMgr.GetBattlefieldByBattleId(BattlefieldIds.WG);
if (wintergrasp == null)
return;
wintergrasp.HandlePromotion(killer.ToPlayer(), me);
}
}
}