mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Scripts/Misc: Migrate world event scripts to separate files 2 (#27309)
This commit is contained in:
@@ -451,6 +451,66 @@ class spell_brewfest_barker_bunny : public SpellScriptLoader
|
||||
}
|
||||
};
|
||||
|
||||
enum BrewfestMountTransformation
|
||||
{
|
||||
SPELL_MOUNT_RAM_100 = 43900,
|
||||
SPELL_MOUNT_RAM_60 = 43899,
|
||||
SPELL_MOUNT_KODO_100 = 49379,
|
||||
SPELL_MOUNT_KODO_60 = 49378,
|
||||
SPELL_BREWFEST_MOUNT_TRANSFORM = 49357,
|
||||
SPELL_BREWFEST_MOUNT_TRANSFORM_REVERSE = 52845,
|
||||
};
|
||||
|
||||
class spell_item_brewfest_mount_transformation : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_item_brewfest_mount_transformation);
|
||||
|
||||
bool Validate(SpellInfo const* /*spell*/) override
|
||||
{
|
||||
return ValidateSpellInfo(
|
||||
{
|
||||
SPELL_MOUNT_RAM_100,
|
||||
SPELL_MOUNT_RAM_60,
|
||||
SPELL_MOUNT_KODO_100,
|
||||
SPELL_MOUNT_KODO_60
|
||||
});
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /* effIndex */)
|
||||
{
|
||||
Player* caster = GetCaster()->ToPlayer();
|
||||
if (caster->HasAuraType(SPELL_AURA_MOUNTED))
|
||||
{
|
||||
caster->RemoveAurasByType(SPELL_AURA_MOUNTED);
|
||||
uint32 spell_id;
|
||||
|
||||
switch (GetSpellInfo()->Id)
|
||||
{
|
||||
case SPELL_BREWFEST_MOUNT_TRANSFORM:
|
||||
if (caster->GetSpeedRate(MOVE_RUN) >= 2.0f)
|
||||
spell_id = caster->GetTeam() == ALLIANCE ? SPELL_MOUNT_RAM_100 : SPELL_MOUNT_KODO_100;
|
||||
else
|
||||
spell_id = caster->GetTeam() == ALLIANCE ? SPELL_MOUNT_RAM_60 : SPELL_MOUNT_KODO_60;
|
||||
break;
|
||||
case SPELL_BREWFEST_MOUNT_TRANSFORM_REVERSE:
|
||||
if (caster->GetSpeedRate(MOVE_RUN) >= 2.0f)
|
||||
spell_id = caster->GetTeam() == HORDE ? SPELL_MOUNT_RAM_100 : SPELL_MOUNT_KODO_100;
|
||||
else
|
||||
spell_id = caster->GetTeam() == HORDE ? SPELL_MOUNT_RAM_60 : SPELL_MOUNT_KODO_60;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
caster->CastSpell(caster, spell_id, true);
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_item_brewfest_mount_transformation::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_event_brewfest()
|
||||
{
|
||||
new spell_brewfest_giddyup();
|
||||
@@ -462,4 +522,5 @@ void AddSC_event_brewfest()
|
||||
new spell_brewfest_relay_race_turn_in();
|
||||
new spell_brewfest_dismount_ram();
|
||||
new spell_brewfest_barker_bunny();
|
||||
RegisterSpellScript(spell_item_brewfest_mount_transformation);
|
||||
}
|
||||
|
||||
@@ -105,7 +105,49 @@ class spell_love_is_in_the_air_romantic_picnic : public AuraScript
|
||||
}
|
||||
};
|
||||
|
||||
enum CreateHeartCandy
|
||||
{
|
||||
SPELL_CREATE_HEART_CANDY_1 = 26668,
|
||||
SPELL_CREATE_HEART_CANDY_2 = 26670,
|
||||
SPELL_CREATE_HEART_CANDY_3 = 26671,
|
||||
SPELL_CREATE_HEART_CANDY_4 = 26672,
|
||||
SPELL_CREATE_HEART_CANDY_5 = 26673,
|
||||
SPELL_CREATE_HEART_CANDY_6 = 26674,
|
||||
SPELL_CREATE_HEART_CANDY_7 = 26675,
|
||||
SPELL_CREATE_HEART_CANDY_8 = 26676
|
||||
};
|
||||
|
||||
std::array<uint32, 8> const CreateHeartCandySpells =
|
||||
{
|
||||
SPELL_CREATE_HEART_CANDY_1, SPELL_CREATE_HEART_CANDY_2, SPELL_CREATE_HEART_CANDY_3, SPELL_CREATE_HEART_CANDY_4,
|
||||
SPELL_CREATE_HEART_CANDY_5, SPELL_CREATE_HEART_CANDY_6, SPELL_CREATE_HEART_CANDY_7, SPELL_CREATE_HEART_CANDY_8
|
||||
};
|
||||
|
||||
// 26678 - Create Heart Candy
|
||||
class spell_item_create_heart_candy : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_item_create_heart_candy);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
return ValidateSpellInfo(CreateHeartCandySpells);
|
||||
}
|
||||
|
||||
void HandleScript(SpellEffIndex effIndex)
|
||||
{
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
if (Player* target = GetHitPlayer())
|
||||
target->CastSpell(target, Trinity::Containers::SelectRandomContainerElement(CreateHeartCandySpells), true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_item_create_heart_candy::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_event_love_is_in_the_air()
|
||||
{
|
||||
RegisterSpellScript(spell_love_is_in_the_air_romantic_picnic);
|
||||
RegisterSpellScript(spell_item_create_heart_candy);
|
||||
}
|
||||
|
||||
@@ -22,6 +22,288 @@
|
||||
#include "Player.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "SpellInfo.h"
|
||||
#include "SpellMgr.h"
|
||||
#include "SpellScript.h"
|
||||
#include "TemporarySummon.h"
|
||||
|
||||
enum Fireworks
|
||||
{
|
||||
NPC_OMEN = 15467,
|
||||
NPC_MINION_OF_OMEN = 15466,
|
||||
NPC_FIREWORK_BLUE = 15879,
|
||||
NPC_FIREWORK_GREEN = 15880,
|
||||
NPC_FIREWORK_PURPLE = 15881,
|
||||
NPC_FIREWORK_RED = 15882,
|
||||
NPC_FIREWORK_YELLOW = 15883,
|
||||
NPC_FIREWORK_WHITE = 15884,
|
||||
NPC_FIREWORK_BIG_BLUE = 15885,
|
||||
NPC_FIREWORK_BIG_GREEN = 15886,
|
||||
NPC_FIREWORK_BIG_PURPLE = 15887,
|
||||
NPC_FIREWORK_BIG_RED = 15888,
|
||||
NPC_FIREWORK_BIG_YELLOW = 15889,
|
||||
NPC_FIREWORK_BIG_WHITE = 15890,
|
||||
|
||||
NPC_CLUSTER_BLUE = 15872,
|
||||
NPC_CLUSTER_RED = 15873,
|
||||
NPC_CLUSTER_GREEN = 15874,
|
||||
NPC_CLUSTER_PURPLE = 15875,
|
||||
NPC_CLUSTER_WHITE = 15876,
|
||||
NPC_CLUSTER_YELLOW = 15877,
|
||||
NPC_CLUSTER_BIG_BLUE = 15911,
|
||||
NPC_CLUSTER_BIG_GREEN = 15912,
|
||||
NPC_CLUSTER_BIG_PURPLE = 15913,
|
||||
NPC_CLUSTER_BIG_RED = 15914,
|
||||
NPC_CLUSTER_BIG_WHITE = 15915,
|
||||
NPC_CLUSTER_BIG_YELLOW = 15916,
|
||||
NPC_CLUSTER_ELUNE = 15918,
|
||||
|
||||
GO_FIREWORK_LAUNCHER_1 = 180771,
|
||||
GO_FIREWORK_LAUNCHER_2 = 180868,
|
||||
GO_FIREWORK_LAUNCHER_3 = 180850,
|
||||
GO_CLUSTER_LAUNCHER_1 = 180772,
|
||||
GO_CLUSTER_LAUNCHER_2 = 180859,
|
||||
GO_CLUSTER_LAUNCHER_3 = 180869,
|
||||
GO_CLUSTER_LAUNCHER_4 = 180874,
|
||||
|
||||
SPELL_ROCKET_BLUE = 26344,
|
||||
SPELL_ROCKET_GREEN = 26345,
|
||||
SPELL_ROCKET_PURPLE = 26346,
|
||||
SPELL_ROCKET_RED = 26347,
|
||||
SPELL_ROCKET_WHITE = 26348,
|
||||
SPELL_ROCKET_YELLOW = 26349,
|
||||
SPELL_ROCKET_BIG_BLUE = 26351,
|
||||
SPELL_ROCKET_BIG_GREEN = 26352,
|
||||
SPELL_ROCKET_BIG_PURPLE = 26353,
|
||||
SPELL_ROCKET_BIG_RED = 26354,
|
||||
SPELL_ROCKET_BIG_WHITE = 26355,
|
||||
SPELL_ROCKET_BIG_YELLOW = 26356,
|
||||
SPELL_LUNAR_FORTUNE = 26522,
|
||||
|
||||
ANIM_GO_LAUNCH_FIREWORK = 3,
|
||||
ZONE_MOONGLADE = 493,
|
||||
};
|
||||
|
||||
Position omenSummonPos = {7558.993f, -2839.999f, 450.0214f, 4.46f};
|
||||
|
||||
class npc_firework : public CreatureScript
|
||||
{
|
||||
public:
|
||||
npc_firework() : CreatureScript("npc_firework") { }
|
||||
|
||||
struct npc_fireworkAI : public ScriptedAI
|
||||
{
|
||||
npc_fireworkAI(Creature* creature) : ScriptedAI(creature) { }
|
||||
|
||||
bool isCluster()
|
||||
{
|
||||
switch (me->GetEntry())
|
||||
{
|
||||
case NPC_FIREWORK_BLUE:
|
||||
case NPC_FIREWORK_GREEN:
|
||||
case NPC_FIREWORK_PURPLE:
|
||||
case NPC_FIREWORK_RED:
|
||||
case NPC_FIREWORK_YELLOW:
|
||||
case NPC_FIREWORK_WHITE:
|
||||
case NPC_FIREWORK_BIG_BLUE:
|
||||
case NPC_FIREWORK_BIG_GREEN:
|
||||
case NPC_FIREWORK_BIG_PURPLE:
|
||||
case NPC_FIREWORK_BIG_RED:
|
||||
case NPC_FIREWORK_BIG_YELLOW:
|
||||
case NPC_FIREWORK_BIG_WHITE:
|
||||
return false;
|
||||
case NPC_CLUSTER_BLUE:
|
||||
case NPC_CLUSTER_GREEN:
|
||||
case NPC_CLUSTER_PURPLE:
|
||||
case NPC_CLUSTER_RED:
|
||||
case NPC_CLUSTER_YELLOW:
|
||||
case NPC_CLUSTER_WHITE:
|
||||
case NPC_CLUSTER_BIG_BLUE:
|
||||
case NPC_CLUSTER_BIG_GREEN:
|
||||
case NPC_CLUSTER_BIG_PURPLE:
|
||||
case NPC_CLUSTER_BIG_RED:
|
||||
case NPC_CLUSTER_BIG_YELLOW:
|
||||
case NPC_CLUSTER_BIG_WHITE:
|
||||
case NPC_CLUSTER_ELUNE:
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
GameObject* FindNearestLauncher()
|
||||
{
|
||||
GameObject* launcher = nullptr;
|
||||
|
||||
if (isCluster())
|
||||
{
|
||||
GameObject* launcher1 = GetClosestGameObjectWithEntry(me, GO_CLUSTER_LAUNCHER_1, 0.5f);
|
||||
GameObject* launcher2 = GetClosestGameObjectWithEntry(me, GO_CLUSTER_LAUNCHER_2, 0.5f);
|
||||
GameObject* launcher3 = GetClosestGameObjectWithEntry(me, GO_CLUSTER_LAUNCHER_3, 0.5f);
|
||||
GameObject* launcher4 = GetClosestGameObjectWithEntry(me, GO_CLUSTER_LAUNCHER_4, 0.5f);
|
||||
|
||||
if (launcher1)
|
||||
launcher = launcher1;
|
||||
else if (launcher2)
|
||||
launcher = launcher2;
|
||||
else if (launcher3)
|
||||
launcher = launcher3;
|
||||
else if (launcher4)
|
||||
launcher = launcher4;
|
||||
}
|
||||
else
|
||||
{
|
||||
GameObject* launcher1 = GetClosestGameObjectWithEntry(me, GO_FIREWORK_LAUNCHER_1, 0.5f);
|
||||
GameObject* launcher2 = GetClosestGameObjectWithEntry(me, GO_FIREWORK_LAUNCHER_2, 0.5f);
|
||||
GameObject* launcher3 = GetClosestGameObjectWithEntry(me, GO_FIREWORK_LAUNCHER_3, 0.5f);
|
||||
|
||||
if (launcher1)
|
||||
launcher = launcher1;
|
||||
else if (launcher2)
|
||||
launcher = launcher2;
|
||||
else if (launcher3)
|
||||
launcher = launcher3;
|
||||
}
|
||||
|
||||
return launcher;
|
||||
}
|
||||
|
||||
uint32 GetFireworkSpell(uint32 entry)
|
||||
{
|
||||
switch (entry)
|
||||
{
|
||||
case NPC_FIREWORK_BLUE:
|
||||
return SPELL_ROCKET_BLUE;
|
||||
case NPC_FIREWORK_GREEN:
|
||||
return SPELL_ROCKET_GREEN;
|
||||
case NPC_FIREWORK_PURPLE:
|
||||
return SPELL_ROCKET_PURPLE;
|
||||
case NPC_FIREWORK_RED:
|
||||
return SPELL_ROCKET_RED;
|
||||
case NPC_FIREWORK_YELLOW:
|
||||
return SPELL_ROCKET_YELLOW;
|
||||
case NPC_FIREWORK_WHITE:
|
||||
return SPELL_ROCKET_WHITE;
|
||||
case NPC_FIREWORK_BIG_BLUE:
|
||||
return SPELL_ROCKET_BIG_BLUE;
|
||||
case NPC_FIREWORK_BIG_GREEN:
|
||||
return SPELL_ROCKET_BIG_GREEN;
|
||||
case NPC_FIREWORK_BIG_PURPLE:
|
||||
return SPELL_ROCKET_BIG_PURPLE;
|
||||
case NPC_FIREWORK_BIG_RED:
|
||||
return SPELL_ROCKET_BIG_RED;
|
||||
case NPC_FIREWORK_BIG_YELLOW:
|
||||
return SPELL_ROCKET_BIG_YELLOW;
|
||||
case NPC_FIREWORK_BIG_WHITE:
|
||||
return SPELL_ROCKET_BIG_WHITE;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
uint32 GetFireworkGameObjectId()
|
||||
{
|
||||
uint32 spellId = 0;
|
||||
|
||||
switch (me->GetEntry())
|
||||
{
|
||||
case NPC_CLUSTER_BLUE:
|
||||
spellId = GetFireworkSpell(NPC_FIREWORK_BLUE);
|
||||
break;
|
||||
case NPC_CLUSTER_GREEN:
|
||||
spellId = GetFireworkSpell(NPC_FIREWORK_GREEN);
|
||||
break;
|
||||
case NPC_CLUSTER_PURPLE:
|
||||
spellId = GetFireworkSpell(NPC_FIREWORK_PURPLE);
|
||||
break;
|
||||
case NPC_CLUSTER_RED:
|
||||
spellId = GetFireworkSpell(NPC_FIREWORK_RED);
|
||||
break;
|
||||
case NPC_CLUSTER_YELLOW:
|
||||
spellId = GetFireworkSpell(NPC_FIREWORK_YELLOW);
|
||||
break;
|
||||
case NPC_CLUSTER_WHITE:
|
||||
spellId = GetFireworkSpell(NPC_FIREWORK_WHITE);
|
||||
break;
|
||||
case NPC_CLUSTER_BIG_BLUE:
|
||||
spellId = GetFireworkSpell(NPC_FIREWORK_BIG_BLUE);
|
||||
break;
|
||||
case NPC_CLUSTER_BIG_GREEN:
|
||||
spellId = GetFireworkSpell(NPC_FIREWORK_BIG_GREEN);
|
||||
break;
|
||||
case NPC_CLUSTER_BIG_PURPLE:
|
||||
spellId = GetFireworkSpell(NPC_FIREWORK_BIG_PURPLE);
|
||||
break;
|
||||
case NPC_CLUSTER_BIG_RED:
|
||||
spellId = GetFireworkSpell(NPC_FIREWORK_BIG_RED);
|
||||
break;
|
||||
case NPC_CLUSTER_BIG_YELLOW:
|
||||
spellId = GetFireworkSpell(NPC_FIREWORK_BIG_YELLOW);
|
||||
break;
|
||||
case NPC_CLUSTER_BIG_WHITE:
|
||||
spellId = GetFireworkSpell(NPC_FIREWORK_BIG_WHITE);
|
||||
break;
|
||||
case NPC_CLUSTER_ELUNE:
|
||||
spellId = GetFireworkSpell(urand(NPC_FIREWORK_BLUE, NPC_FIREWORK_WHITE));
|
||||
break;
|
||||
}
|
||||
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
|
||||
|
||||
if (spellInfo && spellInfo->GetEffect(EFFECT_0).Effect == SPELL_EFFECT_SUMMON_OBJECT_WILD)
|
||||
return spellInfo->GetEffect(EFFECT_0).MiscValue;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Reset() override
|
||||
{
|
||||
if (GameObject* launcher = FindNearestLauncher())
|
||||
{
|
||||
launcher->SendCustomAnim(ANIM_GO_LAUNCH_FIREWORK);
|
||||
me->SetOrientation(launcher->GetOrientation() + float(M_PI) / 2);
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
||||
if (isCluster())
|
||||
{
|
||||
// Check if we are near Elune'ara lake south, if so try to summon Omen or a minion
|
||||
if (me->GetZoneId() == ZONE_MOONGLADE)
|
||||
{
|
||||
if (!me->FindNearestCreature(NPC_OMEN, 100.0f) && me->GetDistance2d(omenSummonPos.GetPositionX(), omenSummonPos.GetPositionY()) <= 100.0f)
|
||||
{
|
||||
switch (urand(0, 9))
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
if (Creature* minion = me->SummonCreature(NPC_MINION_OF_OMEN, me->GetPositionX()+frand(-5.0f, 5.0f), me->GetPositionY()+frand(-5.0f, 5.0f), me->GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 20s))
|
||||
minion->AI()->AttackStart(me->SelectNearestPlayer(20.0f));
|
||||
break;
|
||||
case 9:
|
||||
me->SummonCreature(NPC_OMEN, omenSummonPos);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (me->GetEntry() == NPC_CLUSTER_ELUNE)
|
||||
DoCast(SPELL_LUNAR_FORTUNE);
|
||||
|
||||
float displacement = 0.7f;
|
||||
for (uint8 i = 0; i < 4; i++)
|
||||
me->SummonGameObject(GetFireworkGameObjectId(), me->GetPositionX() + (i % 2 == 0 ? displacement : -displacement), me->GetPositionY() + (i > 1 ? displacement : -displacement), me->GetPositionZ() + 4.0f, me->GetOrientation(), QuaternionData(), 1s);
|
||||
}
|
||||
else
|
||||
//me->CastSpell(me, GetFireworkSpell(me->GetEntry()), true);
|
||||
me->CastSpell(me->GetPosition(), GetFireworkSpell(me->GetEntry()), true);
|
||||
}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
{
|
||||
return new npc_fireworkAI(creature);
|
||||
}
|
||||
};
|
||||
|
||||
/*####
|
||||
# npc_omen
|
||||
@@ -29,8 +311,6 @@
|
||||
|
||||
enum Omen
|
||||
{
|
||||
NPC_OMEN = 15467,
|
||||
|
||||
SPELL_OMEN_CLEAVE = 15284,
|
||||
SPELL_OMEN_STARFALL = 26540,
|
||||
SPELL_OMEN_SUMMON_SPOTLIGHT = 26392,
|
||||
@@ -169,8 +449,69 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
enum EluneCandle
|
||||
{
|
||||
SPELL_ELUNE_CANDLE_OMEN_HEAD = 26622,
|
||||
SPELL_ELUNE_CANDLE_OMEN_CHEST = 26624,
|
||||
SPELL_ELUNE_CANDLE_OMEN_HAND_R = 26625,
|
||||
SPELL_ELUNE_CANDLE_OMEN_HAND_L = 26649,
|
||||
SPELL_ELUNE_CANDLE_NORMAL = 26636
|
||||
};
|
||||
|
||||
class spell_gen_elune_candle : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_gen_elune_candle);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
return ValidateSpellInfo(
|
||||
{
|
||||
SPELL_ELUNE_CANDLE_OMEN_HEAD,
|
||||
SPELL_ELUNE_CANDLE_OMEN_CHEST,
|
||||
SPELL_ELUNE_CANDLE_OMEN_HAND_R,
|
||||
SPELL_ELUNE_CANDLE_OMEN_HAND_L,
|
||||
SPELL_ELUNE_CANDLE_NORMAL
|
||||
});
|
||||
}
|
||||
|
||||
void HandleScript(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
uint32 spellId = 0;
|
||||
|
||||
if (GetHitUnit()->GetEntry() == NPC_OMEN)
|
||||
{
|
||||
switch (urand(0, 3))
|
||||
{
|
||||
case 0:
|
||||
spellId = SPELL_ELUNE_CANDLE_OMEN_HEAD;
|
||||
break;
|
||||
case 1:
|
||||
spellId = SPELL_ELUNE_CANDLE_OMEN_CHEST;
|
||||
break;
|
||||
case 2:
|
||||
spellId = SPELL_ELUNE_CANDLE_OMEN_HAND_R;
|
||||
break;
|
||||
case 3:
|
||||
spellId = SPELL_ELUNE_CANDLE_OMEN_HAND_L;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
spellId = SPELL_ELUNE_CANDLE_NORMAL;
|
||||
|
||||
GetCaster()->CastSpell(GetHitUnit(), spellId, true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_gen_elune_candle::HandleScript, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_event_lunar_festival()
|
||||
{
|
||||
new npc_firework();
|
||||
new npc_omen();
|
||||
new npc_giant_spotlight();
|
||||
RegisterSpellScript(spell_gen_elune_candle);
|
||||
}
|
||||
|
||||
@@ -106,8 +106,69 @@ class spell_winter_veil_px_238_winter_wondervolt : public SpellScript
|
||||
}
|
||||
};
|
||||
|
||||
enum ReindeerTransformation
|
||||
{
|
||||
SPELL_FLYING_REINDEER_310 = 44827,
|
||||
SPELL_FLYING_REINDEER_280 = 44825,
|
||||
SPELL_FLYING_REINDEER_60 = 44824,
|
||||
SPELL_REINDEER_100 = 25859,
|
||||
SPELL_REINDEER_60 = 25858,
|
||||
};
|
||||
|
||||
class spell_item_reindeer_transformation : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_item_reindeer_transformation);
|
||||
|
||||
bool Validate(SpellInfo const* /*spell*/) override
|
||||
{
|
||||
return ValidateSpellInfo(
|
||||
{
|
||||
SPELL_FLYING_REINDEER_310,
|
||||
SPELL_FLYING_REINDEER_280,
|
||||
SPELL_FLYING_REINDEER_60,
|
||||
SPELL_REINDEER_100,
|
||||
SPELL_REINDEER_60
|
||||
});
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /* effIndex */)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
if (caster->HasAuraType(SPELL_AURA_MOUNTED))
|
||||
{
|
||||
float flyspeed = caster->GetSpeedRate(MOVE_FLIGHT);
|
||||
float speed = caster->GetSpeedRate(MOVE_RUN);
|
||||
|
||||
caster->RemoveAurasByType(SPELL_AURA_MOUNTED);
|
||||
//5 different spells used depending on mounted speed and if mount can fly or not
|
||||
|
||||
if (flyspeed >= 4.1f)
|
||||
// Flying Reindeer
|
||||
caster->CastSpell(caster, SPELL_FLYING_REINDEER_310, true); //310% flying Reindeer
|
||||
else if (flyspeed >= 3.8f)
|
||||
// Flying Reindeer
|
||||
caster->CastSpell(caster, SPELL_FLYING_REINDEER_280, true); //280% flying Reindeer
|
||||
else if (flyspeed >= 1.6f)
|
||||
// Flying Reindeer
|
||||
caster->CastSpell(caster, SPELL_FLYING_REINDEER_60, true); //60% flying Reindeer
|
||||
else if (speed >= 2.0f)
|
||||
// Reindeer
|
||||
caster->CastSpell(caster, SPELL_REINDEER_100, true); //100% ground Reindeer
|
||||
else
|
||||
// Reindeer
|
||||
caster->CastSpell(caster, SPELL_REINDEER_60, true); //60% ground Reindeer
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_item_reindeer_transformation::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_event_winter_veil()
|
||||
{
|
||||
RegisterSpellScript(spell_winter_veil_mistletoe);
|
||||
RegisterSpellScript(spell_winter_veil_px_238_winter_wondervolt);
|
||||
RegisterSpellScript(spell_item_reindeer_transformation);
|
||||
}
|
||||
|
||||
@@ -1569,69 +1569,6 @@ class spell_gen_dungeon_credit : public SpellScript
|
||||
bool _handled = false;
|
||||
};
|
||||
|
||||
enum EluneCandle
|
||||
{
|
||||
// Creatures
|
||||
NPC_OMEN = 15467,
|
||||
|
||||
// Spells
|
||||
SPELL_ELUNE_CANDLE_OMEN_HEAD = 26622,
|
||||
SPELL_ELUNE_CANDLE_OMEN_CHEST = 26624,
|
||||
SPELL_ELUNE_CANDLE_OMEN_HAND_R = 26625,
|
||||
SPELL_ELUNE_CANDLE_OMEN_HAND_L = 26649,
|
||||
SPELL_ELUNE_CANDLE_NORMAL = 26636
|
||||
};
|
||||
|
||||
class spell_gen_elune_candle : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_gen_elune_candle);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
return ValidateSpellInfo(
|
||||
{
|
||||
SPELL_ELUNE_CANDLE_OMEN_HEAD,
|
||||
SPELL_ELUNE_CANDLE_OMEN_CHEST,
|
||||
SPELL_ELUNE_CANDLE_OMEN_HAND_R,
|
||||
SPELL_ELUNE_CANDLE_OMEN_HAND_L,
|
||||
SPELL_ELUNE_CANDLE_NORMAL
|
||||
});
|
||||
}
|
||||
|
||||
void HandleScript(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
uint32 spellId = 0;
|
||||
|
||||
if (GetHitUnit()->GetEntry() == NPC_OMEN)
|
||||
{
|
||||
switch (urand(0, 3))
|
||||
{
|
||||
case 0:
|
||||
spellId = SPELL_ELUNE_CANDLE_OMEN_HEAD;
|
||||
break;
|
||||
case 1:
|
||||
spellId = SPELL_ELUNE_CANDLE_OMEN_CHEST;
|
||||
break;
|
||||
case 2:
|
||||
spellId = SPELL_ELUNE_CANDLE_OMEN_HAND_R;
|
||||
break;
|
||||
case 3:
|
||||
spellId = SPELL_ELUNE_CANDLE_OMEN_HAND_L;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
spellId = SPELL_ELUNE_CANDLE_NORMAL;
|
||||
|
||||
GetCaster()->CastSpell(GetHitUnit(), spellId, true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_gen_elune_candle::HandleScript, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
// 50051 - Ethereal Pet Aura
|
||||
enum EtherealPet
|
||||
{
|
||||
@@ -4597,7 +4534,6 @@ void AddSC_generic_spell_scripts()
|
||||
RegisterSpellScript(spell_gen_divine_storm_cd_reset);
|
||||
RegisterSpellScript(spell_gen_ds_flush_knockback);
|
||||
RegisterSpellScript(spell_gen_dungeon_credit);
|
||||
RegisterSpellScript(spell_gen_elune_candle);
|
||||
RegisterSpellScript(spell_ethereal_pet_aura);
|
||||
RegisterSpellScript(spell_ethereal_pet_onsummon);
|
||||
RegisterSpellScript(spell_ethereal_pet_aura_remove);
|
||||
|
||||
@@ -2438,47 +2438,6 @@ class spell_item_red_rider_air_rifle : public SpellScript
|
||||
}
|
||||
};
|
||||
|
||||
enum CreateHeartCandy
|
||||
{
|
||||
SPELL_CREATE_HEART_CANDY_1 = 26668,
|
||||
SPELL_CREATE_HEART_CANDY_2 = 26670,
|
||||
SPELL_CREATE_HEART_CANDY_3 = 26671,
|
||||
SPELL_CREATE_HEART_CANDY_4 = 26672,
|
||||
SPELL_CREATE_HEART_CANDY_5 = 26673,
|
||||
SPELL_CREATE_HEART_CANDY_6 = 26674,
|
||||
SPELL_CREATE_HEART_CANDY_7 = 26675,
|
||||
SPELL_CREATE_HEART_CANDY_8 = 26676
|
||||
};
|
||||
|
||||
std::array<uint32, 8> const CreateHeartCandySpells =
|
||||
{
|
||||
SPELL_CREATE_HEART_CANDY_1, SPELL_CREATE_HEART_CANDY_2, SPELL_CREATE_HEART_CANDY_3, SPELL_CREATE_HEART_CANDY_4,
|
||||
SPELL_CREATE_HEART_CANDY_5, SPELL_CREATE_HEART_CANDY_6, SPELL_CREATE_HEART_CANDY_7, SPELL_CREATE_HEART_CANDY_8
|
||||
};
|
||||
|
||||
// 26678 - Create Heart Candy
|
||||
class spell_item_create_heart_candy : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_item_create_heart_candy);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
return ValidateSpellInfo(CreateHeartCandySpells);
|
||||
}
|
||||
|
||||
void HandleScript(SpellEffIndex effIndex)
|
||||
{
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
if (Player* target = GetHitPlayer())
|
||||
target->CastSpell(target, Trinity::Containers::SelectRandomContainerElement(CreateHeartCandySpells), true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_item_create_heart_candy::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
class spell_item_book_of_glyph_mastery : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_item_book_of_glyph_mastery);
|
||||
@@ -2784,66 +2743,6 @@ class spell_item_crystal_prison_dummy_dnd : public SpellScript
|
||||
}
|
||||
};
|
||||
|
||||
enum ReindeerTransformation
|
||||
{
|
||||
SPELL_FLYING_REINDEER_310 = 44827,
|
||||
SPELL_FLYING_REINDEER_280 = 44825,
|
||||
SPELL_FLYING_REINDEER_60 = 44824,
|
||||
SPELL_REINDEER_100 = 25859,
|
||||
SPELL_REINDEER_60 = 25858,
|
||||
};
|
||||
|
||||
class spell_item_reindeer_transformation : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_item_reindeer_transformation);
|
||||
|
||||
bool Validate(SpellInfo const* /*spell*/) override
|
||||
{
|
||||
return ValidateSpellInfo(
|
||||
{
|
||||
SPELL_FLYING_REINDEER_310,
|
||||
SPELL_FLYING_REINDEER_280,
|
||||
SPELL_FLYING_REINDEER_60,
|
||||
SPELL_REINDEER_100,
|
||||
SPELL_REINDEER_60
|
||||
});
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /* effIndex */)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
if (caster->HasAuraType(SPELL_AURA_MOUNTED))
|
||||
{
|
||||
float flyspeed = caster->GetSpeedRate(MOVE_FLIGHT);
|
||||
float speed = caster->GetSpeedRate(MOVE_RUN);
|
||||
|
||||
caster->RemoveAurasByType(SPELL_AURA_MOUNTED);
|
||||
//5 different spells used depending on mounted speed and if mount can fly or not
|
||||
|
||||
if (flyspeed >= 4.1f)
|
||||
// Flying Reindeer
|
||||
caster->CastSpell(caster, SPELL_FLYING_REINDEER_310, true); //310% flying Reindeer
|
||||
else if (flyspeed >= 3.8f)
|
||||
// Flying Reindeer
|
||||
caster->CastSpell(caster, SPELL_FLYING_REINDEER_280, true); //280% flying Reindeer
|
||||
else if (flyspeed >= 1.6f)
|
||||
// Flying Reindeer
|
||||
caster->CastSpell(caster, SPELL_FLYING_REINDEER_60, true); //60% flying Reindeer
|
||||
else if (speed >= 2.0f)
|
||||
// Reindeer
|
||||
caster->CastSpell(caster, SPELL_REINDEER_100, true); //100% ground Reindeer
|
||||
else
|
||||
// Reindeer
|
||||
caster->CastSpell(caster, SPELL_REINDEER_60, true); //60% ground Reindeer
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_item_reindeer_transformation::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
enum NighInvulnerability
|
||||
{
|
||||
SPELL_NIGH_INVULNERABILITY = 30456,
|
||||
@@ -3058,66 +2957,6 @@ class spell_item_impale_leviroth : public SpellScript
|
||||
}
|
||||
};
|
||||
|
||||
enum BrewfestMountTransformation
|
||||
{
|
||||
SPELL_MOUNT_RAM_100 = 43900,
|
||||
SPELL_MOUNT_RAM_60 = 43899,
|
||||
SPELL_MOUNT_KODO_100 = 49379,
|
||||
SPELL_MOUNT_KODO_60 = 49378,
|
||||
SPELL_BREWFEST_MOUNT_TRANSFORM = 49357,
|
||||
SPELL_BREWFEST_MOUNT_TRANSFORM_REVERSE = 52845,
|
||||
};
|
||||
|
||||
class spell_item_brewfest_mount_transformation : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_item_brewfest_mount_transformation);
|
||||
|
||||
bool Validate(SpellInfo const* /*spell*/) override
|
||||
{
|
||||
return ValidateSpellInfo(
|
||||
{
|
||||
SPELL_MOUNT_RAM_100,
|
||||
SPELL_MOUNT_RAM_60,
|
||||
SPELL_MOUNT_KODO_100,
|
||||
SPELL_MOUNT_KODO_60
|
||||
});
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /* effIndex */)
|
||||
{
|
||||
Player* caster = GetCaster()->ToPlayer();
|
||||
if (caster->HasAuraType(SPELL_AURA_MOUNTED))
|
||||
{
|
||||
caster->RemoveAurasByType(SPELL_AURA_MOUNTED);
|
||||
uint32 spell_id;
|
||||
|
||||
switch (GetSpellInfo()->Id)
|
||||
{
|
||||
case SPELL_BREWFEST_MOUNT_TRANSFORM:
|
||||
if (caster->GetSpeedRate(MOVE_RUN) >= 2.0f)
|
||||
spell_id = caster->GetTeam() == ALLIANCE ? SPELL_MOUNT_RAM_100 : SPELL_MOUNT_KODO_100;
|
||||
else
|
||||
spell_id = caster->GetTeam() == ALLIANCE ? SPELL_MOUNT_RAM_60 : SPELL_MOUNT_KODO_60;
|
||||
break;
|
||||
case SPELL_BREWFEST_MOUNT_TRANSFORM_REVERSE:
|
||||
if (caster->GetSpeedRate(MOVE_RUN) >= 2.0f)
|
||||
spell_id = caster->GetTeam() == HORDE ? SPELL_MOUNT_RAM_100 : SPELL_MOUNT_KODO_100;
|
||||
else
|
||||
spell_id = caster->GetTeam() == HORDE ? SPELL_MOUNT_RAM_60 : SPELL_MOUNT_KODO_60;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
caster->CastSpell(caster, spell_id, true);
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_item_brewfest_mount_transformation::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
enum NitroBoosts
|
||||
{
|
||||
SPELL_NITRO_BOOSTS_SUCCESS = 54861,
|
||||
@@ -4422,7 +4261,6 @@ void AddSC_item_spell_scripts()
|
||||
RegisterSpellScript(spell_item_worn_troll_dice);
|
||||
RegisterSpellScript(spell_item_red_rider_air_rifle);
|
||||
|
||||
RegisterSpellScript(spell_item_create_heart_candy);
|
||||
RegisterSpellScript(spell_item_book_of_glyph_mastery);
|
||||
RegisterSpellScript(spell_item_gift_of_the_harvester);
|
||||
RegisterSpellScript(spell_item_map_of_the_geyser_fields);
|
||||
@@ -4433,14 +4271,12 @@ void AddSC_item_spell_scripts()
|
||||
RegisterSpellScript(spell_item_shimmering_vessel);
|
||||
RegisterSpellScript(spell_item_purify_helboar_meat);
|
||||
RegisterSpellScript(spell_item_crystal_prison_dummy_dnd);
|
||||
RegisterSpellScript(spell_item_reindeer_transformation);
|
||||
RegisterSpellScript(spell_item_nigh_invulnerability);
|
||||
RegisterSpellScript(spell_item_poultryizer);
|
||||
RegisterSpellScript(spell_item_socrethars_stone);
|
||||
RegisterSpellScript(spell_item_demon_broiled_surprise);
|
||||
RegisterSpellScript(spell_item_complete_raptor_capture);
|
||||
RegisterSpellScript(spell_item_impale_leviroth);
|
||||
RegisterSpellScript(spell_item_brewfest_mount_transformation);
|
||||
RegisterSpellScript(spell_item_nitro_boosts);
|
||||
RegisterSpellScript(spell_item_nitro_boosts_backfire);
|
||||
RegisterSpellScript(spell_item_teach_language);
|
||||
|
||||
@@ -1799,285 +1799,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
enum Fireworks
|
||||
{
|
||||
NPC_OMEN = 15467,
|
||||
NPC_MINION_OF_OMEN = 15466,
|
||||
NPC_FIREWORK_BLUE = 15879,
|
||||
NPC_FIREWORK_GREEN = 15880,
|
||||
NPC_FIREWORK_PURPLE = 15881,
|
||||
NPC_FIREWORK_RED = 15882,
|
||||
NPC_FIREWORK_YELLOW = 15883,
|
||||
NPC_FIREWORK_WHITE = 15884,
|
||||
NPC_FIREWORK_BIG_BLUE = 15885,
|
||||
NPC_FIREWORK_BIG_GREEN = 15886,
|
||||
NPC_FIREWORK_BIG_PURPLE = 15887,
|
||||
NPC_FIREWORK_BIG_RED = 15888,
|
||||
NPC_FIREWORK_BIG_YELLOW = 15889,
|
||||
NPC_FIREWORK_BIG_WHITE = 15890,
|
||||
|
||||
NPC_CLUSTER_BLUE = 15872,
|
||||
NPC_CLUSTER_RED = 15873,
|
||||
NPC_CLUSTER_GREEN = 15874,
|
||||
NPC_CLUSTER_PURPLE = 15875,
|
||||
NPC_CLUSTER_WHITE = 15876,
|
||||
NPC_CLUSTER_YELLOW = 15877,
|
||||
NPC_CLUSTER_BIG_BLUE = 15911,
|
||||
NPC_CLUSTER_BIG_GREEN = 15912,
|
||||
NPC_CLUSTER_BIG_PURPLE = 15913,
|
||||
NPC_CLUSTER_BIG_RED = 15914,
|
||||
NPC_CLUSTER_BIG_WHITE = 15915,
|
||||
NPC_CLUSTER_BIG_YELLOW = 15916,
|
||||
NPC_CLUSTER_ELUNE = 15918,
|
||||
|
||||
GO_FIREWORK_LAUNCHER_1 = 180771,
|
||||
GO_FIREWORK_LAUNCHER_2 = 180868,
|
||||
GO_FIREWORK_LAUNCHER_3 = 180850,
|
||||
GO_CLUSTER_LAUNCHER_1 = 180772,
|
||||
GO_CLUSTER_LAUNCHER_2 = 180859,
|
||||
GO_CLUSTER_LAUNCHER_3 = 180869,
|
||||
GO_CLUSTER_LAUNCHER_4 = 180874,
|
||||
|
||||
SPELL_ROCKET_BLUE = 26344,
|
||||
SPELL_ROCKET_GREEN = 26345,
|
||||
SPELL_ROCKET_PURPLE = 26346,
|
||||
SPELL_ROCKET_RED = 26347,
|
||||
SPELL_ROCKET_WHITE = 26348,
|
||||
SPELL_ROCKET_YELLOW = 26349,
|
||||
SPELL_ROCKET_BIG_BLUE = 26351,
|
||||
SPELL_ROCKET_BIG_GREEN = 26352,
|
||||
SPELL_ROCKET_BIG_PURPLE = 26353,
|
||||
SPELL_ROCKET_BIG_RED = 26354,
|
||||
SPELL_ROCKET_BIG_WHITE = 26355,
|
||||
SPELL_ROCKET_BIG_YELLOW = 26356,
|
||||
SPELL_LUNAR_FORTUNE = 26522,
|
||||
|
||||
ANIM_GO_LAUNCH_FIREWORK = 3,
|
||||
ZONE_MOONGLADE = 493,
|
||||
};
|
||||
|
||||
Position omenSummonPos = {7558.993f, -2839.999f, 450.0214f, 4.46f};
|
||||
|
||||
class npc_firework : public CreatureScript
|
||||
{
|
||||
public:
|
||||
npc_firework() : CreatureScript("npc_firework") { }
|
||||
|
||||
struct npc_fireworkAI : public ScriptedAI
|
||||
{
|
||||
npc_fireworkAI(Creature* creature) : ScriptedAI(creature) { }
|
||||
|
||||
bool isCluster()
|
||||
{
|
||||
switch (me->GetEntry())
|
||||
{
|
||||
case NPC_FIREWORK_BLUE:
|
||||
case NPC_FIREWORK_GREEN:
|
||||
case NPC_FIREWORK_PURPLE:
|
||||
case NPC_FIREWORK_RED:
|
||||
case NPC_FIREWORK_YELLOW:
|
||||
case NPC_FIREWORK_WHITE:
|
||||
case NPC_FIREWORK_BIG_BLUE:
|
||||
case NPC_FIREWORK_BIG_GREEN:
|
||||
case NPC_FIREWORK_BIG_PURPLE:
|
||||
case NPC_FIREWORK_BIG_RED:
|
||||
case NPC_FIREWORK_BIG_YELLOW:
|
||||
case NPC_FIREWORK_BIG_WHITE:
|
||||
return false;
|
||||
case NPC_CLUSTER_BLUE:
|
||||
case NPC_CLUSTER_GREEN:
|
||||
case NPC_CLUSTER_PURPLE:
|
||||
case NPC_CLUSTER_RED:
|
||||
case NPC_CLUSTER_YELLOW:
|
||||
case NPC_CLUSTER_WHITE:
|
||||
case NPC_CLUSTER_BIG_BLUE:
|
||||
case NPC_CLUSTER_BIG_GREEN:
|
||||
case NPC_CLUSTER_BIG_PURPLE:
|
||||
case NPC_CLUSTER_BIG_RED:
|
||||
case NPC_CLUSTER_BIG_YELLOW:
|
||||
case NPC_CLUSTER_BIG_WHITE:
|
||||
case NPC_CLUSTER_ELUNE:
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
GameObject* FindNearestLauncher()
|
||||
{
|
||||
GameObject* launcher = nullptr;
|
||||
|
||||
if (isCluster())
|
||||
{
|
||||
GameObject* launcher1 = GetClosestGameObjectWithEntry(me, GO_CLUSTER_LAUNCHER_1, 0.5f);
|
||||
GameObject* launcher2 = GetClosestGameObjectWithEntry(me, GO_CLUSTER_LAUNCHER_2, 0.5f);
|
||||
GameObject* launcher3 = GetClosestGameObjectWithEntry(me, GO_CLUSTER_LAUNCHER_3, 0.5f);
|
||||
GameObject* launcher4 = GetClosestGameObjectWithEntry(me, GO_CLUSTER_LAUNCHER_4, 0.5f);
|
||||
|
||||
if (launcher1)
|
||||
launcher = launcher1;
|
||||
else if (launcher2)
|
||||
launcher = launcher2;
|
||||
else if (launcher3)
|
||||
launcher = launcher3;
|
||||
else if (launcher4)
|
||||
launcher = launcher4;
|
||||
}
|
||||
else
|
||||
{
|
||||
GameObject* launcher1 = GetClosestGameObjectWithEntry(me, GO_FIREWORK_LAUNCHER_1, 0.5f);
|
||||
GameObject* launcher2 = GetClosestGameObjectWithEntry(me, GO_FIREWORK_LAUNCHER_2, 0.5f);
|
||||
GameObject* launcher3 = GetClosestGameObjectWithEntry(me, GO_FIREWORK_LAUNCHER_3, 0.5f);
|
||||
|
||||
if (launcher1)
|
||||
launcher = launcher1;
|
||||
else if (launcher2)
|
||||
launcher = launcher2;
|
||||
else if (launcher3)
|
||||
launcher = launcher3;
|
||||
}
|
||||
|
||||
return launcher;
|
||||
}
|
||||
|
||||
uint32 GetFireworkSpell(uint32 entry)
|
||||
{
|
||||
switch (entry)
|
||||
{
|
||||
case NPC_FIREWORK_BLUE:
|
||||
return SPELL_ROCKET_BLUE;
|
||||
case NPC_FIREWORK_GREEN:
|
||||
return SPELL_ROCKET_GREEN;
|
||||
case NPC_FIREWORK_PURPLE:
|
||||
return SPELL_ROCKET_PURPLE;
|
||||
case NPC_FIREWORK_RED:
|
||||
return SPELL_ROCKET_RED;
|
||||
case NPC_FIREWORK_YELLOW:
|
||||
return SPELL_ROCKET_YELLOW;
|
||||
case NPC_FIREWORK_WHITE:
|
||||
return SPELL_ROCKET_WHITE;
|
||||
case NPC_FIREWORK_BIG_BLUE:
|
||||
return SPELL_ROCKET_BIG_BLUE;
|
||||
case NPC_FIREWORK_BIG_GREEN:
|
||||
return SPELL_ROCKET_BIG_GREEN;
|
||||
case NPC_FIREWORK_BIG_PURPLE:
|
||||
return SPELL_ROCKET_BIG_PURPLE;
|
||||
case NPC_FIREWORK_BIG_RED:
|
||||
return SPELL_ROCKET_BIG_RED;
|
||||
case NPC_FIREWORK_BIG_YELLOW:
|
||||
return SPELL_ROCKET_BIG_YELLOW;
|
||||
case NPC_FIREWORK_BIG_WHITE:
|
||||
return SPELL_ROCKET_BIG_WHITE;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
uint32 GetFireworkGameObjectId()
|
||||
{
|
||||
uint32 spellId = 0;
|
||||
|
||||
switch (me->GetEntry())
|
||||
{
|
||||
case NPC_CLUSTER_BLUE:
|
||||
spellId = GetFireworkSpell(NPC_FIREWORK_BLUE);
|
||||
break;
|
||||
case NPC_CLUSTER_GREEN:
|
||||
spellId = GetFireworkSpell(NPC_FIREWORK_GREEN);
|
||||
break;
|
||||
case NPC_CLUSTER_PURPLE:
|
||||
spellId = GetFireworkSpell(NPC_FIREWORK_PURPLE);
|
||||
break;
|
||||
case NPC_CLUSTER_RED:
|
||||
spellId = GetFireworkSpell(NPC_FIREWORK_RED);
|
||||
break;
|
||||
case NPC_CLUSTER_YELLOW:
|
||||
spellId = GetFireworkSpell(NPC_FIREWORK_YELLOW);
|
||||
break;
|
||||
case NPC_CLUSTER_WHITE:
|
||||
spellId = GetFireworkSpell(NPC_FIREWORK_WHITE);
|
||||
break;
|
||||
case NPC_CLUSTER_BIG_BLUE:
|
||||
spellId = GetFireworkSpell(NPC_FIREWORK_BIG_BLUE);
|
||||
break;
|
||||
case NPC_CLUSTER_BIG_GREEN:
|
||||
spellId = GetFireworkSpell(NPC_FIREWORK_BIG_GREEN);
|
||||
break;
|
||||
case NPC_CLUSTER_BIG_PURPLE:
|
||||
spellId = GetFireworkSpell(NPC_FIREWORK_BIG_PURPLE);
|
||||
break;
|
||||
case NPC_CLUSTER_BIG_RED:
|
||||
spellId = GetFireworkSpell(NPC_FIREWORK_BIG_RED);
|
||||
break;
|
||||
case NPC_CLUSTER_BIG_YELLOW:
|
||||
spellId = GetFireworkSpell(NPC_FIREWORK_BIG_YELLOW);
|
||||
break;
|
||||
case NPC_CLUSTER_BIG_WHITE:
|
||||
spellId = GetFireworkSpell(NPC_FIREWORK_BIG_WHITE);
|
||||
break;
|
||||
case NPC_CLUSTER_ELUNE:
|
||||
spellId = GetFireworkSpell(urand(NPC_FIREWORK_BLUE, NPC_FIREWORK_WHITE));
|
||||
break;
|
||||
}
|
||||
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
|
||||
|
||||
if (spellInfo && spellInfo->GetEffect(EFFECT_0).Effect == SPELL_EFFECT_SUMMON_OBJECT_WILD)
|
||||
return spellInfo->GetEffect(EFFECT_0).MiscValue;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Reset() override
|
||||
{
|
||||
if (GameObject* launcher = FindNearestLauncher())
|
||||
{
|
||||
launcher->SendCustomAnim(ANIM_GO_LAUNCH_FIREWORK);
|
||||
me->SetOrientation(launcher->GetOrientation() + float(M_PI) / 2);
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
||||
if (isCluster())
|
||||
{
|
||||
// Check if we are near Elune'ara lake south, if so try to summon Omen or a minion
|
||||
if (me->GetZoneId() == ZONE_MOONGLADE)
|
||||
{
|
||||
if (!me->FindNearestCreature(NPC_OMEN, 100.0f) && me->GetDistance2d(omenSummonPos.GetPositionX(), omenSummonPos.GetPositionY()) <= 100.0f)
|
||||
{
|
||||
switch (urand(0, 9))
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
if (Creature* minion = me->SummonCreature(NPC_MINION_OF_OMEN, me->GetPositionX()+frand(-5.0f, 5.0f), me->GetPositionY()+frand(-5.0f, 5.0f), me->GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 20s))
|
||||
minion->AI()->AttackStart(me->SelectNearestPlayer(20.0f));
|
||||
break;
|
||||
case 9:
|
||||
me->SummonCreature(NPC_OMEN, omenSummonPos);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (me->GetEntry() == NPC_CLUSTER_ELUNE)
|
||||
DoCast(SPELL_LUNAR_FORTUNE);
|
||||
|
||||
float displacement = 0.7f;
|
||||
for (uint8 i = 0; i < 4; i++)
|
||||
me->SummonGameObject(GetFireworkGameObjectId(), me->GetPositionX() + (i % 2 == 0 ? displacement : -displacement), me->GetPositionY() + (i > 1 ? displacement : -displacement), me->GetPositionZ() + 4.0f, me->GetOrientation(), QuaternionData(), 1s);
|
||||
}
|
||||
else
|
||||
//me->CastSpell(me, GetFireworkSpell(me->GetEntry()), true);
|
||||
me->CastSpell(me->GetPosition(), GetFireworkSpell(me->GetEntry()), true);
|
||||
}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
{
|
||||
return new npc_fireworkAI(creature);
|
||||
}
|
||||
};
|
||||
|
||||
/*#####
|
||||
# npc_spring_rabbit
|
||||
#####*/
|
||||
@@ -2744,7 +2465,6 @@ void AddSC_npcs_special()
|
||||
new npc_wormhole();
|
||||
new npc_pet_trainer();
|
||||
new npc_experience();
|
||||
new npc_firework();
|
||||
new npc_spring_rabbit();
|
||||
new npc_imp_in_a_ball();
|
||||
new npc_stable_master();
|
||||
|
||||
Reference in New Issue
Block a user