refactor(Core/Scripts): restyle scripts lib with astyle (#3467)

This commit is contained in:
Kargatum
2020-10-11 15:35:34 +07:00
committed by GitHub
parent 4cca286a4d
commit 5e20b46812
538 changed files with 92888 additions and 91297 deletions

View File

@@ -39,7 +39,7 @@ public:
}
};
CreatureAI *GetAI(Creature* creature) const
CreatureAI* GetAI(Creature* creature) const
{
return new npc_brewfest_revelerAI(creature);
}
@@ -96,7 +96,7 @@ public:
switch (uiAction)
{
case GOSSIP_ACTION_INFO_DEF+1:
AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_ITEM_COREN2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2);
AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_ITEM_COREN2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
SendGossipMenuFor(player, 15859, creature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+2:
@@ -113,7 +113,7 @@ public:
if (creature->IsQuestGiver())
player->PrepareQuestMenu(creature->GetGUID());
AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_ITEM_COREN1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_ITEM_COREN1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
SendGossipMenuFor(player, 15858, creature->GetGUID());
return true;
@@ -145,8 +145,8 @@ public:
for (int i = 0; i < 3; ++i)
{
float o = rand_norm()*2*M_PI;
if ((cr = me->SummonCreature(NPC_ANTAGONIST, me->GetPositionX()+3*cos(o), me->GetPositionY()+3*sin(o), me->GetPositionZ(), me->GetOrientation())))
float o = rand_norm() * 2 * M_PI;
if ((cr = me->SummonCreature(NPC_ANTAGONIST, me->GetPositionX() + 3 * cos(o), me->GetPositionY() + 3 * sin(o), me->GetPositionZ(), me->GetOrientation())))
{
if (i == 0)
cr->MonsterSay("Time to die.", LANG_UNIVERSAL, 0);
@@ -156,7 +156,7 @@ public:
}
}
me->CastSpell(me, SPELL_PURPLE_VISUAL , true);
me->CastSpell(me, SPELL_PURPLE_VISUAL, true);
me->setFaction(FACTION_HOSTILE);
me->SetInCombatWithZone();
events.ScheduleEvent(EVENT_DIREBREW_DISARM, 10000);
@@ -194,10 +194,10 @@ public:
void SummonSister(uint32 entry)
{
summons.DespawnEntry(entry);
float o = rand_norm()*2*M_PI;
if (Creature* cr = me->SummonCreature(entry, me->GetPositionX()+3*cos(o), me->GetPositionY()+3*sin(o), me->GetPositionZ(), me->GetOrientation()))
float o = rand_norm() * 2 * M_PI;
if (Creature* cr = me->SummonCreature(entry, me->GetPositionX() + 3 * cos(o), me->GetPositionY() + 3 * sin(o), me->GetPositionZ(), me->GetOrientation()))
{
cr->CastSpell(cr, SPELL_PURPLE_VISUAL , true);
cr->CastSpell(cr, SPELL_PURPLE_VISUAL, true);
cr->SetInCombatWithZone();
summons.Summon(cr);
}
@@ -431,16 +431,16 @@ public:
player->DestroyItemCount(ITEM_PORTABLE_BREWFEST_KEG, 1, true);
// Additional Work
uint32 spellCooldown = player->GetSpellCooldownDelay(SPELL_COOLDOWN_CHECKER)/IN_MILLISECONDS;
if (spellCooldown > (HOUR*18 - 900)) // max aproximated time - 12 minutes
uint32 spellCooldown = player->GetSpellCooldownDelay(SPELL_COOLDOWN_CHECKER) / IN_MILLISECONDS;
if (spellCooldown > (HOUR * 18 - 900)) // max aproximated time - 12 minutes
{
if (Aura* aur = player->GetAura(SPELL_RAM_AURA))
{
int32 diff = aur->GetApplyTime() - (time(nullptr)-(HOUR*18)+spellCooldown);
int32 diff = aur->GetApplyTime() - (time(nullptr) - (HOUR * 18) + spellCooldown);
if (diff > 10) // aura applied later
return;
aur->SetDuration(aur->GetDuration()+30000);
aur->SetDuration(aur->GetDuration() + 30000);
player->CastSpell(player, SPELL_ADD_TOKENS, true);
}
}
@@ -460,7 +460,7 @@ public:
{
case GOSSIP_ACTION_INFO_DEF+1:
CloseGossipMenuFor(player);
player->AddSpellCooldown(SPELL_COOLDOWN_CHECKER, 0, 18*HOUR*IN_MILLISECONDS);
player->AddSpellCooldown(SPELL_COOLDOWN_CHECKER, 0, 18 * HOUR * IN_MILLISECONDS);
player->CastSpell(player, 43883, true);
player->CastSpell(player, 44262, true);
break;
@@ -474,7 +474,7 @@ public:
player->PrepareQuestMenu(creature->GetGUID());
if (!player->HasSpellCooldown(SPELL_COOLDOWN_CHECKER) && player->GetQuestRewardStatus(player->GetTeamId() == TEAM_ALLIANCE ? QUEST_THERE_AND_BACK_AGAIN_A : QUEST_THERE_AND_BACK_AGAIN_H))
AddGossipItemFor(player, GOSSIP_ICON_CHAT, "Do you have additional work?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
AddGossipItemFor(player, GOSSIP_ICON_CHAT, "Do you have additional work?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
SendGossipMenuFor(player, (creature->GetEntry() == NPC_NEILL_RAMSTEIN ? 8934 : 8976), creature->GetGUID());
return true;
@@ -491,121 +491,121 @@ enum barkTrigger
class npc_brewfest_bark_trigger : public CreatureScript
{
public:
npc_brewfest_bark_trigger() : CreatureScript("npc_brewfest_bark_trigger") { }
public:
npc_brewfest_bark_trigger() : CreatureScript("npc_brewfest_bark_trigger") { }
struct npc_brewfest_bark_triggerAI : public ScriptedAI
struct npc_brewfest_bark_triggerAI : public ScriptedAI
{
npc_brewfest_bark_triggerAI(Creature* creature) : ScriptedAI(creature)
{
npc_brewfest_bark_triggerAI(Creature* creature) : ScriptedAI(creature)
{
}
void MoveInLineOfSight(Unit* who)
{
if (me->GetDistance(who) < 10.0f && who->GetTypeId() == TYPEID_PLAYER && who->GetMountID() == RAM_DISPLAY_ID)
{
bool allow = false;
uint32 quest = 0;
Player* player = who->ToPlayer();
// Kalimdor
if (me->GetMapId() == 1)
{
if (player->GetQuestStatus(QUEST_BARK_FOR_DROHN) == QUEST_STATUS_INCOMPLETE)
{
allow = true;
quest = QUEST_BARK_FOR_DROHN;
}
else if (player->GetQuestStatus(QUEST_BARK_FOR_VOODOO) == QUEST_STATUS_INCOMPLETE)
{
allow = true;
quest = QUEST_BARK_FOR_VOODOO;
}
}
else if (me->GetMapId() == 0)
{
if (player->GetQuestStatus(QUEST_BARK_FOR_BARLEY) == QUEST_STATUS_INCOMPLETE)
{
allow = true;
quest = QUEST_BARK_FOR_BARLEY;
}
else if (player->GetQuestStatus(QUEST_BARK_FOR_THUNDERBREW) == QUEST_STATUS_INCOMPLETE)
{
allow = true;
quest = QUEST_BARK_FOR_THUNDERBREW;
}
}
if (allow)
{
QuestStatusMap::iterator itr = player->getQuestStatusMap().find(quest);
if (itr == player->getQuestStatusMap().end())
return;
QuestStatusData &q_status = itr->second;
if (q_status.CreatureOrGOCount[me->GetEntry()-24202] == 0)
{
player->KilledMonsterCredit(me->GetEntry(), 0);
player->MonsterSay(GetTextFor(me->GetEntry(), quest).c_str(), LANG_UNIVERSAL, player);
}
}
}
}
std::string GetTextFor(uint32 /*entry*/, uint32 questId)
{
std::string str = "";
switch (questId)
{
case QUEST_BARK_FOR_DROHN:
case QUEST_BARK_FOR_VOODOO:
{
switch (urand(0,3))
{
case 0:
str = "Join with your brothers and sisters at "+ std::string(questId == QUEST_BARK_FOR_DROHN ? "Drohn's Distillery" : "T'chali's Voodoo Brewery") +" and drink for the horde!";
break;
case 1:
str = "If you think an orc can hit hard, check out their brew, it hits even harder! See for yourself at "+ std::string(questId == QUEST_BARK_FOR_DROHN ? "Drohn's Distillery" : "T'chali's Voodoo Brewery") +", only at Brewfest!";
break;
case 2:
str = "Celebrate Brewfest with orcs that know what a good drink really is! Check out "+ std::string(questId == QUEST_BARK_FOR_DROHN ? "Drohn's Distillery" : "T'chali's Voodoo Brewery") +" at Brewfest!";
break;
case 3:
str = std::string(questId == QUEST_BARK_FOR_DROHN ? "Drohn's Distillery" : "T'chali's Voodoo Brewery") +" knows how to party hard! Check them out at Brewfest!";
break;
}
break;
}
case QUEST_BARK_FOR_BARLEY:
case QUEST_BARK_FOR_THUNDERBREW:
{
switch (urand(0,3))
{
case 0:
str = "Join with your brothers and sisters at "+ std::string(questId == QUEST_BARK_FOR_BARLEY ? "Barleybrews" : "Thunderbrews") +" and drink for the alliance!";
break;
case 1:
str = "If you think an dwarf can hit hard, check out their brew, it hits even harder! See for yourself at "+ std::string(questId == QUEST_BARK_FOR_BARLEY ? "Barleybrews" : "Thunderbrews") +", only at Brewfest!";
break;
case 2:
str = "Celebrate Brewfest with dwarves that know what a good drink really is! Check out "+ std::string(questId == QUEST_BARK_FOR_BARLEY ? "Barleybrews" : "Thunderbrews") +" at Brewfest!";
break;
case 3:
str = std::string(questId == QUEST_BARK_FOR_BARLEY ? "Barleybrews" : "Thunderbrews") +" knows how to party hard! Check them out at Brewfest!";
break;
}
break;
}
}
return str;
}
};
CreatureAI* GetAI(Creature* creature) const
{
return new npc_brewfest_bark_triggerAI(creature);
}
void MoveInLineOfSight(Unit* who)
{
if (me->GetDistance(who) < 10.0f && who->GetTypeId() == TYPEID_PLAYER && who->GetMountID() == RAM_DISPLAY_ID)
{
bool allow = false;
uint32 quest = 0;
Player* player = who->ToPlayer();
// Kalimdor
if (me->GetMapId() == 1)
{
if (player->GetQuestStatus(QUEST_BARK_FOR_DROHN) == QUEST_STATUS_INCOMPLETE)
{
allow = true;
quest = QUEST_BARK_FOR_DROHN;
}
else if (player->GetQuestStatus(QUEST_BARK_FOR_VOODOO) == QUEST_STATUS_INCOMPLETE)
{
allow = true;
quest = QUEST_BARK_FOR_VOODOO;
}
}
else if (me->GetMapId() == 0)
{
if (player->GetQuestStatus(QUEST_BARK_FOR_BARLEY) == QUEST_STATUS_INCOMPLETE)
{
allow = true;
quest = QUEST_BARK_FOR_BARLEY;
}
else if (player->GetQuestStatus(QUEST_BARK_FOR_THUNDERBREW) == QUEST_STATUS_INCOMPLETE)
{
allow = true;
quest = QUEST_BARK_FOR_THUNDERBREW;
}
}
if (allow)
{
QuestStatusMap::iterator itr = player->getQuestStatusMap().find(quest);
if (itr == player->getQuestStatusMap().end())
return;
QuestStatusData& q_status = itr->second;
if (q_status.CreatureOrGOCount[me->GetEntry() - 24202] == 0)
{
player->KilledMonsterCredit(me->GetEntry(), 0);
player->MonsterSay(GetTextFor(me->GetEntry(), quest).c_str(), LANG_UNIVERSAL, player);
}
}
}
}
std::string GetTextFor(uint32 /*entry*/, uint32 questId)
{
std::string str = "";
switch (questId)
{
case QUEST_BARK_FOR_DROHN:
case QUEST_BARK_FOR_VOODOO:
{
switch (urand(0, 3))
{
case 0:
str = "Join with your brothers and sisters at " + std::string(questId == QUEST_BARK_FOR_DROHN ? "Drohn's Distillery" : "T'chali's Voodoo Brewery") + " and drink for the horde!";
break;
case 1:
str = "If you think an orc can hit hard, check out their brew, it hits even harder! See for yourself at " + std::string(questId == QUEST_BARK_FOR_DROHN ? "Drohn's Distillery" : "T'chali's Voodoo Brewery") + ", only at Brewfest!";
break;
case 2:
str = "Celebrate Brewfest with orcs that know what a good drink really is! Check out " + std::string(questId == QUEST_BARK_FOR_DROHN ? "Drohn's Distillery" : "T'chali's Voodoo Brewery") + " at Brewfest!";
break;
case 3:
str = std::string(questId == QUEST_BARK_FOR_DROHN ? "Drohn's Distillery" : "T'chali's Voodoo Brewery") + " knows how to party hard! Check them out at Brewfest!";
break;
}
break;
}
case QUEST_BARK_FOR_BARLEY:
case QUEST_BARK_FOR_THUNDERBREW:
{
switch (urand(0, 3))
{
case 0:
str = "Join with your brothers and sisters at " + std::string(questId == QUEST_BARK_FOR_BARLEY ? "Barleybrews" : "Thunderbrews") + " and drink for the alliance!";
break;
case 1:
str = "If you think an dwarf can hit hard, check out their brew, it hits even harder! See for yourself at " + std::string(questId == QUEST_BARK_FOR_BARLEY ? "Barleybrews" : "Thunderbrews") + ", only at Brewfest!";
break;
case 2:
str = "Celebrate Brewfest with dwarves that know what a good drink really is! Check out " + std::string(questId == QUEST_BARK_FOR_BARLEY ? "Barleybrews" : "Thunderbrews") + " at Brewfest!";
break;
case 3:
str = std::string(questId == QUEST_BARK_FOR_BARLEY ? "Barleybrews" : "Thunderbrews") + " knows how to party hard! Check them out at Brewfest!";
break;
}
break;
}
}
return str;
}
};
CreatureAI* GetAI(Creature* creature) const
{
return new npc_brewfest_bark_triggerAI(creature);
}
};
enum darkIronAttack
@@ -706,79 +706,79 @@ public:
switch (events.GetEvent())
{
case EVENT_CHECK_HOUR:
{
// determine hour
if (AllowStart())
{
PrepareEvent();
events.RepeatEvent(300000);
return;
// determine hour
if (AllowStart())
{
PrepareEvent();
events.RepeatEvent(300000);
return;
}
events.RepeatEvent(2000);
break;
}
events.RepeatEvent(2000);
break;
}
case EVENT_SPAWN_MOLE_MACHINE:
{
if (me->GetMapId() == 1) // Kalimdor
{
float rand = 8+rand_norm()*12;
float angle = rand_norm()*2*M_PI;
float x = 1201.8f+rand*cos(angle);
float y = -4299.6f+rand*sin(angle);
if (Creature* cr = me->SummonCreature(NPC_MOLE_MACHINE_TRIGGER, x, y, 21.3f, 0.0f))
cr->CastSpell(cr, SPELL_SPAWN_MOLE_MACHINE, true);
if (me->GetMapId() == 1) // Kalimdor
{
float rand = 8 + rand_norm() * 12;
float angle = rand_norm() * 2 * M_PI;
float x = 1201.8f + rand * cos(angle);
float y = -4299.6f + rand * sin(angle);
if (Creature* cr = me->SummonCreature(NPC_MOLE_MACHINE_TRIGGER, x, y, 21.3f, 0.0f))
cr->CastSpell(cr, SPELL_SPAWN_MOLE_MACHINE, true);
}
else if (me->GetMapId() == 0) // EK
{
float rand = rand_norm() * 20;
float angle = rand_norm() * 2 * M_PI;
float x = -5157.1f + rand * cos(angle);
float y = -598.98f + rand * sin(angle);
if (Creature* cr = me->SummonCreature(NPC_MOLE_MACHINE_TRIGGER, x, y, 398.11f, 0.0f))
cr->CastSpell(cr, SPELL_SPAWN_MOLE_MACHINE, true);
}
events.RepeatEvent(3000);
break;
}
else if (me->GetMapId() == 0) // EK
{
float rand = rand_norm()*20;
float angle = rand_norm()*2*M_PI;
float x = -5157.1f+rand*cos(angle);
float y = -598.98f+rand*sin(angle);
if (Creature* cr = me->SummonCreature(NPC_MOLE_MACHINE_TRIGGER, x, y, 398.11f, 0.0f))
cr->CastSpell(cr, SPELL_SPAWN_MOLE_MACHINE, true);
}
events.RepeatEvent(3000);
break;
}
case EVENT_PRE_FINISH_ATTACK:
{
events.CancelEvent(EVENT_SPAWN_MOLE_MACHINE);
events.ScheduleEvent(EVENT_FINISH_ATTACK, 20000);
events.PopEvent();
break;
}
{
events.CancelEvent(EVENT_SPAWN_MOLE_MACHINE);
events.ScheduleEvent(EVENT_FINISH_ATTACK, 20000);
events.PopEvent();
break;
}
case EVENT_FINISH_ATTACK:
{
FinishAttackDueToWin();
events.RescheduleEvent(EVENT_CHECK_HOUR, 60000);
break;
}
{
FinishAttackDueToWin();
events.RescheduleEvent(EVENT_CHECK_HOUR, 60000);
break;
}
case EVENT_BARTENDER_SAY:
{
events.RepeatEvent(12000);
Creature* sayer = GetRandomBartender();
if (!sayer)
return;
thrown++;
if (thrown == 3)
{
thrown = 0;
sayer->MonsterSay("SOMEONE TRY THIS SUPER BREW!", LANG_UNIVERSAL, 0);
//sayer->CastSpell(sayer, SPELL_CREATE_SUPER_BREW, true);
sayer->SummonCreature(NPC_SUPER_BREW_TRIGGER, sayer->GetPositionX()+15*cos(sayer->GetOrientation()), sayer->GetPositionY()+15*sin(sayer->GetOrientation()), sayer->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000);
events.RepeatEvent(12000);
Creature* sayer = GetRandomBartender();
if (!sayer)
return;
}
else
{
if (urand(0,1))
sayer->MonsterSay("Chug and chuck! Chug and chuck!", LANG_UNIVERSAL, 0);
thrown++;
if (thrown == 3)
{
thrown = 0;
sayer->MonsterSay("SOMEONE TRY THIS SUPER BREW!", LANG_UNIVERSAL, 0);
//sayer->CastSpell(sayer, SPELL_CREATE_SUPER_BREW, true);
sayer->SummonCreature(NPC_SUPER_BREW_TRIGGER, sayer->GetPositionX() + 15 * cos(sayer->GetOrientation()), sayer->GetPositionY() + 15 * sin(sayer->GetOrientation()), sayer->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000);
}
else
sayer->MonsterSay("Down the free brew and pelt the Guzzlers with your mug!", LANG_UNIVERSAL, 0);
}
{
if (urand(0, 1))
sayer->MonsterSay("Chug and chuck! Chug and chuck!", LANG_UNIVERSAL, 0);
else
sayer->MonsterSay("Down the free brew and pelt the Guzzlers with your mug!", LANG_UNIVERSAL, 0);
}
break;
}
break;
}
}
}
@@ -857,7 +857,7 @@ public:
Creature* GetRandomBartender()
{
uint32 entry = 0;
switch (urand(0,2))
switch (urand(0, 2))
{
case 0:
entry = (me->GetMapId() == 1 ? NPC_NORMAL_DROHN : NPC_NORMAL_THUNDERBREW);
@@ -911,7 +911,7 @@ public:
{
goTimer = 0;
summonTimer++;
if (GameObject* drill = me->SummonGameObject(GO_MOLE_MACHINE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), M_PI/4, 0.0f, 0.0f, 0.0f, 0.0f, 8))
if (GameObject* drill = me->SummonGameObject(GO_MOLE_MACHINE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), M_PI / 4, 0.0f, 0.0f, 0.0f, 0.0f, 8))
{
//drill->SetGoAnimProgress(0);
drill->SetLootState(GO_READY);
@@ -961,7 +961,7 @@ public:
void MoveInLineOfSight(Unit*) {}
void AttackStart(Unit*) {}
void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask)
void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask)
{
damage = 0;
}
@@ -986,9 +986,9 @@ public:
for (uint8 i = 0; i < 3; ++i)
{
uint8 index=0;
uint8 index = 0;
do
index = urand(0,2);
index = urand(0, 2);
while (shuffled[index]);
shuffled[index] = entry[i];
@@ -1021,9 +1021,9 @@ public:
void SayText()
{
if (!urand(0,20))
if (!urand(0, 20))
{
switch (urand(0,4))
switch (urand(0, 4))
{
case 0:
me->MonsterSay("Drink it all boys!", LANG_UNIVERSAL, 0);
@@ -1204,65 +1204,65 @@ public:
uint8 mode = 0;
switch (privateLevel)
{
case 0:
if (stack > 1)
{
questTick = 0;
caster->CastSpell(caster, SPELL_TROT, true);
privateLevel++;
mode = 1; // unapply
case 0:
if (stack > 1)
{
questTick = 0;
caster->CastSpell(caster, SPELL_TROT, true);
privateLevel++;
mode = 1; // unapply
break;
}
// just walking, fatiuge handling
if (Aura* aur = caster->GetAura(SPELL_RAM_FATIGUE))
aur->ModStackAmount(-4);
break;
case 1:
// One click to maintain speed, more to increase
if (stack < 2)
{
caster->RemoveAurasDueToSpell(SPELL_TROT);
questTick = 0;
privateLevel--;
mode = 2; // apply
}
else if (stack > 2)
{
questTick = 0;
caster->CastSpell(caster, SPELL_CANTER, true);
privateLevel++;
}
else if (questTick++ > 3)
caster->ToPlayer()->KilledMonsterCredit(CREDIT_TROT, 0);
break;
case 2:
// Two - three clicks to maintains speed, less to decrease, more to increase
if (stack < 3)
{
caster->CastSpell(caster, SPELL_TROT, true);
privateLevel--;
questTick = 0;
}
else if (stack > 4)
{
caster->CastSpell(caster, SPELL_GALLOP, true);
privateLevel++;
questTick = 0;
}
else if (questTick++ > 3)
caster->ToPlayer()->KilledMonsterCredit(CREDIT_CANTER, 0);
break;
case 3:
// Four or more clicks to maintains speed, less to decrease
if (stack < 5)
{
caster->CastSpell(caster, SPELL_CANTER, true);
privateLevel--;
questTick = 0;
}
else if (questTick++ > 3)
caster->ToPlayer()->KilledMonsterCredit(CREDIT_GALLOP, 0);
break;
}
// just walking, fatiuge handling
if (Aura* aur = caster->GetAura(SPELL_RAM_FATIGUE))
aur->ModStackAmount(-4);
break;
case 1:
// One click to maintain speed, more to increase
if (stack < 2)
{
caster->RemoveAurasDueToSpell(SPELL_TROT);
questTick = 0;
privateLevel--;
mode = 2; // apply
}
else if (stack > 2)
{
questTick = 0;
caster->CastSpell(caster, SPELL_CANTER, true);
privateLevel++;
}
else if (questTick++ > 3)
caster->ToPlayer()->KilledMonsterCredit(CREDIT_TROT, 0);
break;
case 2:
// Two - three clicks to maintains speed, less to decrease, more to increase
if (stack < 3)
{
caster->CastSpell(caster, SPELL_TROT, true);
privateLevel--;
questTick = 0;
}
else if (stack > 4)
{
caster->CastSpell(caster, SPELL_GALLOP, true);
privateLevel++;
questTick = 0;
}
else if (questTick++ > 3)
caster->ToPlayer()->KilledMonsterCredit(CREDIT_CANTER, 0);
break;
case 3:
// Four or more clicks to maintains speed, less to decrease
if (stack < 5)
{
caster->CastSpell(caster, SPELL_CANTER, true);
privateLevel--;
questTick = 0;
}
else if (questTick++ > 3)
caster->ToPlayer()->KilledMonsterCredit(CREDIT_GALLOP, 0);
break;
}
// Set to base amount
@@ -1311,15 +1311,15 @@ public:
int8 fatigue = 0;
switch (aurEff->GetId())
{
case SPELL_TROT:
fatigue = -2;
break;
case SPELL_CANTER:
fatigue = 1;
break;
case SPELL_GALLOP:
fatigue = 5;
break;
case SPELL_TROT:
fatigue = -2;
break;
case SPELL_CANTER:
fatigue = 1;
break;
case SPELL_GALLOP:
fatigue = 5;
break;
}
if (Unit* target = GetTarget())
{
@@ -1458,11 +1458,11 @@ public:
{
case GREEN_EMPTY_KEG:
case BLUE_EMPTY_KEG:
item = itemCaster->GetEntry()+urand(1,5); // 5 items, id in range empty+1-5
item = itemCaster->GetEntry() + urand(1, 5); // 5 items, id in range empty+1-5
break;
case YELLOW_EMPTY_KEG:
if (uint8 num = urand(0,4))
item = 32916+num;
if (uint8 num = urand(0, 4))
item = 32916 + num;
else
item = 32915;
break;
@@ -1570,8 +1570,8 @@ public:
{
if (Unit* caster = GetCaster())
{
float z = caster->GetMap()->GetHeight(caster->GetPositionX()+14*cos(caster->GetOrientation()), caster->GetPositionY()+14*sin(caster->GetOrientation()), MAX_HEIGHT);
WorldLocation pPosition = WorldLocation(caster->GetMapId(), caster->GetPositionX()+14*cos(caster->GetOrientation()), caster->GetPositionY()+14*sin(caster->GetOrientation()), z, caster->GetOrientation());
float z = caster->GetMap()->GetHeight(caster->GetPositionX() + 14 * cos(caster->GetOrientation()), caster->GetPositionY() + 14 * sin(caster->GetOrientation()), MAX_HEIGHT);
WorldLocation pPosition = WorldLocation(caster->GetMapId(), caster->GetPositionX() + 14 * cos(caster->GetOrientation()), caster->GetPositionY() + 14 * sin(caster->GetOrientation()), z, caster->GetOrientation());
SetExplTargetDest(pPosition);
}
@@ -1606,7 +1606,7 @@ public:
if (!GetCaster() || target->GetGUID() == GetCaster()->GetGUID())
return;
WorldLocation pPosition = WorldLocation(target->GetMapId(), target->GetPositionX(), target->GetPositionY(), target->GetPositionZ()+4.0f, target->GetOrientation());
WorldLocation pPosition = WorldLocation(target->GetMapId(), target->GetPositionX(), target->GetPositionY(), target->GetPositionZ() + 4.0f, target->GetOrientation());
SetExplTargetDest(pPosition);
}
}
@@ -1725,7 +1725,7 @@ public:
if (stacksMe >= stacksTarget)
{
if (Aura* aura = me->GetAura(SPELL_BUBBLE_BUILD_UP))
aura->ModStackAmount(stacksTarget+1);
aura->ModStackAmount(stacksTarget + 1);
else
me->AddAura(SPELL_BUBBLE_BUILD_UP, me);

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

View File

@@ -32,168 +32,168 @@ public:
class npc_midsummer_bonfire : public CreatureScript
{
public:
npc_midsummer_bonfire() : CreatureScript("npc_midsummer_bonfire") { }
public:
npc_midsummer_bonfire() : CreatureScript("npc_midsummer_bonfire") { }
struct npc_midsummer_bonfireAI : public ScriptedAI
struct npc_midsummer_bonfireAI : public ScriptedAI
{
npc_midsummer_bonfireAI(Creature* c) : ScriptedAI(c)
{
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))
{
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);
}
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);
}
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") { }
public:
npc_midsummer_torch_target() : CreatureScript("npc_midsummer_torch_target") { }
struct npc_midsummer_torch_targetAI : public ScriptedAI
struct npc_midsummer_torch_targetAI : public ScriptedAI
{
npc_midsummer_torch_targetAI(Creature* c) : ScriptedAI(c)
{
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);
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);
}
};
@@ -274,10 +274,10 @@ public:
{
PrepareAuraScript(spell_midsummer_ribbon_pole_AuraScript)
void HandleEffectPeriodic(AuraEffect const * /*aurEff*/)
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
{
PreventDefaultAction();
if (Unit *target = GetTarget())
if (Unit* target = GetTarget())
{
Creature* cr = target->FindNearestCreature(NPC_RIBBON_POLE_DEBUG_TARGET, 10.0f);
if (!cr)
@@ -288,15 +288,15 @@ public:
}
if (Aura* aur = target->GetAura(SPELL_RIBBON_POLE_XP))
aur->SetDuration(std::min(aur->GetDuration()+3*MINUTE*IN_MILLISECONDS, 60*MINUTE*IN_MILLISECONDS));
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->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);
cr->Relocate(cr->GetPositionX(), cr->GetPositionY(), cr->GetPositionZ() + 6.5f);
}
// Achievement
@@ -382,7 +382,7 @@ enum flingTorch
class spell_midsummer_fling_torch : public SpellScriptLoader
{
public:
public:
spell_midsummer_fling_torch() : SpellScriptLoader("spell_midsummer_fling_torch") {}
class spell_midsummer_fling_torch_SpellScript : public SpellScript
@@ -397,7 +397,7 @@ class spell_midsummer_fling_torch : public SpellScriptLoader
std::list<Creature*> crList;
caster->GetCreaturesWithEntryInRange(crList, 100.0f, NPC_TORCH_TARGET);
uint8 rand = urand(0, crList.size()-1);
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)
@@ -500,7 +500,7 @@ enum eJuggle
class spell_midsummer_juggling_torch : public SpellScriptLoader
{
public:
public:
spell_midsummer_juggling_torch() : SpellScriptLoader("spell_midsummer_juggling_torch") {}
class spell_midsummer_juggling_torch_SpellScript : public SpellScript

View File

@@ -32,7 +32,7 @@ enum tableEvent
SPELL_VISUAL_BOUNCE_STUFFING = 61927,
SPELL_VISUAL_BOUNCE_PIE = 61926,
SPELL_VISUAL_BOUNCE_CRANBERRY = 61925,
SPELL_VISUAL_BOUNCE_SWEET_POTATO= 61929,
SPELL_VISUAL_BOUNCE_SWEET_POTATO = 61929,
SPELL_PLATE_TURKEY = 61835,
SPELL_PLATE_STUFFING = 61836,
@@ -89,222 +89,222 @@ enum tableEvent
class npc_pilgrims_bounty_chair : public CreatureScript
{
public:
npc_pilgrims_bounty_chair() : CreatureScript("npc_pilgrims_bounty_chair") { }
public:
npc_pilgrims_bounty_chair() : CreatureScript("npc_pilgrims_bounty_chair") { }
struct npc_pilgrims_bounty_chairAI : public VehicleAI
struct npc_pilgrims_bounty_chairAI : public VehicleAI
{
npc_pilgrims_bounty_chairAI(Creature* creature) : VehicleAI(creature)
{
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) : nullptr; }
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);
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) : nullptr; }
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") { }
public:
npc_pilgrims_bounty_plate() : CreatureScript("npc_pilgrims_bounty_plate") { }
struct npc_pilgrims_bounty_plateAI : public NullCreatureAI
struct npc_pilgrims_bounty_plateAI : public NullCreatureAI
{
npc_pilgrims_bounty_plateAI(Creature* creature) : NullCreatureAI(creature)
{
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);
}
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);
}
};
/////////////////////////////
@@ -312,111 +312,121 @@ class npc_pilgrims_bounty_plate : public CreatureScript
/////////////////////////////
class spell_pilgrims_bounty_pass_generic : public SpellScriptLoader
{
public:
spell_pilgrims_bounty_pass_generic() : SpellScriptLoader("spell_pilgrims_bounty_pass_generic") {}
public:
spell_pilgrims_bounty_pass_generic() : SpellScriptLoader("spell_pilgrims_bounty_pass_generic") {}
class spell_pilgrims_bounty_pass_generic_SpellScript : public SpellScript
class spell_pilgrims_bounty_pass_generic_SpellScript : public SpellScript
{
PrepareSpellScript(spell_pilgrims_bounty_pass_generic_SpellScript);
uint32 GetVisualThrow(uint32 passSpell, bool isPlayer)
{
PrepareSpellScript(spell_pilgrims_bounty_pass_generic_SpellScript);
uint32 GetVisualThrow(uint32 passSpell, bool isPlayer)
if (isPlayer)
{
if (isPlayer)
switch (passSpell)
{
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())
{
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;
GetCaster()->CastSpell(player, GetVisualThrow(GetSpellInfo()->Id, true), true);
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2, GetVisualThrow(GetSpellInfo()->Id, true));
}
}
// normal case
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;
}
}
if (TempSummon* ts = target->ToTempSummon())
if (Unit* owner = ts->GetSummoner())
if (owner->GetEntry() == GetCaster()->GetEntry())
return;
return 0;
GetCaster()->CastSpell(target, GetVisualThrow(GetSpellInfo()->Id, false), true);
}
}
void HandleDummy(SpellEffIndex /*effIndex*/)
// Get chair charmer, passing achievement
if (Player* player = GetCaster()->GetCharmerOrOwnerPlayerOrPlayerItself())
{
if (Unit* target = GetHitUnit())
uint32 spellId = 0;
switch (GetSpellInfo()->Id)
{
// 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);
}
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;
}
// 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);
}
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();
}
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:
public:
spell_pilgrims_bounty_feast_on_generic() : SpellScriptLoader("spell_pilgrims_bounty_feast_on_generic") {}
class spell_pilgrims_bounty_feast_on_generic_SpellScript : public SpellScript
@@ -512,7 +522,7 @@ enum tTracker
class spell_pilgrims_bounty_turkey_tracker : public SpellScriptLoader
{
public:
public:
spell_pilgrims_bounty_turkey_tracker() : SpellScriptLoader("spell_pilgrims_bounty_turkey_tracker") {}
class spell_pilgrims_bounty_turkey_tracker_SpellScript : public SpellScript
@@ -559,92 +569,92 @@ class spell_pilgrims_bounty_turkey_tracker : public SpellScriptLoader
class spell_pilgrims_bounty_serve_generic : public SpellScriptLoader
{
public:
spell_pilgrims_bounty_serve_generic() : SpellScriptLoader("spell_pilgrims_bounty_serve_generic") { }
public:
spell_pilgrims_bounty_serve_generic() : SpellScriptLoader("spell_pilgrims_bounty_serve_generic") { }
class spell_pilgrims_bounty_serve_generic_AuraScript : public AuraScript
class spell_pilgrims_bounty_serve_generic_AuraScript : public AuraScript
{
PrepareAuraScript(spell_pilgrims_bounty_serve_generic_AuraScript);
void OnAuraRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
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();
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") { }
public:
spell_pilgrims_bounty_food() : SpellScriptLoader("spell_pilgrims_bounty_food") { }
class spell_pilgrims_bounty_food_AuraScript : public AuraScript
class spell_pilgrims_bounty_food_AuraScript : public AuraScript
{
PrepareAuraScript(spell_pilgrims_bounty_food_AuraScript);
void RecalculateHook(AuraEffect const* /*aurEffect*/, int32& amount, bool& canBeRecalculated)
{
PrepareAuraScript(spell_pilgrims_bounty_food_AuraScript);
void RecalculateHook(AuraEffect const* /*aurEffect*/, int32& amount, bool& canBeRecalculated)
if (GetCaster())
{
if (GetCaster())
{
if (GetId() == 66041)
amount = CalculatePct(GetCaster()->GetMaxPower(POWER_MANA), 20);
else
amount = CalculatePct(GetCaster()->GetMaxHealth(), 15);
}
canBeRecalculated = true;
if (GetId() == 66041)
amount = CalculatePct(GetCaster()->GetMaxPower(POWER_MANA), 20);
else
amount = CalculatePct(GetCaster()->GetMaxHealth(), 15);
}
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();
canBeRecalculated = true;
}
class spell_pilgrims_bounty_food_SpellScript : public SpellScript
void Register()
{
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();
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();
}
};
/////////////////////////////
@@ -660,30 +670,30 @@ enum pilgrimsPeril
class achievement_pb_pilgrims_peril : public AchievementCriteriaScript
{
public:
achievement_pb_pilgrims_peril() : AchievementCriteriaScript("achievement_pb_pilgrims_peril") { }
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;
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;
}
return false;
}
};
class achievement_pb_terokkar_turkey_time : public AchievementCriteriaScript
{
public:
achievement_pb_terokkar_turkey_time() : AchievementCriteriaScript("achievement_pb_terokkar_turkey_time") { }
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;
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;
}
return false;
}
};
void AddSC_event_pilgrims_end_scripts()
@@ -694,7 +704,7 @@ void AddSC_event_pilgrims_end_scripts()
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();

