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 authored and Ovahlord committed 2022-10-09 00:43:35 +02:00
1 parent 0ef220fca0
commit 2a71d4f741
2 files changed
+31 -29

No files matched your search

@@ -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"
@@ -1851,7 +1853,36 @@ 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();
}
@@ -397,34 +397,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:
@@ -606,7 +578,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();