mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-24 22:26:22 +00:00
fix(Scripts/Ulduar): update Winter Jormungar and Snow Mound creature script (#17054)
* initial * add auras * spacing
This commit is contained in:
@@ -24,30 +24,49 @@
|
||||
#include "SpellAuraEffects.h"
|
||||
#include "SpellScript.h"
|
||||
#include "Vehicle.h"
|
||||
#include "TaskScheduler.h"
|
||||
|
||||
enum Texts
|
||||
{
|
||||
// Freya
|
||||
GOSSIP_MENU_FREYA = 10324,
|
||||
NPC_TEXT_FREYA = 14332,
|
||||
GOSSIP_MENU_FREYA = 10324,
|
||||
NPC_TEXT_FREYA = 14332,
|
||||
|
||||
// Hodir
|
||||
GOSSIP_MENU_HODIR = 10335,
|
||||
NPC_TEXT_HODIR = 14326,
|
||||
GOSSIP_MENU_HODIR = 10335,
|
||||
NPC_TEXT_HODIR = 14326,
|
||||
|
||||
// Mimiron
|
||||
GOSSIP_MENU_MIMIRON = 10336,
|
||||
NPC_TEXT_MIMIRON = 14334,
|
||||
GOSSIP_MENU_MIMIRON = 10336,
|
||||
NPC_TEXT_MIMIRON = 14334,
|
||||
|
||||
// Thorim
|
||||
GOSSIP_MENU_THORIM = 10337,
|
||||
NPC_TEXT_THORIM = 14333,
|
||||
GOSSIP_MENU_THORIM = 10337,
|
||||
NPC_TEXT_THORIM = 14333,
|
||||
|
||||
// Confirm assistance
|
||||
GOSSIP_MENU_CONFIRM = 10333,
|
||||
NPC_TEXT_CONFIRM = 14325,
|
||||
GOSSIP_MENU_CONFIRM = 10333,
|
||||
NPC_TEXT_CONFIRM = 14325,
|
||||
|
||||
SAY_KEEPER_SELECTED = 1,
|
||||
SAY_KEEPER_SELECTED = 1,
|
||||
};
|
||||
|
||||
enum UldNPCs
|
||||
{
|
||||
NPC_WINTER_JORMUNGAR = 34137,
|
||||
NPC_SNOW_MOUND_4 = 34146,
|
||||
NPC_SNOW_MOUND_6 = 34150,
|
||||
NPC_SNOW_MOUND_8 = 34151
|
||||
};
|
||||
|
||||
enum UldGameObjects
|
||||
{
|
||||
GOBJ_SNOW_MOUND = 194907
|
||||
};
|
||||
|
||||
enum UldSpells
|
||||
{
|
||||
SPELL_SNOW_MOUND_PARTICLES = 64615
|
||||
};
|
||||
|
||||
class npc_ulduar_keeper : public CreatureScript
|
||||
@@ -157,52 +176,72 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class npc_ulduar_snow_mound : public CreatureScript
|
||||
struct npc_ulduar_snow_mound : public ScriptedAI
|
||||
{
|
||||
public:
|
||||
npc_ulduar_snow_mound() : CreatureScript("npc_ulduar_snow_mound") { }
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
npc_ulduar_snow_mound(Creature* creature) : ScriptedAI(creature)
|
||||
{
|
||||
return GetUlduarAI<npc_ulduar_snow_moundAI>(creature);
|
||||
_activated = false;
|
||||
_count = 0;
|
||||
_counter = 0;
|
||||
}
|
||||
|
||||
struct npc_ulduar_snow_moundAI : public ScriptedAI
|
||||
void MoveInLineOfSight(Unit* who) override
|
||||
{
|
||||
npc_ulduar_snow_moundAI(Creature* creature) : ScriptedAI(creature)
|
||||
if (!_activated && who->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
activated = false;
|
||||
me->CastSpell(me, 64615, true);
|
||||
}
|
||||
|
||||
bool activated;
|
||||
|
||||
void MoveInLineOfSight(Unit* who) override
|
||||
{
|
||||
if (!activated && who->GetTypeId() == TYPEID_PLAYER)
|
||||
if (me->GetExactDist2d(who) <= 25.0f && me->GetMap()->isInLineOfSight(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ() + 5.0f,
|
||||
who->GetPositionX(), who->GetPositionY(), who->GetPositionZ() + 5.0f, 2, LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags::Nothing))
|
||||
if (me->GetExactDist2d(who) <= 10.0f && me->GetMap()->isInLineOfSight(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ() + 5.0f,
|
||||
who->GetPositionX(), who->GetPositionY(), who->GetPositionZ() + 5.0f, 2, LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags::Nothing))
|
||||
{
|
||||
_activated = true;
|
||||
me->RemoveAura(SPELL_SNOW_MOUND_PARTICLES);
|
||||
if (GameObject* go = me->FindNearestGameObject(GOBJ_SNOW_MOUND, 5.0f))
|
||||
{
|
||||
activated = true;
|
||||
me->RemoveAura(64615);
|
||||
if (GameObject* go = me->FindNearestGameObject(194907, 5.0f))
|
||||
go->Delete();
|
||||
uint8 count;
|
||||
if (me->GetEntry() == 34146) count = 4;
|
||||
else if (me->GetEntry() == 34150) count = 6;
|
||||
else count = 8;
|
||||
for (uint8 i = 0; i < count; ++i)
|
||||
{
|
||||
float a = rand_norm() * 2 * M_PI;
|
||||
float d = rand_norm() * 4.0f;
|
||||
if (Creature* c = me->SummonCreature(34137, me->GetPositionX() + cos(a) * d, me->GetPositionY() + std::sin(a) * d, me->GetPositionZ() + 1.0f, 0.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000))
|
||||
c->AI()->AttackStart(who);
|
||||
}
|
||||
go->Delete();
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 /*diff*/) override {}
|
||||
};
|
||||
switch (me->GetEntry())
|
||||
{
|
||||
case NPC_SNOW_MOUND_4:
|
||||
_count = 4;
|
||||
break;
|
||||
case NPC_SNOW_MOUND_6:
|
||||
_count = 6;
|
||||
break;
|
||||
case NPC_SNOW_MOUND_8:
|
||||
_count = 8;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
_scheduler.Schedule(0s, [this](TaskContext context)
|
||||
{
|
||||
_counter++;
|
||||
float a = rand_norm() * 2 * M_PI; //needs verification from sniffs
|
||||
float d = rand_norm() * 4.0f;
|
||||
if (Creature* jormungar = me->SummonCreature(NPC_WINTER_JORMUNGAR, me->GetPositionX() + cos(a) * d, me->GetPositionY() + std::sin(a) * d, me->GetPositionZ() + 1.0f, 0.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000))
|
||||
{
|
||||
jormungar->SetInCombatWithZone();
|
||||
}
|
||||
if (_counter < _count)
|
||||
{
|
||||
context.Repeat(2s);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
_scheduler.Update(diff);
|
||||
}
|
||||
|
||||
private:
|
||||
bool _activated;
|
||||
TaskScheduler _scheduler;
|
||||
uint8 _count;
|
||||
uint8 _counter;
|
||||
};
|
||||
|
||||
class npc_ulduar_storm_tempered_keeper : public CreatureScript
|
||||
@@ -512,13 +551,11 @@ struct npc_salvaged_siege_engine : public VehicleAI
|
||||
void AddSC_ulduar()
|
||||
{
|
||||
new npc_ulduar_keeper();
|
||||
|
||||
new spell_ulduar_energy_sap();
|
||||
new npc_ulduar_snow_mound();
|
||||
RegisterUlduarCreatureAI(npc_ulduar_snow_mound);
|
||||
new npc_ulduar_storm_tempered_keeper();
|
||||
new npc_ulduar_arachnopod_destroyer();
|
||||
new spell_ulduar_arachnopod_damaged();
|
||||
|
||||
new AreaTrigger_at_celestial_planetarium_enterance();
|
||||
new go_call_tram();
|
||||
|
||||
|
||||
@@ -302,4 +302,6 @@ inline AI* GetUlduarAI(T* obj)
|
||||
return GetInstanceAI<AI>(obj, UlduarScriptName);
|
||||
}
|
||||
|
||||
#define RegisterUlduarCreatureAI(ai_name) RegisterCreatureAIWithFactory(ai_name, GetUlduarAI)
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user