View File

@@ -21,41 +21,41 @@ enum Mistletoe
class spell_winter_veil_mistletoe : public SpellScriptLoader
{
public:
spell_winter_veil_mistletoe() : SpellScriptLoader("spell_winter_veil_mistletoe") { }
public:
spell_winter_veil_mistletoe() : SpellScriptLoader("spell_winter_veil_mistletoe") { }
class spell_winter_veil_mistletoe_SpellScript : public SpellScript
class spell_winter_veil_mistletoe_SpellScript : public SpellScript
{
PrepareSpellScript(spell_winter_veil_mistletoe_SpellScript);
bool Validate(SpellInfo const* /*spell*/)
{
PrepareSpellScript(spell_winter_veil_mistletoe_SpellScript);
bool Validate(SpellInfo const* /*spell*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_CREATE_MISTLETOE) ||
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();
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
@@ -68,7 +68,7 @@ enum winterWondervoltTrap
class spell_winter_wondervolt_trap : public SpellScriptLoader
{
public:
public:
spell_winter_wondervolt_trap() : SpellScriptLoader("spell_winter_wondervolt_trap") {}
class spell_winter_wondervolt_trap_SpellScript : public SpellScript
@@ -125,7 +125,7 @@ enum crashinTrashin
class spell_winter_veil_racer_rocket_slam : public SpellScriptLoader
{
public:
public:
spell_winter_veil_racer_rocket_slam() : SpellScriptLoader("spell_winter_veil_racer_rocket_slam") {}
class spell_winter_veil_racer_rocket_slam_SpellScript : public SpellScript
@@ -169,9 +169,9 @@ class spell_winter_veil_racer_rocket_slam : public SpellScriptLoader
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);
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);
}
@@ -191,7 +191,7 @@ class spell_winter_veil_racer_rocket_slam : public SpellScriptLoader
class spell_winter_veil_racer_slam_hit : public SpellScriptLoader
{
public:
public:
spell_winter_veil_racer_slam_hit() : SpellScriptLoader("spell_winter_veil_racer_slam_hit") {}
class spell_winter_veil_racer_slam_hit_SpellScript : public SpellScript
@@ -205,7 +205,7 @@ class spell_winter_veil_racer_slam_hit : public SpellScriptLoader
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->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);
@@ -240,7 +240,7 @@ enum airRifle
class spell_winter_veil_shoot_air_rifle : public SpellScriptLoader
{
public:
public:
spell_winter_veil_shoot_air_rifle() : SpellScriptLoader("spell_winter_veil_shoot_air_rifle") {}
class spell_winter_veil_shoot_air_rifle_SpellScript : public SpellScript