mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-16 02:20:27 +00:00
Big re-organization of repository [W.I.P]
This commit is contained in:
@@ -1,14 +0,0 @@
|
||||
set(scripts_STAT_SRCS
|
||||
${scripts_STAT_SRCS}
|
||||
Events/brewfest.cpp
|
||||
Events/childrens_week.cpp
|
||||
Events/hallows_end.cpp
|
||||
Events/pilgrims_bounty.cpp
|
||||
Events/winter_veil.cpp
|
||||
Events/love_in_air.cpp
|
||||
Events/midsummer.cpp
|
||||
)
|
||||
|
||||
AC_ADD_SCRIPT_LOADER("Event" "ScriptLoader.h")
|
||||
|
||||
message(" -> Prepared: Events")
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,777 +0,0 @@
|
||||
// Scripted by Xinef
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "GridNotifiers.h"
|
||||
#include "GridNotifiersImpl.h"
|
||||
#include "Cell.h"
|
||||
#include "CellImpl.h"
|
||||
#include "SpellScript.h"
|
||||
#include "LFGMgr.h"
|
||||
#include "Group.h"
|
||||
|
||||
///////////////////////////////////////
|
||||
////// GOS
|
||||
///////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////
|
||||
////// NPCS
|
||||
///////////////////////////////////////
|
||||
|
||||
enum Spells
|
||||
{
|
||||
SPELL_GOBLIN_DISGUISE = 71450,
|
||||
SPELL_GOBLIN_ALLY_COMPLETE = 71522,
|
||||
SPELL_GOBLIN_HORDE_COMPLETE = 71539,
|
||||
SPELL_GOBLIN_CARRY_CRATE = 71459,
|
||||
|
||||
NPC_SOMETHING_STINKS_CREDIT = 37558,
|
||||
};
|
||||
|
||||
class npc_love_in_air_supply_sentry : public CreatureScript
|
||||
{
|
||||
public:
|
||||
npc_love_in_air_supply_sentry() : CreatureScript("npc_love_in_air_supply_sentry") { }
|
||||
|
||||
struct npc_love_in_air_supply_sentryAI : public ScriptedAI
|
||||
{
|
||||
npc_love_in_air_supply_sentryAI(Creature* creature) : ScriptedAI(creature), lock(0)
|
||||
{
|
||||
}
|
||||
|
||||
uint32 lock;
|
||||
|
||||
void MoveInLineOfSight(Unit* who)
|
||||
{
|
||||
if (lock > 1000 && me->GetDistance(who) < 10.0f && who->GetTypeId() == TYPEID_PLAYER && who->HasAura(SPELL_GOBLIN_DISGUISE) && !who->HasAura(SPELL_GOBLIN_CARRY_CRATE))
|
||||
{
|
||||
lock = 0;
|
||||
if (urand(0,1))
|
||||
me->MonsterSay("Time is money, friend. Go go go!", LANG_UNIVERSAL, who->ToPlayer());
|
||||
else
|
||||
me->MonsterSay("That crate won't deliver itself, friend. Get a move on!", LANG_UNIVERSAL, who->ToPlayer());
|
||||
|
||||
if (who->ToPlayer()->GetTeamId() == TEAM_ALLIANCE)
|
||||
who->CastSpell(who, SPELL_GOBLIN_ALLY_COMPLETE, true);
|
||||
else
|
||||
who->CastSpell(who, SPELL_GOBLIN_HORDE_COMPLETE, true);
|
||||
|
||||
me->CastSpell(who, SPELL_GOBLIN_CARRY_CRATE, true);
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff)
|
||||
{
|
||||
lock += diff;
|
||||
}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const
|
||||
{
|
||||
return new npc_love_in_air_supply_sentryAI(creature);
|
||||
}
|
||||
};
|
||||
|
||||
enum hotOnTrail
|
||||
{
|
||||
QUEST_HOT_ON_TRAIL_ALLY = 24849,
|
||||
QUEST_HOT_ON_TRAIL_HORDE = 24851,
|
||||
|
||||
NPC_SNIVEL_ALLY = 38334,
|
||||
NPC_SNIVEL_COUNTER = 38340,
|
||||
|
||||
NPC_SNIVEL_HORDE = 38337,
|
||||
|
||||
SPELL_SNIVEL_GUN = 71715,
|
||||
};
|
||||
|
||||
const uint32 spellTable[6] = {71713, 71745, 71752, 71759, 71760, 71758};
|
||||
|
||||
class npc_love_in_air_snivel : public CreatureScript
|
||||
{
|
||||
public:
|
||||
npc_love_in_air_snivel() : CreatureScript("npc_love_in_air_snivel") { }
|
||||
|
||||
struct npc_love_in_air_snivelAI : public NullCreatureAI
|
||||
{
|
||||
npc_love_in_air_snivelAI(Creature* creature) : NullCreatureAI(creature)
|
||||
{
|
||||
}
|
||||
|
||||
int32 delay;
|
||||
|
||||
void Reset()
|
||||
{
|
||||
delay = 0;
|
||||
me->SetReactState(REACT_AGGRESSIVE);
|
||||
}
|
||||
|
||||
bool AllowAction(Player* player)
|
||||
{
|
||||
uint16 slot = player->FindQuestSlot(player->GetTeamId() == TEAM_ALLIANCE ? QUEST_HOT_ON_TRAIL_ALLY : QUEST_HOT_ON_TRAIL_HORDE);
|
||||
if (slot >= MAX_QUEST_LOG_SIZE)
|
||||
return false;
|
||||
|
||||
QuestStatusData& qData = player->getQuestStatusMap()[(player->GetTeamId() == TEAM_ALLIANCE ? QUEST_HOT_ON_TRAIL_ALLY : QUEST_HOT_ON_TRAIL_HORDE)];
|
||||
if (qData.CreatureOrGOCount[me->GetEntry() - NPC_SNIVEL_COUNTER] == 0)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void MoveInLineOfSight(Unit* who)
|
||||
{
|
||||
if (delay == 0 && me->GetDistance(who) < 7.0f && who->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
Player* plr = who->ToPlayer();
|
||||
if (AllowAction(plr))
|
||||
{
|
||||
delay = 25000;
|
||||
uint8 index = plr->GetTeamId()*3 + (me->GetEntry() - NPC_SNIVEL_COUNTER);
|
||||
plr->CastSpell(plr, spellTable[index], true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff)
|
||||
{
|
||||
if (delay > 0)
|
||||
delay -= std::min<int32>(delay, diff);
|
||||
}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const
|
||||
{
|
||||
return new npc_love_in_air_snivelAI(creature);
|
||||
}
|
||||
};
|
||||
|
||||
class npc_love_in_air_snivel_real : public CreatureScript
|
||||
{
|
||||
public:
|
||||
npc_love_in_air_snivel_real() : CreatureScript("npc_love_in_air_snivel_real") { }
|
||||
|
||||
struct npc_love_in_air_snivel_realAI : public ScriptedAI
|
||||
{
|
||||
npc_love_in_air_snivel_realAI(Creature* creature) : ScriptedAI(creature)
|
||||
{
|
||||
actionTimer = 7000;
|
||||
actionCounter = 0;
|
||||
}
|
||||
|
||||
uint32 actionTimer;
|
||||
uint32 actionCounter;
|
||||
|
||||
bool Talk(uint32 time)
|
||||
{
|
||||
switch (me->GetEntry())
|
||||
{
|
||||
case NPC_SNIVEL_ALLY:
|
||||
case NPC_SNIVEL_HORDE:
|
||||
{
|
||||
switch (time)
|
||||
{
|
||||
case 1: me->MonsterSay("What are you staring at? Haven't you ever seen a genius before?", LANG_UNIVERSAL, 0); return false;
|
||||
case 2: me->MonsterSay("This'll teach you to mind your own business!", LANG_UNIVERSAL, 0); return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NPC_SNIVEL_ALLY+1:
|
||||
case NPC_SNIVEL_HORDE+1:
|
||||
{
|
||||
switch (time)
|
||||
{
|
||||
case 1: me->MonsterSay("That's right. I'd like to list some of these 'fireworks'.", LANG_UNIVERSAL, 0); return false;
|
||||
case 2: me->MonsterSay("Those'll net me a nice profit when I return from the South Seas.", LANG_UNIVERSAL, 0); return false;
|
||||
case 3: me->MonsterSay("You... Don't think I don't see you. Leave me alone!", LANG_UNIVERSAL, 0); return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case NPC_SNIVEL_ALLY+2:
|
||||
case NPC_SNIVEL_HORDE+2:
|
||||
{
|
||||
switch (time)
|
||||
{
|
||||
case 1: me->MonsterSay("Thanks for the great cut and shave, buddy.", LANG_UNIVERSAL, 0); return false;
|
||||
case 2: me->MonsterSay("Here's a little something extra since I'll be away.", LANG_UNIVERSAL, 0); return false;
|
||||
case 3: me->MonsterSay("On second thought, keep the whole bag. I have to, uh, get going.", LANG_UNIVERSAL, 0); return false;
|
||||
case 4: me->MonsterSay("Did you really think you could corner me this easily?", LANG_UNIVERSAL, 0); return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff)
|
||||
{
|
||||
actionTimer += diff;
|
||||
if (actionTimer >= 7000)
|
||||
{
|
||||
actionTimer = 0;
|
||||
actionCounter++;
|
||||
if (Talk(actionCounter))
|
||||
{
|
||||
if (me->ToTempSummon())
|
||||
if (Unit* owner = me->ToTempSummon()->GetSummoner())
|
||||
me->CastSpell(owner, SPELL_SNIVEL_GUN, true);
|
||||
|
||||
me->DespawnOrUnsummon(1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const
|
||||
{
|
||||
return new npc_love_in_air_snivel_realAI(creature);
|
||||
}
|
||||
};
|
||||
|
||||
///////////////////////////////////////
|
||||
////// BOSS
|
||||
///////////////////////////////////////
|
||||
|
||||
enum hummel
|
||||
{
|
||||
QUEST_YOUVE_BEEN_SERVED = 14488,
|
||||
NPC_APOTHECARY_HUMMEL = 36296,
|
||||
NPC_APOTHECARY_FRYE = 36272,
|
||||
NPC_APOTHECARY_BAXTER = 36565,
|
||||
|
||||
SPELL_COLOGNE_IMMUNE = 68530,
|
||||
SPELL_COLOGNE_PASSIVE_DAMAGE = 68947,
|
||||
SPELL_PERFUME_PASSIVE_DAMAGE = 68641,
|
||||
|
||||
SPELL_THROW_COLOGNE = 68614,
|
||||
SPELL_THROW_PERFUME = 68798,
|
||||
|
||||
// Real fight
|
||||
SPELL_COLOGNE_SPRAY = 68948,
|
||||
SPELL_ALLURING_PERFUME_SPRAY = 68607,
|
||||
SPELL_CHAIN_REACTION = 68821,
|
||||
|
||||
ACTION_START_EVENT = 1,
|
||||
ACTION_RELEASE_HELPER = 2,
|
||||
|
||||
EVENT_CALL_BAXTER = 1,
|
||||
EVENT_CALL_FRYE = 2,
|
||||
EVENT_SPELL_PERFUME_SPRAY = 3,
|
||||
EVENT_SPELL_CHAIN_REACTION = 4,
|
||||
EVENT_SPELL_THROW = 5,
|
||||
};
|
||||
|
||||
class npc_love_in_air_hummel : public CreatureScript
|
||||
{
|
||||
public:
|
||||
npc_love_in_air_hummel() : CreatureScript("npc_love_in_air_hummel") { }
|
||||
|
||||
struct npc_love_in_air_hummelAI : public ScriptedAI
|
||||
{
|
||||
npc_love_in_air_hummelAI(Creature* creature) : ScriptedAI(creature), summons(me)
|
||||
{
|
||||
}
|
||||
|
||||
SummonList summons;
|
||||
EventMap events;
|
||||
uint32 speachTimer;
|
||||
|
||||
void Reset()
|
||||
{
|
||||
speachTimer = 0;
|
||||
me->setFaction(35);
|
||||
summons.DespawnAll();
|
||||
events.Reset();
|
||||
me->SummonCreature(NPC_APOTHECARY_FRYE, -205.449f, 2219.56f, 79.7633f, 0.7f);
|
||||
me->SummonCreature(NPC_APOTHECARY_BAXTER, -209.602f, 2215.42f, 79.7633f, 0.723503f);
|
||||
}
|
||||
|
||||
void DoAction(int32 param)
|
||||
{
|
||||
if (param == ACTION_START_EVENT)
|
||||
speachTimer = 1;
|
||||
}
|
||||
|
||||
void JustDied(Unit* )
|
||||
{
|
||||
me->MonsterSay("...please don't think less of me.", LANG_UNIVERSAL, 0);
|
||||
Map::PlayerList const& players = me->GetMap()->GetPlayers();
|
||||
if (!players.isEmpty() && players.begin()->GetSource() && players.begin()->GetSource()->GetGroup())
|
||||
sLFGMgr->FinishDungeon(players.begin()->GetSource()->GetGroup()->GetGUID(), 288, me->FindMap());
|
||||
}
|
||||
|
||||
void JustSummoned(Creature* cr)
|
||||
{
|
||||
summons.Summon(cr);
|
||||
cr->setFaction(35);
|
||||
cr->SetControlled(true, UNIT_STATE_STUNNED);
|
||||
cr->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff)
|
||||
{
|
||||
if (speachTimer)
|
||||
{
|
||||
speachTimer += diff;
|
||||
if (speachTimer < 10000)
|
||||
{
|
||||
me->MonsterSay("Did they bother to tell you who I am and why I am doing this?", LANG_UNIVERSAL, 0);
|
||||
speachTimer = 10000;
|
||||
}
|
||||
else if (speachTimer >= 16000 && speachTimer < 20000)
|
||||
{
|
||||
me->MonsterSay("...or are they just using you like they do everybody else?", LANG_UNIVERSAL, 0);
|
||||
speachTimer = 20000;
|
||||
}
|
||||
else if (speachTimer >= 26000 && speachTimer < 30000)
|
||||
{
|
||||
me->MonsterSay("But what does it matter. It is time for this to end.", LANG_UNIVERSAL, 0);
|
||||
speachTimer = 0;
|
||||
me->setFaction(16);
|
||||
me->SetInCombatWithZone();
|
||||
if (Unit* target = SelectTargetFromPlayerList(40.0f))
|
||||
{
|
||||
AttackStart(target);
|
||||
events.ScheduleEvent(EVENT_CALL_BAXTER, 10000);
|
||||
events.ScheduleEvent(EVENT_CALL_FRYE, 20000);
|
||||
events.ScheduleEvent(EVENT_SPELL_PERFUME_SPRAY, 7000);
|
||||
events.ScheduleEvent(EVENT_SPELL_CHAIN_REACTION, 12000);
|
||||
}
|
||||
else
|
||||
EnterEvadeMode();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
events.Update(diff);
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING))
|
||||
return;
|
||||
|
||||
switch (events.GetEvent())
|
||||
{
|
||||
case EVENT_CALL_BAXTER:
|
||||
{
|
||||
EntryCheckPredicate pred(NPC_APOTHECARY_BAXTER);
|
||||
summons.DoAction(ACTION_RELEASE_HELPER, pred);
|
||||
events.PopEvent();
|
||||
break;
|
||||
}
|
||||
case EVENT_CALL_FRYE:
|
||||
{
|
||||
EntryCheckPredicate pred(NPC_APOTHECARY_FRYE);
|
||||
summons.DoAction(ACTION_RELEASE_HELPER, pred);
|
||||
events.PopEvent();
|
||||
break;
|
||||
}
|
||||
case EVENT_SPELL_PERFUME_SPRAY:
|
||||
me->CastSpell(me->GetVictim(), SPELL_ALLURING_PERFUME_SPRAY, false);
|
||||
events.RepeatEvent(6000);
|
||||
break;
|
||||
case EVENT_SPELL_CHAIN_REACTION:
|
||||
me->CastSpell(me->GetVictim(), SPELL_CHAIN_REACTION, false);
|
||||
events.RepeatEvent(12000);
|
||||
break;
|
||||
}
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const
|
||||
{
|
||||
return new npc_love_in_air_hummelAI(creature);
|
||||
}
|
||||
|
||||
bool OnQuestReward(Player* /*player*/, Creature* creature, const Quest *_Quest, uint32 /*slot*/)
|
||||
{
|
||||
if (_Quest->GetQuestId() == QUEST_YOUVE_BEEN_SERVED)
|
||||
creature->AI()->DoAction(ACTION_START_EVENT);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class npc_love_in_air_hummel_helper : public CreatureScript
|
||||
{
|
||||
public:
|
||||
npc_love_in_air_hummel_helper() : CreatureScript("npc_love_in_air_hummel_helper") { }
|
||||
|
||||
struct npc_love_in_air_hummel_helperAI : public ScriptedAI
|
||||
{
|
||||
npc_love_in_air_hummel_helperAI(Creature* creature) : ScriptedAI(creature)
|
||||
{
|
||||
}
|
||||
|
||||
EventMap events;
|
||||
|
||||
void Reset()
|
||||
{
|
||||
}
|
||||
|
||||
void DoAction(int32 param)
|
||||
{
|
||||
if (param == ACTION_RELEASE_HELPER)
|
||||
{
|
||||
me->SetControlled(false, UNIT_STATE_STUNNED);
|
||||
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
||||
me->setFaction(16);
|
||||
me->SetInCombatWithZone();
|
||||
if (Unit* target = SelectTargetFromPlayerList(40.0f))
|
||||
AttackStart(target);
|
||||
|
||||
if (me->GetEntry() == NPC_APOTHECARY_BAXTER)
|
||||
{
|
||||
events.ScheduleEvent(EVENT_SPELL_PERFUME_SPRAY, 7000);
|
||||
events.ScheduleEvent(EVENT_SPELL_CHAIN_REACTION, 12000);
|
||||
}
|
||||
else
|
||||
events.ScheduleEvent(EVENT_SPELL_THROW, 5000);
|
||||
}
|
||||
}
|
||||
|
||||
void JustDied(Unit* ) { me->MonsterSay("...please don't think less of me.", LANG_UNIVERSAL, 0); }
|
||||
|
||||
|
||||
void UpdateAI(uint32 diff)
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
events.Update(diff);
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING))
|
||||
return;
|
||||
|
||||
switch (events.GetEvent())
|
||||
{
|
||||
case EVENT_SPELL_PERFUME_SPRAY:
|
||||
me->CastSpell(me->GetVictim(), SPELL_COLOGNE_SPRAY, false);
|
||||
events.RepeatEvent(6000);
|
||||
break;
|
||||
case EVENT_SPELL_CHAIN_REACTION:
|
||||
me->CastSpell(me->GetVictim(), SPELL_CHAIN_REACTION, false);
|
||||
events.RepeatEvent(12000);
|
||||
break;
|
||||
case EVENT_SPELL_THROW:
|
||||
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM))
|
||||
{
|
||||
Position pos(*me);
|
||||
me->Relocate(target);
|
||||
me->CastSpell(me, RAND(SPELL_THROW_COLOGNE, SPELL_THROW_PERFUME), true, NULL, NULL, me->GetGUID());
|
||||
me->Relocate(pos);
|
||||
}
|
||||
events.RepeatEvent(10000);
|
||||
break;
|
||||
}
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const
|
||||
{
|
||||
return new npc_love_in_air_hummel_helperAI(creature);
|
||||
}
|
||||
};
|
||||
|
||||
class spell_love_in_air_perfume_immune : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_love_in_air_perfume_immune() : SpellScriptLoader("spell_love_in_air_perfume_immune") { }
|
||||
|
||||
class spell_love_in_air_perfume_immune_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_love_in_air_perfume_immune_AuraScript);
|
||||
|
||||
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
if (GetId() == SPELL_COLOGNE_IMMUNE)
|
||||
{
|
||||
target->ApplySpellImmune(SPELL_COLOGNE_PASSIVE_DAMAGE, IMMUNITY_ID, SPELL_COLOGNE_PASSIVE_DAMAGE, true);
|
||||
target->ApplySpellImmune(SPELL_COLOGNE_PASSIVE_DAMAGE, IMMUNITY_ID, SPELL_COLOGNE_SPRAY, true);
|
||||
target->ApplySpellImmune(68934, IMMUNITY_ID, 68934, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
target->ApplySpellImmune(SPELL_PERFUME_PASSIVE_DAMAGE, IMMUNITY_ID, SPELL_PERFUME_PASSIVE_DAMAGE, true);
|
||||
target->ApplySpellImmune(SPELL_ALLURING_PERFUME_SPRAY, IMMUNITY_ID, SPELL_ALLURING_PERFUME_SPRAY, true);
|
||||
target->ApplySpellImmune(68927, IMMUNITY_ID, 68927, true);
|
||||
}
|
||||
}
|
||||
|
||||
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
if (GetId() == SPELL_COLOGNE_IMMUNE)
|
||||
{
|
||||
target->ApplySpellImmune(SPELL_COLOGNE_PASSIVE_DAMAGE, IMMUNITY_ID, SPELL_COLOGNE_PASSIVE_DAMAGE, false);
|
||||
target->ApplySpellImmune(SPELL_COLOGNE_PASSIVE_DAMAGE, IMMUNITY_ID, SPELL_COLOGNE_SPRAY, false);
|
||||
target->ApplySpellImmune(68934, IMMUNITY_ID, 68934, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
target->ApplySpellImmune(SPELL_PERFUME_PASSIVE_DAMAGE, IMMUNITY_ID, SPELL_PERFUME_PASSIVE_DAMAGE, false);
|
||||
target->ApplySpellImmune(SPELL_PERFUME_PASSIVE_DAMAGE, IMMUNITY_ID, SPELL_ALLURING_PERFUME_SPRAY, false);
|
||||
target->ApplySpellImmune(68927, IMMUNITY_ID, 68927, false);
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectApply += AuraEffectApplyFn(spell_love_in_air_perfume_immune_AuraScript::HandleEffectApply, EFFECT_2, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
|
||||
OnEffectRemove += AuraEffectRemoveFn(spell_love_in_air_perfume_immune_AuraScript::HandleEffectRemove, EFFECT_2, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
|
||||
}
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const
|
||||
{
|
||||
return new spell_love_in_air_perfume_immune_AuraScript();
|
||||
}
|
||||
};
|
||||
|
||||
class spell_love_in_air_periodic_perfumes : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_love_in_air_periodic_perfumes() : SpellScriptLoader("spell_love_in_air_periodic_perfumes") { }
|
||||
|
||||
class spell_love_in_air_periodic_perfumes_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_love_in_air_periodic_perfumes_AuraScript);
|
||||
|
||||
void PeriodicTick(AuraEffect const* /*aurEff*/)
|
||||
{
|
||||
uint64 guid = (GetCaster() ? GetCaster()->GetGUID() : 0);
|
||||
if (Unit* target = GetTarget())
|
||||
{
|
||||
uint32 spellId = (GetId() == SPELL_THROW_COLOGNE ? 68934 : 68927);
|
||||
if (target->IsImmunedToSpell(sSpellMgr->GetSpellInfo(spellId)))
|
||||
return;
|
||||
|
||||
target->CastSpell(target, spellId, true, NULL, NULL, guid);
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectPeriodic += AuraEffectPeriodicFn(spell_love_in_air_periodic_perfumes_AuraScript::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const
|
||||
{
|
||||
return new spell_love_in_air_periodic_perfumes_AuraScript();
|
||||
}
|
||||
};
|
||||
|
||||
///////////////////////////////////////
|
||||
////// SPELLS
|
||||
///////////////////////////////////////
|
||||
|
||||
enum CreateHeartCandy
|
||||
{
|
||||
ITEM_HEART_CANDY_1 = 21818,
|
||||
ITEM_HEART_CANDY_2 = 21817,
|
||||
ITEM_HEART_CANDY_3 = 21821,
|
||||
ITEM_HEART_CANDY_4 = 21819,
|
||||
ITEM_HEART_CANDY_5 = 21816,
|
||||
ITEM_HEART_CANDY_6 = 21823,
|
||||
ITEM_HEART_CANDY_7 = 21822,
|
||||
ITEM_HEART_CANDY_8 = 21820,
|
||||
};
|
||||
|
||||
class spell_item_create_heart_candy : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_item_create_heart_candy() : SpellScriptLoader("spell_item_create_heart_candy") { }
|
||||
|
||||
class spell_item_create_heart_candy_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_item_create_heart_candy_SpellScript);
|
||||
|
||||
void HandleScript(SpellEffIndex effIndex)
|
||||
{
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
if (!GetHitUnit() || !GetHitUnit()->ToPlayer())
|
||||
return;
|
||||
|
||||
Player* target = GetHitUnit()->ToPlayer();
|
||||
|
||||
static const uint32 items[] = {ITEM_HEART_CANDY_1, ITEM_HEART_CANDY_2, ITEM_HEART_CANDY_3, ITEM_HEART_CANDY_4, ITEM_HEART_CANDY_5, ITEM_HEART_CANDY_6, ITEM_HEART_CANDY_7, ITEM_HEART_CANDY_8};
|
||||
|
||||
target->AddItem(items[urand(0, 7)], 1);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_item_create_heart_candy_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_item_create_heart_candy_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
// 45102 Romantic Picnic
|
||||
enum SpellsPicnic
|
||||
{
|
||||
SPELL_BASKET_CHECK = 45119, // Holiday - Valentine - Romantic Picnic Near Basket Check
|
||||
SPELL_MEAL_PERIODIC = 45103, // Holiday - Valentine - Romantic Picnic Meal Periodic - effect dummy
|
||||
SPELL_MEAL_EAT_VISUAL = 45120, // Holiday - Valentine - Romantic Picnic Meal Eat Visual
|
||||
//SPELL_MEAL_PARTICLE = 45114, // Holiday - Valentine - Romantic Picnic Meal Particle - unused
|
||||
SPELL_DRINK_VISUAL = 45121, // Holiday - Valentine - Romantic Picnic Drink Visual
|
||||
SPELL_ROMANTIC_PICNIC_ACHIEV = 45123, // Romantic Picnic periodic = 5000
|
||||
};
|
||||
|
||||
class spell_love_is_in_the_air_romantic_picnic : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_love_is_in_the_air_romantic_picnic() : SpellScriptLoader("spell_love_is_in_the_air_romantic_picnic") { }
|
||||
|
||||
class spell_love_is_in_the_air_romantic_picnic_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_love_is_in_the_air_romantic_picnic_AuraScript);
|
||||
|
||||
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
target->SetStandState(UNIT_STAND_STATE_SIT);
|
||||
target->CastSpell(target, SPELL_MEAL_PERIODIC, false);
|
||||
}
|
||||
|
||||
void OnPeriodic(AuraEffect const* /*aurEff*/)
|
||||
{
|
||||
// Every 5 seconds
|
||||
Unit* target = GetTarget();
|
||||
Unit* caster = GetCaster();
|
||||
|
||||
// If our player is no longer sit, remove all auras
|
||||
if (target->getStandState() != UNIT_STAND_STATE_SIT)
|
||||
{
|
||||
target->RemoveAura(SPELL_ROMANTIC_PICNIC_ACHIEV);
|
||||
target->RemoveAura(GetAura());
|
||||
return;
|
||||
}
|
||||
|
||||
target->CastSpell(target, SPELL_BASKET_CHECK, false); // unknown use, it targets Romantic Basket
|
||||
target->CastSpell(target, RAND(SPELL_MEAL_EAT_VISUAL, SPELL_DRINK_VISUAL), false);
|
||||
|
||||
bool foundSomeone = false;
|
||||
// For nearby players, check if they have the same aura. If so, cast Romantic Picnic (45123)
|
||||
// required by achievement and "hearts" visual
|
||||
std::list<Player*> playerList;
|
||||
Trinity::AnyPlayerInObjectRangeCheck checker(target, INTERACTION_DISTANCE*2);
|
||||
Trinity::PlayerListSearcher<Trinity::AnyPlayerInObjectRangeCheck> searcher(target, playerList, checker);
|
||||
target->VisitNearbyWorldObject(INTERACTION_DISTANCE*2, searcher);
|
||||
for (std::list<Player*>::const_iterator itr = playerList.begin(); itr != playerList.end(); ++itr)
|
||||
{
|
||||
if ((*itr) != target && (*itr)->HasAura(GetId())) // && (*itr)->getStandState() == UNIT_STAND_STATE_SIT)
|
||||
{
|
||||
if (caster)
|
||||
{
|
||||
caster->CastSpell(*itr, SPELL_ROMANTIC_PICNIC_ACHIEV, true);
|
||||
caster->CastSpell(target, SPELL_ROMANTIC_PICNIC_ACHIEV, true);
|
||||
}
|
||||
foundSomeone = true;
|
||||
// break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!foundSomeone && target->HasAura(SPELL_ROMANTIC_PICNIC_ACHIEV))
|
||||
target->RemoveAura(SPELL_ROMANTIC_PICNIC_ACHIEV);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
AfterEffectApply += AuraEffectApplyFn(spell_love_is_in_the_air_romantic_picnic_AuraScript::OnApply, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
|
||||
OnEffectPeriodic += AuraEffectPeriodicFn(spell_love_is_in_the_air_romantic_picnic_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const
|
||||
{
|
||||
return new spell_love_is_in_the_air_romantic_picnic_AuraScript();
|
||||
}
|
||||
};
|
||||
|
||||
enum ServiceUniform
|
||||
{
|
||||
SPELL_SERVICE_UNIFORM = 71450,
|
||||
|
||||
MODEL_GOBLIN_MALE = 31002,
|
||||
MODEL_GOBLIN_FEMALE = 31003
|
||||
};
|
||||
|
||||
class spell_gen_aura_service_uniform : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_gen_aura_service_uniform() : SpellScriptLoader("spell_gen_aura_service_uniform") { }
|
||||
|
||||
class spell_gen_aura_service_uniform_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_gen_aura_service_uniform_AuraScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*spell*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_SERVICE_UNIFORM))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
// Apply model goblin
|
||||
Unit* target = GetTarget();
|
||||
if (target->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
if (target->getGender() == GENDER_MALE)
|
||||
target->SetDisplayId(MODEL_GOBLIN_MALE);
|
||||
else
|
||||
target->SetDisplayId(MODEL_GOBLIN_FEMALE);
|
||||
}
|
||||
}
|
||||
|
||||
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
if (target->GetTypeId() == TYPEID_PLAYER)
|
||||
target->RestoreDisplayId();
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
AfterEffectApply += AuraEffectApplyFn(spell_gen_aura_service_uniform_AuraScript::OnApply, EFFECT_0, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL);
|
||||
AfterEffectRemove += AuraEffectRemoveFn(spell_gen_aura_service_uniform_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL);
|
||||
}
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const
|
||||
{
|
||||
return new spell_gen_aura_service_uniform_AuraScript();
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_event_love_in_the_air()
|
||||
{
|
||||
// Npcs
|
||||
new npc_love_in_air_supply_sentry();
|
||||
new npc_love_in_air_snivel();
|
||||
new npc_love_in_air_snivel_real();
|
||||
|
||||
// Boss
|
||||
new npc_love_in_air_hummel();
|
||||
new npc_love_in_air_hummel_helper();
|
||||
new spell_love_in_air_perfume_immune();
|
||||
new spell_love_in_air_periodic_perfumes();
|
||||
|
||||
// Spells
|
||||
new spell_item_create_heart_candy();
|
||||
new spell_love_is_in_the_air_romantic_picnic();
|
||||
new spell_gen_aura_service_uniform();
|
||||
}
|
||||
@@ -1,520 +0,0 @@
|
||||
// Scripted by Xinef
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "ScriptedGossip.h"
|
||||
#include "Spell.h"
|
||||
#include "SpellAuras.h"
|
||||
#include "SpellScript.h"
|
||||
#include "Player.h"
|
||||
|
||||
enum eBonfire
|
||||
{
|
||||
GO_MIDSUMMER_BONFIRE = 181288,
|
||||
|
||||
SPELL_STAMP_OUT_BONFIRE = 45437,
|
||||
SPELL_LIGHT_BONFIRE = 29831,
|
||||
};
|
||||
|
||||
class go_midsummer_bonfire : public GameObjectScript
|
||||
{
|
||||
public:
|
||||
go_midsummer_bonfire() : GameObjectScript("go_midsummer_bonfire") { }
|
||||
|
||||
bool OnGossipSelect(Player* player, GameObject* go, uint32 /*sender*/, uint32 action)
|
||||
{
|
||||
player->CLOSE_GOSSIP_MENU();
|
||||
// we know that there is only one gossip.
|
||||
player->CastSpell(player, SPELL_STAMP_OUT_BONFIRE, true);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class npc_midsummer_bonfire : public CreatureScript
|
||||
{
|
||||
public:
|
||||
npc_midsummer_bonfire() : CreatureScript("npc_midsummer_bonfire") { }
|
||||
|
||||
struct npc_midsummer_bonfireAI : public ScriptedAI
|
||||
{
|
||||
npc_midsummer_bonfireAI(Creature* c) : ScriptedAI(c)
|
||||
{
|
||||
me->IsAIEnabled = true;
|
||||
goGUID = 0;
|
||||
if (GameObject* go = me->SummonGameObject(GO_MIDSUMMER_BONFIRE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 0))
|
||||
{
|
||||
goGUID = go->GetGUID();
|
||||
me->RemoveGameObject(go, false);
|
||||
}
|
||||
}
|
||||
|
||||
uint64 goGUID;
|
||||
|
||||
void SpellHit(Unit*, SpellInfo const* spellInfo)
|
||||
{
|
||||
if (!goGUID)
|
||||
return;
|
||||
|
||||
// Extinguish fire
|
||||
if (spellInfo->Id == SPELL_STAMP_OUT_BONFIRE)
|
||||
{
|
||||
if (GameObject* go = ObjectAccessor::GetGameObject(*me, goGUID))
|
||||
go->SetPhaseMask(2, true);
|
||||
}
|
||||
else if (spellInfo->Id == SPELL_LIGHT_BONFIRE)
|
||||
{
|
||||
if (GameObject* go = ObjectAccessor::GetGameObject(*me, goGUID))
|
||||
{
|
||||
go->SetPhaseMask(1, true);
|
||||
go->SendCustomAnim(1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const
|
||||
{
|
||||
return new npc_midsummer_bonfireAI(creature);
|
||||
}
|
||||
};
|
||||
|
||||
class npc_midsummer_torch_target : public CreatureScript
|
||||
{
|
||||
public:
|
||||
npc_midsummer_torch_target() : CreatureScript("npc_midsummer_torch_target") { }
|
||||
|
||||
struct npc_midsummer_torch_targetAI : public ScriptedAI
|
||||
{
|
||||
npc_midsummer_torch_targetAI(Creature* c) : ScriptedAI(c)
|
||||
{
|
||||
teleTimer = 0;
|
||||
startTimer = 1;
|
||||
posVec.clear();
|
||||
playerGUID = 0;
|
||||
me->CastSpell(me, 43313, true);
|
||||
counter = 0;
|
||||
maxCount = 0;
|
||||
}
|
||||
|
||||
uint64 playerGUID;
|
||||
uint32 startTimer;
|
||||
uint32 teleTimer;
|
||||
std::vector<Position> posVec;
|
||||
uint8 counter;
|
||||
uint8 maxCount;
|
||||
|
||||
void SetPlayerGUID(uint64 guid, uint8 cnt)
|
||||
{
|
||||
playerGUID = guid;
|
||||
maxCount = cnt;
|
||||
}
|
||||
|
||||
bool CanBeSeen(Player const* seer)
|
||||
{
|
||||
return seer->GetGUID() == playerGUID;
|
||||
}
|
||||
|
||||
void SpellHit(Unit* caster, SpellInfo const* spellInfo)
|
||||
{
|
||||
if (posVec.empty())
|
||||
return;
|
||||
// Triggered spell from torch
|
||||
if (spellInfo->Id == 46054 && caster->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
me->CastSpell(me, 45724, true); // hit visual anim
|
||||
if (++counter >= maxCount)
|
||||
{
|
||||
caster->CastSpell(caster, (caster->ToPlayer()->GetTeamId() ? 46651 : 45719), true); // quest complete spell
|
||||
me->DespawnOrUnsummon(1);
|
||||
return;
|
||||
}
|
||||
|
||||
teleTimer = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff)
|
||||
{
|
||||
if (startTimer)
|
||||
{
|
||||
startTimer += diff;
|
||||
if (startTimer >= 200)
|
||||
{
|
||||
startTimer = 0;
|
||||
FillPositions();
|
||||
SelectPosition();
|
||||
}
|
||||
}
|
||||
if (teleTimer)
|
||||
{
|
||||
teleTimer += diff;
|
||||
if (teleTimer >= 750 && teleTimer < 10000)
|
||||
{
|
||||
teleTimer = 10000;
|
||||
SelectPosition();
|
||||
}
|
||||
else if (teleTimer >= 10500)
|
||||
{
|
||||
if (Player* plr = ObjectAccessor::GetPlayer(*me, playerGUID))
|
||||
plr->UpdateTriggerVisibility();
|
||||
|
||||
teleTimer = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FillPositions()
|
||||
{
|
||||
std::list<GameObject*> gobjList;
|
||||
me->GetGameObjectListWithEntryInGrid(gobjList, 187708 /*TORCH_GO*/, 30.0f);
|
||||
for (std::list<GameObject*>::const_iterator itr = gobjList.begin(); itr != gobjList.end(); ++itr)
|
||||
{
|
||||
Position pos;
|
||||
pos.Relocate(*itr);
|
||||
posVec.push_back(pos);
|
||||
}
|
||||
}
|
||||
|
||||
void SelectPosition()
|
||||
{
|
||||
if (posVec.empty())
|
||||
return;
|
||||
int8 num = urand(0, posVec.size()-1);
|
||||
Position pos;
|
||||
pos.Relocate(posVec.at(num));
|
||||
me->m_last_notify_position.Relocate(0.0f, 0.0f, 0.0f);
|
||||
me->m_last_notify_mstime = World::GetGameTimeMS() + 10000;
|
||||
|
||||
me->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation());
|
||||
}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const
|
||||
{
|
||||
return new npc_midsummer_torch_targetAI(creature);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
///////////////////////////////
|
||||
// SPELLS
|
||||
///////////////////////////////
|
||||
|
||||
enum RibbonPole
|
||||
{
|
||||
SPELL_RIBBON_POLE_CHANNEL_VISUAL = 29172,
|
||||
SPELL_RIBBON_POLE_XP = 29175,
|
||||
SPELL_RIBBON_POLE_FIREWORKS = 46971,
|
||||
|
||||
NPC_RIBBON_POLE_DEBUG_TARGET = 17066,
|
||||
};
|
||||
|
||||
class spell_midsummer_ribbon_pole : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_midsummer_ribbon_pole() : SpellScriptLoader("spell_midsummer_ribbon_pole") { }
|
||||
|
||||
class spell_midsummer_ribbon_pole_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_midsummer_ribbon_pole_AuraScript)
|
||||
|
||||
void HandleEffectPeriodic(AuraEffect const * aurEff)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
if (Unit *target = GetTarget())
|
||||
{
|
||||
Creature* cr = target->FindNearestCreature(NPC_RIBBON_POLE_DEBUG_TARGET, 10.0f);
|
||||
if (!cr)
|
||||
{
|
||||
target->RemoveAura(SPELL_RIBBON_POLE_CHANNEL_VISUAL);
|
||||
SetDuration(1);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Aura* aur = target->GetAura(SPELL_RIBBON_POLE_XP))
|
||||
aur->SetDuration(std::min(aur->GetDuration()+3*MINUTE*IN_MILLISECONDS, 60*MINUTE*IN_MILLISECONDS));
|
||||
else
|
||||
target->CastSpell(target, SPELL_RIBBON_POLE_XP, true);
|
||||
|
||||
if (roll_chance_i(5))
|
||||
{
|
||||
cr->Relocate(cr->GetPositionX(), cr->GetPositionY(), cr->GetPositionZ()-6.5f);
|
||||
cr->CastSpell(cr, SPELL_RIBBON_POLE_FIREWORKS, true);
|
||||
cr->Relocate(cr->GetPositionX(), cr->GetPositionY(), cr->GetPositionZ()+6.5f);
|
||||
}
|
||||
|
||||
// Achievement
|
||||
if ((time(NULL) - GetApplyTime()) > 60 && target->GetTypeId() == TYPEID_PLAYER)
|
||||
target->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 58934, 0, target);
|
||||
}
|
||||
}
|
||||
|
||||
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
Unit* ar = GetTarget();
|
||||
ar->CastSpell(ar, SPELL_RIBBON_POLE_CHANNEL_VISUAL, true);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectApply += AuraEffectApplyFn(spell_midsummer_ribbon_pole_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
|
||||
OnEffectPeriodic += AuraEffectPeriodicFn(spell_midsummer_ribbon_pole_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const
|
||||
{
|
||||
return new spell_midsummer_ribbon_pole_AuraScript();
|
||||
}
|
||||
};
|
||||
|
||||
class spell_midsummer_torch_quest : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_midsummer_torch_quest() : SpellScriptLoader("spell_midsummer_torch_quest") { }
|
||||
|
||||
class spell_midsummer_torch_quest_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_midsummer_torch_quest_AuraScript)
|
||||
|
||||
bool Load()
|
||||
{
|
||||
torchGUID = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
uint64 torchGUID;
|
||||
|
||||
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
Unit* ar = GetTarget();
|
||||
if (Creature* cr = ar->SummonCreature(25535, ar->GetPositionX(), ar->GetPositionY(), ar->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN, 90000))
|
||||
{
|
||||
torchGUID = cr->GetGUID();
|
||||
CAST_AI(npc_midsummer_torch_target::npc_midsummer_torch_targetAI, cr->AI())->SetPlayerGUID(ar->GetGUID(), (GetId() == 45716 ? 8 : 20));
|
||||
}
|
||||
}
|
||||
|
||||
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (Creature* cr = ObjectAccessor::GetCreature(*GetTarget(), torchGUID))
|
||||
cr->DespawnOrUnsummon(1);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectApply += AuraEffectApplyFn(spell_midsummer_torch_quest_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DETECT_AMORE, AURA_EFFECT_HANDLE_REAL);
|
||||
OnEffectRemove += AuraEffectRemoveFn(spell_midsummer_torch_quest_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DETECT_AMORE, AURA_EFFECT_HANDLE_REAL);
|
||||
}
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const
|
||||
{
|
||||
return new spell_midsummer_torch_quest_AuraScript();
|
||||
}
|
||||
};
|
||||
|
||||
enum flingTorch
|
||||
{
|
||||
NPC_TORCH_TARGET = 26188,
|
||||
|
||||
SPELL_FLING_TORCH = 45669,
|
||||
SPELL_FLING_TORCH_DUMMY = 46747,
|
||||
SPELL_MISSED_TORCH = 45676,
|
||||
SPELL_TORCH_COUNTER = 45693,
|
||||
};
|
||||
|
||||
class spell_midsummer_fling_torch : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_midsummer_fling_torch() : SpellScriptLoader("spell_midsummer_fling_torch") {}
|
||||
|
||||
class spell_midsummer_fling_torch_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_midsummer_fling_torch_SpellScript);
|
||||
|
||||
bool handled;
|
||||
bool Load() { handled = false; return true; }
|
||||
|
||||
void ThrowNextTorch(Unit* caster)
|
||||
{
|
||||
std::list<Creature*> crList;
|
||||
caster->GetCreaturesWithEntryInRange(crList, 100.0f, NPC_TORCH_TARGET);
|
||||
|
||||
uint8 rand = urand(0, crList.size()-1);
|
||||
Position pos;
|
||||
pos.Relocate(0.0f, 0.0f, 0.0f);
|
||||
for (std::list<Creature*>::const_iterator itr = crList.begin(); itr != crList.end(); ++itr, --rand)
|
||||
{
|
||||
if (caster->GetDistance(*itr) < 5)
|
||||
{
|
||||
if (!rand)
|
||||
rand++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!rand)
|
||||
{
|
||||
pos.Relocate(*itr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// we have any pos
|
||||
if (pos.GetPositionX())
|
||||
caster->CastSpell(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), SPELL_FLING_TORCH, true);
|
||||
}
|
||||
|
||||
void HandleFinish()
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
if (!caster || !caster->ToPlayer()) // caster cant be null, but meh :p
|
||||
return;
|
||||
|
||||
if (GetSpellInfo()->Id != SPELL_FLING_TORCH_DUMMY)
|
||||
{
|
||||
if (!handled)
|
||||
if (const WorldLocation* loc = GetExplTargetDest())
|
||||
{
|
||||
caster->CastSpell(loc->GetPositionX(), loc->GetPositionY(), loc->GetPositionZ(), SPELL_MISSED_TORCH, true);
|
||||
caster->RemoveAurasDueToSpell(SPELL_TORCH_COUNTER);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
ThrowNextTorch(caster);
|
||||
}
|
||||
|
||||
void HandleScript(SpellEffIndex effIndex)
|
||||
{
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
if (Player* target = GetHitPlayer())
|
||||
{
|
||||
if (target->GetGUID() != GetCaster()->GetGUID())
|
||||
return;
|
||||
|
||||
handled = true;
|
||||
if (Aura* aur = target->GetAura(SPELL_TORCH_COUNTER))
|
||||
{
|
||||
aur->ModStackAmount(1);
|
||||
uint8 count = 4;
|
||||
if (target->GetQuestStatus(target->GetTeamId() ? 11925 : 11924) == QUEST_STATUS_INCOMPLETE) // More Torch Catching quests
|
||||
count = 10;
|
||||
|
||||
if (aur->GetStackAmount() >= count)
|
||||
{
|
||||
//target->CastSpell(target, 46711, true); // Set Flag: all torch returning quests are complete
|
||||
target->CastSpell(target, (target->GetTeamId() ? 46654 : 46081), true); // Quest completion
|
||||
aur->SetDuration(1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
target->CastSpell(target, SPELL_TORCH_COUNTER, true);
|
||||
|
||||
ThrowNextTorch(GetCaster());
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
AfterCast += SpellCastFn(spell_midsummer_fling_torch_SpellScript::HandleFinish);
|
||||
if (m_scriptSpellId == 45671)
|
||||
OnEffectHitTarget += SpellEffectFn(spell_midsummer_fling_torch_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_midsummer_fling_torch_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
enum eJuggle
|
||||
{
|
||||
SPELL_JUGGLE_SELF = 45638,
|
||||
SPELL_JUGGLE_SLOW = 45792,
|
||||
SPELL_JUGGLE_MED = 45806,
|
||||
SPELL_JUGGLE_FAST = 45816,
|
||||
|
||||
SPELL_TORCH_CHECK = 45644,
|
||||
SPELL_GIVE_TORCH = 45280,
|
||||
QUEST_CHECK = 11937,
|
||||
};
|
||||
|
||||
class spell_midsummer_juggling_torch : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_midsummer_juggling_torch() : SpellScriptLoader("spell_midsummer_juggling_torch") {}
|
||||
|
||||
class spell_midsummer_juggling_torch_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_midsummer_juggling_torch_SpellScript);
|
||||
|
||||
bool handled;
|
||||
bool Load() { handled = false; return true; }
|
||||
void HandleFinish()
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
if (const WorldLocation* loc = GetExplTargetDest())
|
||||
{
|
||||
if (loc->GetExactDist(caster) < 3.0f)
|
||||
caster->CastSpell(loc->GetPositionX(), loc->GetPositionY(), loc->GetPositionZ(), SPELL_JUGGLE_SELF, true);
|
||||
else if (loc->GetExactDist(caster) < 10.0f)
|
||||
caster->CastSpell(loc->GetPositionX(), loc->GetPositionY(), loc->GetPositionZ(), SPELL_JUGGLE_SLOW, true);
|
||||
else if (loc->GetExactDist(caster) < 25.0f)
|
||||
caster->CastSpell(loc->GetPositionX(), loc->GetPositionY(), loc->GetPositionZ(), SPELL_JUGGLE_MED, true);
|
||||
else
|
||||
caster->CastSpell(loc->GetPositionX(), loc->GetPositionY(), loc->GetPositionZ(), SPELL_JUGGLE_FAST, true);
|
||||
}
|
||||
else
|
||||
caster->CastSpell(caster, SPELL_JUGGLE_SELF, true);
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex effIndex)
|
||||
{
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
Unit* caster = GetCaster();
|
||||
if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
if (Player* target = GetHitPlayer())
|
||||
if (!handled && target->GetQuestRewardStatus(target->GetTeamId() == TEAM_ALLIANCE ? 11657 : 11923))
|
||||
{
|
||||
handled = true;
|
||||
caster->CastSpell(target, SPELL_GIVE_TORCH, true);
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
if (m_scriptSpellId == SPELL_TORCH_CHECK)
|
||||
OnEffectHitTarget += SpellEffectFn(spell_midsummer_juggling_torch_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
else
|
||||
AfterCast += SpellCastFn(spell_midsummer_juggling_torch_SpellScript::HandleFinish);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_midsummer_juggling_torch_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_event_midsummer_scripts()
|
||||
{
|
||||
// NPCs
|
||||
new go_midsummer_bonfire();
|
||||
new npc_midsummer_bonfire();
|
||||
new npc_midsummer_torch_target();
|
||||
|
||||
// Spells
|
||||
new spell_midsummer_ribbon_pole();
|
||||
new spell_midsummer_torch_quest();
|
||||
new spell_midsummer_fling_torch();
|
||||
new spell_midsummer_juggling_torch();
|
||||
}
|
||||
@@ -1,704 +0,0 @@
|
||||
// Scripted by Xinef
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
#include "CombatAI.h"
|
||||
#include "SpellScript.h"
|
||||
#include "Player.h"
|
||||
#include "Vehicle.h"
|
||||
|
||||
///////////////////////////////////////
|
||||
////// TABLE EVENT
|
||||
///////////////////////////////////////
|
||||
|
||||
enum tableEvent
|
||||
{
|
||||
// Spells
|
||||
SPELL_PASS_TURKEY = 66250,
|
||||
SPELL_PASS_STUFFING = 66259,
|
||||
SPELL_PASS_PIE = 66260,
|
||||
SPELL_PASS_CRANBERRY = 66261,
|
||||
SPELL_PASS_SWEET_POTATO = 66262,
|
||||
|
||||
SPELL_VISUAL_THROW_TURKEY = 61822,
|
||||
SPELL_VISUAL_THROW_STUFFING = 61823,
|
||||
SPELL_VISUAL_THROW_PIE = 61825,
|
||||
SPELL_VISUAL_THROW_CRANBERRY = 61821,
|
||||
SPELL_VISUAL_THROW_SWEET_POTATO = 61824,
|
||||
|
||||
SPELL_VISUAL_BOUNCE_TURKEY = 61928,
|
||||
SPELL_VISUAL_BOUNCE_STUFFING = 61927,
|
||||
SPELL_VISUAL_BOUNCE_PIE = 61926,
|
||||
SPELL_VISUAL_BOUNCE_CRANBERRY = 61925,
|
||||
SPELL_VISUAL_BOUNCE_SWEET_POTATO= 61929,
|
||||
|
||||
SPELL_PLATE_TURKEY = 61835,
|
||||
SPELL_PLATE_STUFFING = 61836,
|
||||
SPELL_PLATE_PIE = 61838,
|
||||
SPELL_PLATE_CRANBERRY = 61833,
|
||||
SPELL_PLATE_SWEET_POTATO = 61837,
|
||||
|
||||
SPELL_STORE_TURKEY = 61807,
|
||||
SPELL_STORE_STUFFING = 61806,
|
||||
SPELL_STORE_PIE = 61805,
|
||||
SPELL_STORE_CRANBERRY = 61804,
|
||||
SPELL_STORE_SWEET_POTATO = 61808,
|
||||
|
||||
SPELL_CAN_EAT_TURKEY = 61801,
|
||||
SPELL_CAN_EAT_STUFFING = 61800,
|
||||
SPELL_CAN_EAT_PIE = 61799,
|
||||
SPELL_CAN_EAT_CRANBERRY = 61798,
|
||||
SPELL_CAN_EAT_SWEET_POTATO = 61802,
|
||||
|
||||
SPELL_FEAST_ON_TURKEY = 61784,
|
||||
SPELL_FEAST_ON_STUFFING = 61788,
|
||||
SPELL_FEAST_ON_PIE = 61787,
|
||||
SPELL_FEAST_ON_CRANBERRY = 61785,
|
||||
SPELL_FEAST_ON_SWEET_POTATOES = 61786,
|
||||
|
||||
SPELL_PLAYER_TURKEY = 61842,
|
||||
SPELL_PLAYER_STUFFING = 61843,
|
||||
SPELL_PLAYER_PIE = 61845,
|
||||
SPELL_PLAYER_CRANBERRY = 61841,
|
||||
SPELL_PLAYER_SWEET_POTATOES = 61844,
|
||||
|
||||
SPELL_WELL_FED_TURKEY = 65414,
|
||||
SPELL_WELL_FED_STUFFING = 65416,
|
||||
SPELL_WELL_FED_PIE = 65415,
|
||||
SPELL_WELL_FED_CRANBERRY = 65412,
|
||||
SPELL_WELL_FED_SWEET_POTATOES = 65410,
|
||||
|
||||
SPELL_ACHI_PASS_TURKEY = 66373,
|
||||
SPELL_ACHI_PASS_STUFFING = 66375,
|
||||
SPELL_ACHI_PASS_PIE = 66374,
|
||||
SPELL_ACHI_PASS_CRANBERRY = 66372,
|
||||
SPELL_ACHI_PASS_SWEET_POTATOES = 66376,
|
||||
|
||||
SPELL_SPIRIT_OF_SHARING = 61849,
|
||||
|
||||
// NPCs
|
||||
NPC_STRUDY_PLATE = 32839,
|
||||
NPC_BOUNTIFUL_TABLE = 32823,
|
||||
};
|
||||
|
||||
/////////////////////////////
|
||||
// NPCs
|
||||
/////////////////////////////
|
||||
|
||||
class npc_pilgrims_bounty_chair : public CreatureScript
|
||||
{
|
||||
public:
|
||||
npc_pilgrims_bounty_chair() : CreatureScript("npc_pilgrims_bounty_chair") { }
|
||||
|
||||
struct npc_pilgrims_bounty_chairAI : public VehicleAI
|
||||
{
|
||||
npc_pilgrims_bounty_chairAI(Creature* creature) : VehicleAI(creature)
|
||||
{
|
||||
plateGUID = 0;
|
||||
timerSpawnPlate = 1;
|
||||
timerRotateChair = 0;
|
||||
me->SetReactState(REACT_PASSIVE);
|
||||
}
|
||||
|
||||
void MoveInLineOfSight(Unit* who) {}
|
||||
void AttackStart(Unit*) {}
|
||||
|
||||
void PassengerBoarded(Unit* who, int8 seatId, bool apply)
|
||||
{
|
||||
if (apply && who->GetTypeId() == TYPEID_PLAYER)
|
||||
who->ToPlayer()->SetClientControl(me, 0, true);
|
||||
}
|
||||
|
||||
uint64 plateGUID;
|
||||
uint32 timerSpawnPlate;
|
||||
uint32 timerRotateChair;
|
||||
|
||||
Creature* GetPlate() { return plateGUID ? ObjectAccessor::GetCreature(*me, plateGUID) : NULL; }
|
||||
|
||||
void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask)
|
||||
{
|
||||
damage = 0;
|
||||
}
|
||||
|
||||
void DoAction(int32 param)
|
||||
{
|
||||
switch (param)
|
||||
{
|
||||
case SPELL_VISUAL_THROW_TURKEY:
|
||||
case SPELL_VISUAL_BOUNCE_TURKEY:
|
||||
me->CastSpell(me, SPELL_STORE_TURKEY, true);
|
||||
me->CastSpell(me, SPELL_CAN_EAT_TURKEY, true);
|
||||
if (Unit* plate = GetPlate())
|
||||
plate->CastSpell(plate, SPELL_PLATE_TURKEY, true);
|
||||
break;
|
||||
case SPELL_VISUAL_THROW_STUFFING:
|
||||
case SPELL_VISUAL_BOUNCE_STUFFING:
|
||||
me->CastSpell(me, SPELL_STORE_STUFFING, true);
|
||||
me->CastSpell(me, SPELL_CAN_EAT_STUFFING, true);
|
||||
if (Unit* plate = GetPlate())
|
||||
plate->CastSpell(plate, SPELL_PLATE_STUFFING, true);
|
||||
break;
|
||||
case SPELL_VISUAL_THROW_PIE:
|
||||
case SPELL_VISUAL_BOUNCE_PIE:
|
||||
me->CastSpell(me, SPELL_STORE_PIE, true);
|
||||
me->CastSpell(me, SPELL_CAN_EAT_PIE, true);
|
||||
if (Unit* plate = GetPlate())
|
||||
plate->CastSpell(plate, SPELL_PLATE_PIE, true);
|
||||
break;
|
||||
case SPELL_VISUAL_THROW_CRANBERRY:
|
||||
case SPELL_VISUAL_BOUNCE_CRANBERRY:
|
||||
me->CastSpell(me, SPELL_STORE_CRANBERRY, true);
|
||||
me->CastSpell(me, SPELL_CAN_EAT_CRANBERRY, true);
|
||||
if (Unit* plate = GetPlate())
|
||||
plate->CastSpell(plate, SPELL_PLATE_CRANBERRY, true);
|
||||
break;
|
||||
case SPELL_VISUAL_THROW_SWEET_POTATO:
|
||||
case SPELL_VISUAL_BOUNCE_SWEET_POTATO:
|
||||
me->CastSpell(me, SPELL_STORE_SWEET_POTATO, true);
|
||||
me->CastSpell(me, SPELL_CAN_EAT_SWEET_POTATO, true);
|
||||
if (Unit* plate = GetPlate())
|
||||
plate->CastSpell(plate, SPELL_PLATE_SWEET_POTATO, true);
|
||||
break;
|
||||
|
||||
// AURA REMOVAL
|
||||
case SPELL_STORE_SWEET_POTATO:
|
||||
me->RemoveAura(SPELL_CAN_EAT_SWEET_POTATO);
|
||||
if (Unit* plate = GetPlate())
|
||||
plate->RemoveAura(SPELL_PLATE_SWEET_POTATO);
|
||||
break;
|
||||
case SPELL_STORE_TURKEY:
|
||||
me->RemoveAura(SPELL_CAN_EAT_TURKEY);
|
||||
if (Unit* plate = GetPlate())
|
||||
plate->RemoveAura(SPELL_PLATE_TURKEY);
|
||||
break;
|
||||
case SPELL_STORE_PIE:
|
||||
me->RemoveAura(SPELL_CAN_EAT_PIE);
|
||||
if (Unit* plate = GetPlate())
|
||||
plate->RemoveAura(SPELL_PLATE_PIE);
|
||||
break;
|
||||
case SPELL_STORE_STUFFING:
|
||||
me->RemoveAura(SPELL_CAN_EAT_STUFFING);
|
||||
if (Unit* plate = GetPlate())
|
||||
plate->RemoveAura(SPELL_PLATE_STUFFING);
|
||||
break;
|
||||
case SPELL_STORE_CRANBERRY:
|
||||
me->RemoveAura(SPELL_CAN_EAT_CRANBERRY);
|
||||
if (Unit* plate = GetPlate())
|
||||
plate->RemoveAura(SPELL_PLATE_CRANBERRY);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void SpellHitTarget(Unit* target, const SpellInfo* spellInfo)
|
||||
{
|
||||
Unit* charm = target->GetCharm();
|
||||
if (!charm || !charm->ToCreature())
|
||||
return;
|
||||
|
||||
charm->ToCreature()->AI()->DoAction(spellInfo->Id);
|
||||
}
|
||||
|
||||
void SpellHit(Unit* target, const SpellInfo* spellInfo)
|
||||
{
|
||||
switch (spellInfo->Id)
|
||||
{
|
||||
case SPELL_FEAST_ON_SWEET_POTATOES:
|
||||
if (Aura* aur = me->GetAura(SPELL_STORE_SWEET_POTATO))
|
||||
aur->ModStackAmount(-1);
|
||||
break;
|
||||
case SPELL_FEAST_ON_TURKEY:
|
||||
if (Aura* aur = me->GetAura(SPELL_STORE_TURKEY))
|
||||
aur->ModStackAmount(-1);
|
||||
break;
|
||||
case SPELL_FEAST_ON_PIE:
|
||||
if (Aura* aur = me->GetAura(SPELL_STORE_PIE))
|
||||
aur->ModStackAmount(-1);
|
||||
break;
|
||||
case SPELL_FEAST_ON_STUFFING:
|
||||
if (Aura* aur = me->GetAura(SPELL_STORE_STUFFING))
|
||||
aur->ModStackAmount(-1);
|
||||
break;
|
||||
case SPELL_FEAST_ON_CRANBERRY:
|
||||
if (Aura* aur = me->GetAura(SPELL_STORE_CRANBERRY))
|
||||
aur->ModStackAmount(-1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff)
|
||||
{
|
||||
if (timerSpawnPlate)
|
||||
{
|
||||
timerSpawnPlate += diff;
|
||||
if (timerSpawnPlate >= 1000)
|
||||
{
|
||||
if (Vehicle* table = me->GetVehicle())
|
||||
if (Unit* plateHolder = table->GetPassenger(6))
|
||||
{
|
||||
SeatMap::const_iterator itr = table->GetSeatIteratorForPassenger(me);
|
||||
if (itr == table->Seats.end())
|
||||
return;
|
||||
|
||||
uint8 vehicleSeatId = itr->first;
|
||||
Creature* plate = me->SummonCreature(NPC_STRUDY_PLATE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0.0f);
|
||||
if (!plate)
|
||||
return;
|
||||
|
||||
plateGUID = plate->GetGUID();
|
||||
plate->EnterVehicle(plateHolder, vehicleSeatId);
|
||||
timerSpawnPlate = 0;
|
||||
timerRotateChair = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (timerRotateChair)
|
||||
{
|
||||
timerRotateChair += diff;
|
||||
if (timerRotateChair >= 1000)
|
||||
{
|
||||
if (Creature* plate = GetPlate())
|
||||
me->SetFacingToObject(plate);
|
||||
|
||||
timerRotateChair = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const
|
||||
{
|
||||
return new npc_pilgrims_bounty_chairAI(creature);
|
||||
}
|
||||
};
|
||||
|
||||
class npc_pilgrims_bounty_plate : public CreatureScript
|
||||
{
|
||||
public:
|
||||
npc_pilgrims_bounty_plate() : CreatureScript("npc_pilgrims_bounty_plate") { }
|
||||
|
||||
struct npc_pilgrims_bounty_plateAI : public NullCreatureAI
|
||||
{
|
||||
npc_pilgrims_bounty_plateAI(Creature* creature) : NullCreatureAI(creature)
|
||||
{
|
||||
}
|
||||
|
||||
void SpellHit(Unit* caster, const SpellInfo* spellInfo)
|
||||
{
|
||||
switch (spellInfo->Id)
|
||||
{
|
||||
case SPELL_VISUAL_THROW_TURKEY:
|
||||
case SPELL_VISUAL_THROW_STUFFING:
|
||||
case SPELL_VISUAL_THROW_PIE:
|
||||
case SPELL_VISUAL_THROW_CRANBERRY:
|
||||
case SPELL_VISUAL_THROW_SWEET_POTATO:
|
||||
if (TempSummon* ts = me->ToTempSummon())
|
||||
if (Unit* owner = ts->GetSummoner())
|
||||
owner->ToCreature()->AI()->DoAction(spellInfo->Id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const
|
||||
{
|
||||
return new npc_pilgrims_bounty_plateAI(creature);
|
||||
}
|
||||
};
|
||||
|
||||
/////////////////////////////
|
||||
// Spells
|
||||
/////////////////////////////
|
||||
class spell_pilgrims_bounty_pass_generic : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_pilgrims_bounty_pass_generic() : SpellScriptLoader("spell_pilgrims_bounty_pass_generic") {}
|
||||
|
||||
class spell_pilgrims_bounty_pass_generic_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_pilgrims_bounty_pass_generic_SpellScript);
|
||||
|
||||
uint32 GetVisualThrow(uint32 passSpell, bool isPlayer)
|
||||
{
|
||||
if (isPlayer)
|
||||
{
|
||||
switch (passSpell)
|
||||
{
|
||||
|
||||
case SPELL_PASS_TURKEY: return SPELL_VISUAL_BOUNCE_TURKEY;
|
||||
case SPELL_PASS_STUFFING: return SPELL_VISUAL_BOUNCE_STUFFING;
|
||||
case SPELL_PASS_PIE: return SPELL_VISUAL_BOUNCE_PIE;
|
||||
case SPELL_PASS_CRANBERRY: return SPELL_VISUAL_BOUNCE_CRANBERRY;
|
||||
case SPELL_PASS_SWEET_POTATO: return SPELL_VISUAL_BOUNCE_SWEET_POTATO;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (passSpell)
|
||||
{
|
||||
|
||||
case SPELL_PASS_TURKEY: return SPELL_VISUAL_THROW_TURKEY;
|
||||
case SPELL_PASS_STUFFING: return SPELL_VISUAL_THROW_STUFFING;
|
||||
case SPELL_PASS_PIE: return SPELL_VISUAL_THROW_PIE;
|
||||
case SPELL_PASS_CRANBERRY: return SPELL_VISUAL_THROW_CRANBERRY;
|
||||
case SPELL_PASS_SWEET_POTATO: return SPELL_VISUAL_THROW_SWEET_POTATO;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (Unit* target = GetHitUnit())
|
||||
{
|
||||
// player case
|
||||
if (target->IsVehicle() && target->ToCreature())
|
||||
{
|
||||
if (Player* player = target->GetCharmerOrOwnerPlayerOrPlayerItself())
|
||||
{
|
||||
GetCaster()->CastSpell(player, GetVisualThrow(GetSpellInfo()->Id, true), true);
|
||||
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2, GetVisualThrow(GetSpellInfo()->Id, true));
|
||||
}
|
||||
}
|
||||
// normal case
|
||||
else
|
||||
{
|
||||
if (TempSummon* ts = target->ToTempSummon())
|
||||
if (Unit* owner = ts->GetSummoner())
|
||||
if (owner->GetEntry() == GetCaster()->GetEntry())
|
||||
return;
|
||||
|
||||
GetCaster()->CastSpell(target, GetVisualThrow(GetSpellInfo()->Id, false), true);
|
||||
}
|
||||
}
|
||||
|
||||
// Get chair charmer, passing achievement
|
||||
if (Player* player = GetCaster()->GetCharmerOrOwnerPlayerOrPlayerItself())
|
||||
{
|
||||
uint32 spellId = 0;
|
||||
switch (GetSpellInfo()->Id)
|
||||
{
|
||||
case SPELL_PASS_TURKEY:
|
||||
spellId = SPELL_ACHI_PASS_TURKEY;
|
||||
break;
|
||||
case SPELL_PASS_STUFFING:
|
||||
spellId = SPELL_ACHI_PASS_STUFFING;
|
||||
break;
|
||||
case SPELL_PASS_PIE:
|
||||
spellId = SPELL_ACHI_PASS_PIE;
|
||||
break;
|
||||
case SPELL_PASS_CRANBERRY:
|
||||
spellId = SPELL_ACHI_PASS_CRANBERRY;
|
||||
break;
|
||||
case SPELL_PASS_SWEET_POTATO:
|
||||
spellId = SPELL_ACHI_PASS_SWEET_POTATOES;
|
||||
break;
|
||||
}
|
||||
|
||||
if (spellId)
|
||||
player->CastSpell(player, spellId, true);
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_pilgrims_bounty_pass_generic_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_pilgrims_bounty_pass_generic_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
class spell_pilgrims_bounty_feast_on_generic : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_pilgrims_bounty_feast_on_generic() : SpellScriptLoader("spell_pilgrims_bounty_feast_on_generic") {}
|
||||
|
||||
class spell_pilgrims_bounty_feast_on_generic_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_pilgrims_bounty_feast_on_generic_SpellScript);
|
||||
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Player* player = GetCaster()->GetCharmerOrOwnerPlayerOrPlayerItself();
|
||||
if (!player)
|
||||
return;
|
||||
|
||||
uint32 spellId = 0;
|
||||
switch (GetSpellInfo()->Id)
|
||||
{
|
||||
case SPELL_FEAST_ON_TURKEY:
|
||||
spellId = SPELL_PLAYER_TURKEY;
|
||||
break;
|
||||
case SPELL_FEAST_ON_STUFFING:
|
||||
spellId = SPELL_PLAYER_STUFFING;
|
||||
break;
|
||||
case SPELL_FEAST_ON_PIE:
|
||||
spellId = SPELL_PLAYER_PIE;
|
||||
break;
|
||||
case SPELL_FEAST_ON_CRANBERRY:
|
||||
spellId = SPELL_PLAYER_CRANBERRY;
|
||||
break;
|
||||
case SPELL_FEAST_ON_SWEET_POTATOES:
|
||||
spellId = SPELL_PLAYER_SWEET_POTATOES;
|
||||
break;
|
||||
}
|
||||
|
||||
if (spellId)
|
||||
{
|
||||
player->CastSpell(player, spellId, true);
|
||||
if (AuraEffect* aur = player->GetAuraEffectDummy(spellId))
|
||||
{
|
||||
if (aur->GetBase()->GetStackAmount() >= 5)
|
||||
{
|
||||
switch (spellId)
|
||||
{
|
||||
case SPELL_PLAYER_TURKEY:
|
||||
player->CastSpell(player, SPELL_WELL_FED_TURKEY, true);
|
||||
break;
|
||||
case SPELL_PLAYER_STUFFING:
|
||||
player->CastSpell(player, SPELL_WELL_FED_STUFFING, true);
|
||||
break;
|
||||
case SPELL_PLAYER_PIE:
|
||||
player->CastSpell(player, SPELL_WELL_FED_PIE, true);
|
||||
break;
|
||||
case SPELL_PLAYER_CRANBERRY:
|
||||
player->CastSpell(player, SPELL_WELL_FED_CRANBERRY, true);
|
||||
break;
|
||||
case SPELL_PLAYER_SWEET_POTATOES:
|
||||
player->CastSpell(player, SPELL_WELL_FED_SWEET_POTATOES, true);
|
||||
break;
|
||||
}
|
||||
|
||||
uint8 count = 0;
|
||||
Unit::AuraEffectList const& dummyAuras = player->GetAuraEffectsByType(SPELL_AURA_DUMMY);
|
||||
for (Unit::AuraEffectList::const_iterator i = dummyAuras.begin(); i != dummyAuras.end(); ++i)
|
||||
{
|
||||
if ((*i)->GetId() >= SPELL_PLAYER_CRANBERRY && (*i)->GetId() <= SPELL_PLAYER_PIE)
|
||||
if ((*i)->GetBase()->GetStackAmount() >= 5)
|
||||
++count;
|
||||
}
|
||||
|
||||
// Cast spirit of sharing
|
||||
if (count >= 5)
|
||||
player->CastSpell(player, SPELL_SPIRIT_OF_SHARING, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_pilgrims_bounty_feast_on_generic_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_pilgrims_bounty_feast_on_generic_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
enum tTracker
|
||||
{
|
||||
SPELL_TURKEY_TRACKER = 62014,
|
||||
SPELL_ACHI_TURKINATOR_CREDIT = 62021,
|
||||
};
|
||||
|
||||
class spell_pilgrims_bounty_turkey_tracker : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_pilgrims_bounty_turkey_tracker() : SpellScriptLoader("spell_pilgrims_bounty_turkey_tracker") {}
|
||||
|
||||
class spell_pilgrims_bounty_turkey_tracker_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_pilgrims_bounty_turkey_tracker_SpellScript);
|
||||
|
||||
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (Player* target = GetHitPlayer())
|
||||
if (AuraEffect* aurEff = target->GetAuraEffectDummy(SPELL_TURKEY_TRACKER))
|
||||
{
|
||||
uint32 stackAmount = aurEff->GetBase()->GetStackAmount();
|
||||
switch (stackAmount)
|
||||
{
|
||||
case 10:
|
||||
target->MonsterTextEmote("Turkey Hunter!", target, true);
|
||||
break;
|
||||
case 20:
|
||||
target->MonsterTextEmote("Turkey Domination!", target, true);
|
||||
break;
|
||||
case 30:
|
||||
target->MonsterTextEmote("Turkey Slaughter!", target, true);
|
||||
break;
|
||||
case 40:
|
||||
target->MonsterTextEmote("TURKEY TRIUMPH!", target, true);
|
||||
target->CastSpell(target, SPELL_ACHI_TURKINATOR_CREDIT, true);
|
||||
aurEff->GetBase()->Remove();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_pilgrims_bounty_turkey_tracker_SpellScript::HandleScriptEffect, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_pilgrims_bounty_turkey_tracker_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
class spell_pilgrims_bounty_serve_generic : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_pilgrims_bounty_serve_generic() : SpellScriptLoader("spell_pilgrims_bounty_serve_generic") { }
|
||||
|
||||
class spell_pilgrims_bounty_serve_generic_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_pilgrims_bounty_serve_generic_AuraScript);
|
||||
|
||||
void OnAuraRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
if (target->GetTypeId() == TYPEID_UNIT)
|
||||
target->ToCreature()->AI()->DoAction(GetSpellInfo()->Id);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectRemove += AuraEffectRemoveFn(spell_pilgrims_bounty_serve_generic_AuraScript::OnAuraRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
|
||||
}
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const
|
||||
{
|
||||
return new spell_pilgrims_bounty_serve_generic_AuraScript();
|
||||
}
|
||||
};
|
||||
|
||||
class spell_pilgrims_bounty_food : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_pilgrims_bounty_food() : SpellScriptLoader("spell_pilgrims_bounty_food") { }
|
||||
|
||||
class spell_pilgrims_bounty_food_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_pilgrims_bounty_food_AuraScript);
|
||||
|
||||
void RecalculateHook(AuraEffect const* /*aurEffect*/, int32& amount, bool& canBeRecalculated)
|
||||
{
|
||||
if (GetCaster())
|
||||
{
|
||||
if (GetId() == 66041)
|
||||
amount = CalculatePct(GetCaster()->GetMaxPower(POWER_MANA), 20);
|
||||
else
|
||||
amount = CalculatePct(GetCaster()->GetMaxHealth(), 15);
|
||||
}
|
||||
canBeRecalculated = true;
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
if (m_scriptSpellId == 66041)
|
||||
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pilgrims_bounty_food_AuraScript::RecalculateHook, EFFECT_0, SPELL_AURA_MOD_POWER_REGEN);
|
||||
else if (m_scriptSpellId != 66477)
|
||||
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pilgrims_bounty_food_AuraScript::RecalculateHook, EFFECT_0, SPELL_AURA_MOD_REGEN);
|
||||
}
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const
|
||||
{
|
||||
return new spell_pilgrims_bounty_food_AuraScript();
|
||||
}
|
||||
|
||||
class spell_pilgrims_bounty_food_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_pilgrims_bounty_food_SpellScript);
|
||||
|
||||
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (Unit* target = GetHitUnit())
|
||||
{
|
||||
target->AddAura(sSpellMgr->GetSpellInfo(65422), 1, target);
|
||||
target->CastSpell(target, 66041, true);
|
||||
target->CastSpell(target, 66622, true);
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
if (m_scriptSpellId == 66477)
|
||||
OnEffectHitTarget += SpellEffectFn(spell_pilgrims_bounty_food_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_pilgrims_bounty_food_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
/////////////////////////////
|
||||
// Achievements
|
||||
/////////////////////////////
|
||||
enum pilgrimsPeril
|
||||
{
|
||||
ITEM_PILGRIMS_ROBE = 46824,
|
||||
ITEM_PILGRIMS_ATTIRE = 46800,
|
||||
ITEM_PILGRIMS_DRESS = 44785,
|
||||
ITEM_PILGRIMS_HAT = 46723,
|
||||
};
|
||||
|
||||
class achievement_pb_pilgrims_peril : public AchievementCriteriaScript
|
||||
{
|
||||
public:
|
||||
achievement_pb_pilgrims_peril() : AchievementCriteriaScript("achievement_pb_pilgrims_peril") { }
|
||||
|
||||
bool OnCheck(Player* source, Unit* /*target*/)
|
||||
{
|
||||
if (source->HasItemOrGemWithIdEquipped(ITEM_PILGRIMS_DRESS, 1) || source->HasItemOrGemWithIdEquipped(ITEM_PILGRIMS_ROBE, 1) || source->HasItemOrGemWithIdEquipped(ITEM_PILGRIMS_ATTIRE, 1))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
class achievement_pb_terokkar_turkey_time : public AchievementCriteriaScript
|
||||
{
|
||||
public:
|
||||
achievement_pb_terokkar_turkey_time() : AchievementCriteriaScript("achievement_pb_terokkar_turkey_time") { }
|
||||
|
||||
bool OnCheck(Player* source, Unit* /*target*/)
|
||||
{
|
||||
if (source->HasItemOrGemWithIdEquipped(ITEM_PILGRIMS_HAT, 1) && (source->HasItemOrGemWithIdEquipped(ITEM_PILGRIMS_DRESS, 1) || source->HasItemOrGemWithIdEquipped(ITEM_PILGRIMS_ROBE, 1) || source->HasItemOrGemWithIdEquipped(ITEM_PILGRIMS_ATTIRE, 1)))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_event_pilgrims_end_scripts()
|
||||
{
|
||||
// Spells
|
||||
new spell_pilgrims_bounty_pass_generic();
|
||||
new spell_pilgrims_bounty_feast_on_generic();
|
||||
new spell_pilgrims_bounty_turkey_tracker();
|
||||
new spell_pilgrims_bounty_serve_generic();
|
||||
new spell_pilgrims_bounty_food();
|
||||
|
||||
// Npcs
|
||||
new npc_pilgrims_bounty_chair();
|
||||
new npc_pilgrims_bounty_plate();
|
||||
|
||||
// Achievements
|
||||
new achievement_pb_pilgrims_peril();
|
||||
new achievement_pb_terokkar_turkey_time();
|
||||
}
|
||||
@@ -1,297 +0,0 @@
|
||||
// Scripted by Xinef
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "Spell.h"
|
||||
#include "SpellScript.h"
|
||||
#include "GameEventMgr.h"
|
||||
#include "Player.h"
|
||||
|
||||
|
||||
///////////////////////////////
|
||||
// SPELLS
|
||||
///////////////////////////////
|
||||
|
||||
enum Mistletoe
|
||||
{
|
||||
SPELL_CREATE_MISTLETOE = 26206,
|
||||
SPELL_CREATE_HOLLY = 26207,
|
||||
SPELL_CREATE_SNOWFLAKES = 45036
|
||||
};
|
||||
|
||||
class spell_winter_veil_mistletoe : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_winter_veil_mistletoe() : SpellScriptLoader("spell_winter_veil_mistletoe") { }
|
||||
|
||||
class spell_winter_veil_mistletoe_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_winter_veil_mistletoe_SpellScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*spell*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_CREATE_MISTLETOE) ||
|
||||
!sSpellMgr->GetSpellInfo(SPELL_CREATE_HOLLY) ||
|
||||
!sSpellMgr->GetSpellInfo(SPELL_CREATE_SNOWFLAKES))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleScript(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (Player* target = GetHitPlayer())
|
||||
{
|
||||
uint32 spellId = RAND(SPELL_CREATE_HOLLY, SPELL_CREATE_MISTLETOE, SPELL_CREATE_SNOWFLAKES);
|
||||
GetCaster()->CastSpell(target, spellId, true);
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_winter_veil_mistletoe_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_winter_veil_mistletoe_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
enum winterWondervoltTrap
|
||||
{
|
||||
SPELL_WINTER_WONDERVOLT_GREEN_WOMEN = 26272,
|
||||
SPELL_WINTER_WONDERVOLT_GREEN_MAN = 26157,
|
||||
SPELL_WINTER_WONDERVOLT_RED_WOMEN = 26274,
|
||||
SPELL_WINTER_WONDERVOLT_RED_MAN = 26273,
|
||||
};
|
||||
|
||||
class spell_winter_wondervolt_trap : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_winter_wondervolt_trap() : SpellScriptLoader("spell_winter_wondervolt_trap") {}
|
||||
|
||||
class spell_winter_wondervolt_trap_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_winter_wondervolt_trap_SpellScript);
|
||||
|
||||
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (Player* target = GetHitPlayer())
|
||||
{
|
||||
// check presence
|
||||
if (target->HasAuraType(SPELL_AURA_TRANSFORM))
|
||||
return;
|
||||
|
||||
uint32 spellId = 0;
|
||||
if (target->getGender() == GENDER_MALE)
|
||||
spellId = RAND<uint32>(SPELL_WINTER_WONDERVOLT_RED_MAN, SPELL_WINTER_WONDERVOLT_GREEN_MAN);
|
||||
else
|
||||
spellId = RAND<uint32>(SPELL_WINTER_WONDERVOLT_RED_WOMEN, SPELL_WINTER_WONDERVOLT_GREEN_WOMEN);
|
||||
|
||||
// cast
|
||||
target->CastSpell(target, spellId, true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_winter_wondervolt_trap_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_winter_wondervolt_trap_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
enum crashinTrashin
|
||||
{
|
||||
SPELL_BLUE_CAR_VISUAL = 75110,
|
||||
SPELL_RED_CAR_VISUAL = 49384,
|
||||
NPC_RED_RACER = 27664,
|
||||
NPC_BLUE_RACER = 40281,
|
||||
|
||||
SPELL_RACER_DEATH_VISUAL = 49337,
|
||||
SPELL_RACER_CHARGE_TO_OBJECT = 49302,
|
||||
SPELL_RACER_KILL_COUNTER = 49444,
|
||||
SPELL_RACER_SLAM_HIT = 49324,
|
||||
SPELL_RACER_FLAMES = 49328,
|
||||
|
||||
RACER_ACHI_CRITERIA = 4090,
|
||||
};
|
||||
|
||||
class spell_winter_veil_racer_rocket_slam : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_winter_veil_racer_rocket_slam() : SpellScriptLoader("spell_winter_veil_racer_rocket_slam") {}
|
||||
|
||||
class spell_winter_veil_racer_rocket_slam_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_winter_veil_racer_rocket_slam_SpellScript);
|
||||
|
||||
void HandleTriggerSpell(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
PreventHitEffect(EFFECT_0);
|
||||
PreventHitEffect(EFFECT_1);
|
||||
|
||||
std::list<Creature*> unitList;
|
||||
Unit* target = NULL;
|
||||
caster->GetCreaturesWithEntryInRange(unitList, 30.0f, NPC_BLUE_RACER);
|
||||
if (!unitList.empty())
|
||||
for (std::list<Creature*>::const_iterator itr = unitList.begin(); itr != unitList.end(); ++itr)
|
||||
if (caster->HasInLine((*itr), 1.0f) && (*itr)->GetGUID() != caster->GetGUID())
|
||||
{
|
||||
target = (*itr);
|
||||
break;
|
||||
}
|
||||
if (!target)
|
||||
{
|
||||
unitList.clear();
|
||||
caster->GetCreaturesWithEntryInRange(unitList, 30.0f, NPC_RED_RACER);
|
||||
if (!unitList.empty())
|
||||
for (std::list<Creature*>::const_iterator itr = unitList.begin(); itr != unitList.end(); ++itr)
|
||||
if (caster->HasInLine((*itr), 1.0f) && (*itr)->GetGUID() != caster->GetGUID())
|
||||
{
|
||||
target = (*itr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (target)
|
||||
{
|
||||
caster->CastSpell(target, SPELL_RACER_CHARGE_TO_OBJECT, true);
|
||||
caster->CastSpell(target, SPELL_RACER_SLAM_HIT, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
Position pos;
|
||||
float x = caster->GetPositionX()+30*cos(caster->GetOrientation());
|
||||
float y = caster->GetPositionY()+30*sin(caster->GetOrientation());
|
||||
pos.Relocate(x, y, caster->GetMap()->GetHeight(x, y, MAX_HEIGHT)+0.5f);
|
||||
//caster->GetFirstCollisionPosition(pos, 30.0f, caster->GetOrientation());
|
||||
caster->CastSpell(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), SPELL_RACER_CHARGE_TO_OBJECT, true);
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectLaunch += SpellEffectFn(spell_winter_veil_racer_rocket_slam_SpellScript::HandleTriggerSpell, EFFECT_1, SPELL_EFFECT_TRIGGER_SPELL);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_winter_veil_racer_rocket_slam_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
class spell_winter_veil_racer_slam_hit : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_winter_veil_racer_slam_hit() : SpellScriptLoader("spell_winter_veil_racer_slam_hit") {}
|
||||
|
||||
class spell_winter_veil_racer_slam_hit_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_winter_veil_racer_slam_hit_SpellScript);
|
||||
|
||||
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
Creature* target = GetHitCreature();
|
||||
if (!target || caster == target)
|
||||
return;
|
||||
|
||||
target->CastSpell(target->GetPositionX()+irand(-10, 10), target->GetPositionY()+irand(-10, 10), target->GetPositionZ() , SPELL_RACER_DEATH_VISUAL, true);
|
||||
target->DespawnOrUnsummon(3000);
|
||||
target->CastSpell(target, SPELL_RACER_FLAMES, true);
|
||||
caster->CastSpell(caster, SPELL_RACER_KILL_COUNTER, true);
|
||||
|
||||
if (Player* targetSummoner = target->GetCharmerOrOwnerPlayerOrPlayerItself())
|
||||
{
|
||||
//targetSummoner->RemoveCriteriaProgress(sAchievementCriteriaStore.LookupEntry(RACER_ACHI_CRITERIA)); !ZOMG, ADD ACCESSOR
|
||||
targetSummoner->RemoveAurasDueToSpell(SPELL_RACER_KILL_COUNTER);
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_winter_veil_racer_slam_hit_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_winter_veil_racer_slam_hit_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
enum airRifle
|
||||
{
|
||||
SPELL_AIR_RIFLE_RIGHT_IN_THE_EYE = 65577,
|
||||
SPELL_AIR_RIFLE_STARLED = 61862,
|
||||
SPELL_AIR_RIFLE_HIT = 61866,
|
||||
SPELL_AIR_RIFLE_HIT_TRIGGER = 65576,
|
||||
SPELL_AIR_RIFLE_PELTED_DAMAGE = 67531,
|
||||
};
|
||||
|
||||
class spell_winter_veil_shoot_air_rifle : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_winter_veil_shoot_air_rifle() : SpellScriptLoader("spell_winter_veil_shoot_air_rifle") {}
|
||||
|
||||
class spell_winter_veil_shoot_air_rifle_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_winter_veil_shoot_air_rifle_SpellScript);
|
||||
|
||||
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Unit* caster = GetOriginalCaster();
|
||||
Unit* target = GetHitUnit();
|
||||
if (!target)
|
||||
return;
|
||||
|
||||
if (GetSpellInfo()->Id == SPELL_AIR_RIFLE_HIT_TRIGGER)
|
||||
{
|
||||
if (!caster->IsFriendlyTo(target))
|
||||
caster->CastSpell(target, SPELL_AIR_RIFLE_PELTED_DAMAGE, true, NULL, NULL, caster->GetGUID());
|
||||
}
|
||||
else
|
||||
{
|
||||
uint8 rand = urand(0, 99);
|
||||
if (rand < 15)
|
||||
caster->CastSpell(caster, SPELL_AIR_RIFLE_RIGHT_IN_THE_EYE, true, NULL, NULL, caster->GetGUID());
|
||||
else if (rand < 35)
|
||||
caster->CastSpell(target, SPELL_AIR_RIFLE_STARLED, true, NULL, NULL, caster->GetGUID());
|
||||
else
|
||||
caster->CastSpell(target, SPELL_AIR_RIFLE_HIT, true, NULL, NULL, caster->GetGUID());
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
if (m_scriptSpellId == SPELL_AIR_RIFLE_HIT_TRIGGER)
|
||||
OnEffectHitTarget += SpellEffectFn(spell_winter_veil_shoot_air_rifle_SpellScript::HandleScriptEffect, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
else
|
||||
OnEffectHitTarget += SpellEffectFn(spell_winter_veil_shoot_air_rifle_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_winter_veil_shoot_air_rifle_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_event_winter_veil_scripts()
|
||||
{
|
||||
// Spells
|
||||
new spell_winter_veil_mistletoe();
|
||||
new spell_winter_wondervolt_trap();
|
||||
new spell_winter_veil_racer_rocket_slam();
|
||||
new spell_winter_veil_racer_slam_hit();
|
||||
new spell_winter_veil_shoot_air_rifle();
|
||||
}
|
||||
Reference in New Issue
Block a user