Scripts/Battlefield: Move npc_wg_give_promotion_credit script to BattlefieldWG

The script references BattlefieldWG, which is not exported in dynamic builds.
Move the script, so it is in the same library.
This commit is contained in:
Carbenium
2020-06-21 23:36:05 +02:00
committed by Peter Keresztes Schmidt
parent f7faf20254
commit c40b897d36
2 changed files with 31 additions and 29 deletions

View File

@@ -21,6 +21,7 @@
#include "BattlefieldWG.h"
#include "AchievementMgr.h"
#include "BattlefieldMgr.h"
#include "Battleground.h"
#include "CreatureTextMgr.h"
#include "GameObject.h"
@@ -32,6 +33,7 @@
#include "Opcodes.h"
#include "Player.h"
#include "Random.h"
#include "ScriptedCreature.h"
#include "ScriptMgr.h"
#include "SpellAuras.h"
#include "TemporarySummon.h"
@@ -1864,6 +1866,35 @@ public:
}
};
class npc_wg_give_promotion_credit : public CreatureScript
{
public:
npc_wg_give_promotion_credit() : CreatureScript("npc_wg_give_promotion_credit") { }
struct npc_wg_give_promotion_creditAI : public ScriptedAI
{
npc_wg_give_promotion_creditAI(Creature* creature) : ScriptedAI(creature) { }
void JustDied(Unit* killer) override
{
if (!killer || killer->GetTypeId() != TYPEID_PLAYER)
return;
BattlefieldWG* wintergrasp = static_cast<BattlefieldWG*>(sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG));
if (!wintergrasp)
return;
wintergrasp->HandlePromotion(killer->ToPlayer(), me);
}
};
CreatureAI* GetAI(Creature* creature) const override
{
return new npc_wg_give_promotion_creditAI(creature);
}
};
void AddSC_BF_wintergrasp() {
new Battlefield_wintergrasp();
new npc_wg_give_promotion_credit();
}

View File

@@ -399,34 +399,6 @@ class go_wg_vehicle_teleporter : public GameObjectScript
}
};
class npc_wg_give_promotion_credit : public CreatureScript
{
public:
npc_wg_give_promotion_credit() : CreatureScript("npc_wg_give_promotion_credit") { }
struct npc_wg_give_promotion_creditAI : public ScriptedAI
{
npc_wg_give_promotion_creditAI(Creature* creature) : ScriptedAI(creature) { }
void JustDied(Unit* killer) override
{
if (!killer || killer->GetTypeId() != TYPEID_PLAYER)
return;
BattlefieldWG* wintergrasp = static_cast<BattlefieldWG*>(sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG));
if (!wintergrasp)
return;
wintergrasp->HandlePromotion(killer->ToPlayer(), me);
}
};
CreatureAI* GetAI(Creature* creature) const override
{
return new npc_wg_give_promotion_creditAI(creature);
}
};
class spell_wintergrasp_force_building : public SpellScriptLoader
{
public:
@@ -661,7 +633,6 @@ void AddSC_wintergrasp()
new npc_wg_spirit_guide();
new npc_wg_demolisher_engineer();
new go_wg_vehicle_teleporter();
new npc_wg_give_promotion_credit();
new spell_wintergrasp_force_building();
new spell_wintergrasp_grab_passenger();
new achievement_wg_didnt_stand_a_chance();