fix(DB/SAI): Rework Naturalist Bite in SAI (#15323)

This commit is contained in:
Gultask
2023-03-10 21:36:48 -03:00
committed by GitHub
parent 67d02d4f1e
commit e1d9dbf3fc
2 changed files with 72 additions and 88 deletions

View File

@@ -37,90 +37,6 @@ EndContentData */
#include "ScriptedEscortAI.h"
#include "ScriptedGossip.h"
// Ours
enum eNaturalist
{
SPELL_MARK_OF_BITE = 34906,
GO_CAGE_ENTRY = 182094,
};
class npc_natrualist_bite : public CreatureScript
{
public:
npc_natrualist_bite() : CreatureScript("npc_natrualist_bite") { }
bool OnGossipHello(Player* player, Creature* creature) override
{
uint32 menuId = creature->AI()->GetData(1) ? 7540 : 7520;
player->PrepareGossipMenu(creature, menuId, false);
player->SendPreparedGossip(creature);
return true;
}
bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 /*action*/) override
{
ClearGossipMenuFor(player);
CloseGossipMenuFor(player);
if (creature->AI()->GetData(1))
{
creature->CastSpell(player, SPELL_MARK_OF_BITE, true);
player->KilledMonsterCredit(creature->GetEntry());
}
else
{
creature->SetImmuneToAll(false);
Creature* cr;
if ((cr = creature->SummonCreature(17957, -186, -790, 43.8f, 4.2f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)))
cr->AI()->AttackStart(creature);
if ((cr = creature->SummonCreature(17960, -188, -783, 43.8f, 4.2f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)))
cr->AI()->AttackStart(player);
if ((cr = creature->SummonCreature(17957, -196, -783, 43.8f, 4.4f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)))
cr->AI()->AttackStart(player);
GameObject* cage = creature->FindNearestGameObject(GO_CAGE_ENTRY, 20.0f);
if (cage)
cage->SetGoState(GO_STATE_ACTIVE);
creature->SetHomePosition(-195.39f, -795.91f, 43.8f, 1.0f);
creature->AI()->Talk(1);
}
return true;
}
struct npc_natrualist_biteAI : public ScriptedAI
{
npc_natrualist_biteAI(Creature* creature) : ScriptedAI(creature)
{
_spoken = 0;
}
uint8 _spoken;
void MoveInLineOfSight(Unit* who) override
{
if (!_spoken && !me->IsHostileTo(who))
{
_spoken = 1;
Talk(0);
}
ScriptedAI::MoveInLineOfSight(who);
}
void JustEngagedWith(Unit*) override
{
_spoken = 2;
}
uint32 GetData(uint32) const override
{
return _spoken == 2;
}
};
CreatureAI* GetAI(Creature* creature) const override
{
return new npc_natrualist_biteAI (creature);
}
};
// Theirs
/*######
## npcs_ashyen_and_keleth
@@ -534,10 +450,7 @@ public:
void AddSC_zangarmarsh()
{
// Ours
new npc_natrualist_bite();
// Theris
// Theirs
new npcs_ashyen_and_keleth();
new npc_cooshcoosh();
new npc_elder_kuruti();