fix(Scripts/Creature): Convert npc_ranger_lilatha script to RegisterCreatureAI (#10043)
This commit is contained in:
@@ -15,17 +15,6 @@
|
|||||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* ScriptData
|
|
||||||
SDName: Ghostlands
|
|
||||||
SD%Complete: 100
|
|
||||||
SDComment: Quest support: 9212.
|
|
||||||
SDCategory: Ghostlands
|
|
||||||
EndScriptData */
|
|
||||||
|
|
||||||
/* ContentData
|
|
||||||
npc_ranger_lilatha
|
|
||||||
EndContentData */
|
|
||||||
|
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
#include "ScriptMgr.h"
|
#include "ScriptMgr.h"
|
||||||
#include "ScriptedCreature.h"
|
#include "ScriptedCreature.h"
|
||||||
@@ -53,14 +42,9 @@ enum RangerLilatha
|
|||||||
NPC_SHADOWPINE_ORACLE = 16343
|
NPC_SHADOWPINE_ORACLE = 16343
|
||||||
};
|
};
|
||||||
|
|
||||||
class npc_ranger_lilatha : public CreatureScript
|
struct npc_ranger_lilatha : public npc_escortAI
|
||||||
{
|
{
|
||||||
public:
|
npc_ranger_lilatha(Creature* creature) : npc_escortAI(creature) { }
|
||||||
npc_ranger_lilatha() : CreatureScript("npc_ranger_lilatha") { }
|
|
||||||
|
|
||||||
struct npc_ranger_lilathaAI : public npc_escortAI
|
|
||||||
{
|
|
||||||
npc_ranger_lilathaAI(Creature* creature) : npc_escortAI(creature) { }
|
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId) override
|
||||||
{
|
{
|
||||||
@@ -71,8 +55,8 @@ public:
|
|||||||
switch (waypointId)
|
switch (waypointId)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
me->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
|
me->SetUInt32Value(UNIT_FIELD_BYTES_1, UNIT_STAND_STATE_STAND);
|
||||||
if (GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 20))
|
if (GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 20.0f))
|
||||||
Cage->SetGoState(GO_STATE_ACTIVE);
|
Cage->SetGoState(GO_STATE_ACTIVE);
|
||||||
Talk(SAY_START, player);
|
Talk(SAY_START, player);
|
||||||
break;
|
break;
|
||||||
@@ -112,7 +96,7 @@ public:
|
|||||||
case 33:
|
case 33:
|
||||||
me->SetFacingTo(5.858011f);
|
me->SetFacingTo(5.858011f);
|
||||||
Talk(SAY_END2, player);
|
Talk(SAY_END2, player);
|
||||||
Creature* CaptainHelios = me->FindNearestCreature(NPC_CAPTAIN_HELIOS, 50);
|
Creature* CaptainHelios = me->FindNearestCreature(NPC_CAPTAIN_HELIOS, 50.0f);
|
||||||
if (CaptainHelios)
|
if (CaptainHelios)
|
||||||
CaptainHelios->AI()->Talk(SAY_CAPTAIN_ANSWER, player);
|
CaptainHelios->AI()->Talk(SAY_CAPTAIN_ANSWER, player);
|
||||||
break;
|
break;
|
||||||
@@ -121,26 +105,17 @@ public:
|
|||||||
|
|
||||||
void Reset() override
|
void Reset() override
|
||||||
{
|
{
|
||||||
if (GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 20))
|
if (GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 20.0f))
|
||||||
Cage->SetGoState(GO_STATE_READY);
|
Cage->SetGoState(GO_STATE_READY);
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) override
|
void sQuestAccept(Player* player, Quest const* quest) override
|
||||||
{
|
{
|
||||||
if (quest->GetQuestId() == QUEST_ESCAPE_FROM_THE_CATACOMBS)
|
if (quest->GetQuestId() == QUEST_ESCAPE_FROM_THE_CATACOMBS)
|
||||||
{
|
{
|
||||||
creature->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_PASSIVE);
|
me->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_PASSIVE);
|
||||||
|
npc_escortAI::Start(true, false, player->GetGUID());
|
||||||
if (npc_escortAI* pEscortAI = CAST_AI(npc_ranger_lilatha::npc_ranger_lilathaAI, creature->AI()))
|
|
||||||
pEscortAI->Start(true, false, player->GetGUID());
|
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
CreatureAI* GetAI(Creature* creature) const override
|
|
||||||
{
|
|
||||||
return new npc_ranger_lilathaAI(creature);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -435,7 +410,7 @@ private:
|
|||||||
|
|
||||||
void AddSC_ghostlands()
|
void AddSC_ghostlands()
|
||||||
{
|
{
|
||||||
new npc_ranger_lilatha();
|
RegisterCreatureAI(npc_ranger_lilatha);
|
||||||
RegisterCreatureAI(npc_sentinel_leader);
|
RegisterCreatureAI(npc_sentinel_leader);
|
||||||
RegisterCreatureAI(npc_sentinel_infiltrator);
|
RegisterCreatureAI(npc_sentinel_infiltrator);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user