Scripts/Misc: Migrate world event scripts to separate files
Port From (https://github.com/TrinityCore/TrinityCore/commit/d3c9c14f83078736b1500e303da5ec575aaf22dc)
This commit is contained in:
@@ -0,0 +1,374 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Game;
|
||||
using Game.Entities;
|
||||
using Game.Scripting;
|
||||
using Game.Spells;
|
||||
|
||||
namespace Scripts.Events.Brewfest
|
||||
{
|
||||
struct SpellIds
|
||||
{
|
||||
//Ramblabla
|
||||
public const uint Giddyup = 42924;
|
||||
public const uint RentalRacingRam = 43883;
|
||||
public const uint SwiftWorkRam = 43880;
|
||||
public const uint RentalRacingRamAura = 42146;
|
||||
public const uint RamLevelNeutral = 43310;
|
||||
public const uint RamTrot = 42992;
|
||||
public const uint RamCanter = 42993;
|
||||
public const uint RamGallop = 42994;
|
||||
public const uint RamFatigue = 43052;
|
||||
public const uint ExhaustedRam = 43332;
|
||||
public const uint RelayRaceTurnIn = 44501;
|
||||
}
|
||||
|
||||
struct QuestIds
|
||||
{
|
||||
//Ramblabla
|
||||
public const uint BrewfestSpeedBunnyGreen = 43345;
|
||||
public const uint BrewfestSpeedBunnyYellow = 43346;
|
||||
public const uint BrewfestSpeedBunnyRed = 43347;
|
||||
|
||||
//Barkerbunny
|
||||
// Horde
|
||||
public const uint BarkForDrohnsDistillery = 11407;
|
||||
public const uint BarkForTchalisVoodooBrewery = 11408;
|
||||
|
||||
// Alliance
|
||||
public const uint BarkBarleybrew = 11293;
|
||||
public const uint BarkForThunderbrews = 11294;
|
||||
}
|
||||
|
||||
struct TextIds
|
||||
{
|
||||
// Bark For Drohn'S Distillery!
|
||||
public const uint DrohnDistillery1 = 23520;
|
||||
public const uint DrohnDistillery2 = 23521;
|
||||
public const uint DrohnDistillery3 = 23522;
|
||||
public const uint DrohnDistillery4 = 23523;
|
||||
|
||||
// Bark For T'Chali'S Voodoo Brewery!
|
||||
public const uint TChalisVoodoo1 = 23524;
|
||||
public const uint TChalisVoodoo2 = 23525;
|
||||
public const uint TChalisVoodoo3 = 23526;
|
||||
public const uint TChalisVoodoo4 = 23527;
|
||||
|
||||
// Bark For The Barleybrews!
|
||||
public const uint Barleybrew1 = 23464;
|
||||
public const uint Barleybrew2 = 23465;
|
||||
public const uint Barleybrew3 = 23466;
|
||||
public const uint Barleybrew4 = 22941;
|
||||
|
||||
// Bark For The Thunderbrews!
|
||||
public const uint Thunderbrews1 = 23467;
|
||||
public const uint Thunderbrews2 = 23468;
|
||||
public const uint Thunderbrews3 = 23469;
|
||||
public const uint Thunderbrews4 = 22942;
|
||||
}
|
||||
|
||||
[Script] // 42924 - Giddyup!
|
||||
class spell_brewfest_giddyup : AuraScript
|
||||
{
|
||||
void OnChange(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
Unit target = GetTarget();
|
||||
if (!target.HasAura(SpellIds.RentalRacingRam) && !target.HasAura(SpellIds.SwiftWorkRam))
|
||||
{
|
||||
target.RemoveAura(GetId());
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.HasAura(SpellIds.ExhaustedRam))
|
||||
return;
|
||||
|
||||
switch (GetStackAmount())
|
||||
{
|
||||
case 1: // green
|
||||
target.RemoveAura(SpellIds.RamLevelNeutral);
|
||||
target.RemoveAura(SpellIds.RamCanter);
|
||||
target.CastSpell(target, SpellIds.RamTrot, true);
|
||||
break;
|
||||
case 6: // yellow
|
||||
target.RemoveAura(SpellIds.RamTrot);
|
||||
target.RemoveAura(SpellIds.RamGallop);
|
||||
target.CastSpell(target, SpellIds.RamCanter, true);
|
||||
break;
|
||||
case 11: // red
|
||||
target.RemoveAura(SpellIds.RamCanter);
|
||||
target.CastSpell(target, SpellIds.RamGallop, true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (GetTargetApplication().GetRemoveMode() == AuraRemoveMode.Default)
|
||||
{
|
||||
target.RemoveAura(SpellIds.RamTrot);
|
||||
target.CastSpell(target, SpellIds.RamLevelNeutral, true);
|
||||
}
|
||||
}
|
||||
|
||||
void OnPeriodic(AuraEffect aurEff)
|
||||
{
|
||||
GetTarget().RemoveAuraFromStack(GetId());
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterEffectApply.Add(new EffectApplyHandler(OnChange, 0, AuraType.PeriodicDummy, AuraEffectHandleModes.ChangeAmountMask));
|
||||
OnEffectRemove.Add(new EffectApplyHandler(OnChange, 0, AuraType.PeriodicDummy, AuraEffectHandleModes.ChangeAmountMask));
|
||||
OnEffectPeriodic.Add(new EffectPeriodicHandler(OnPeriodic, 0, AuraType.PeriodicDummy));
|
||||
}
|
||||
}
|
||||
|
||||
// 43310 - Ram Level - Neutral
|
||||
// 42992 - Ram - Trot
|
||||
// 42993 - Ram - Canter
|
||||
// 42994 - Ram - Gallop
|
||||
[Script]
|
||||
class spell_brewfest_ram : AuraScript
|
||||
{
|
||||
void OnPeriodic(AuraEffect aurEff)
|
||||
{
|
||||
Unit target = GetTarget();
|
||||
if (target.HasAura(SpellIds.ExhaustedRam))
|
||||
return;
|
||||
|
||||
switch (GetId())
|
||||
{
|
||||
case SpellIds.RamLevelNeutral:
|
||||
{
|
||||
Aura aura = target.GetAura(SpellIds.RamFatigue);
|
||||
if (aura != null)
|
||||
aura.ModStackAmount(-4);
|
||||
}
|
||||
break;
|
||||
case SpellIds.RamTrot: // green
|
||||
{
|
||||
Aura aura = target.GetAura(SpellIds.RamFatigue);
|
||||
if (aura != null)
|
||||
aura.ModStackAmount(-2);
|
||||
if (aurEff.GetTickNumber() == 4)
|
||||
target.CastSpell(target, QuestIds.BrewfestSpeedBunnyGreen, true);
|
||||
}
|
||||
break;
|
||||
case SpellIds.RamCanter:
|
||||
{
|
||||
CastSpellExtraArgs args = new(TriggerCastFlags.FullMask);
|
||||
args.AddSpellMod(SpellValueMod.AuraStack, 1);
|
||||
target.CastSpell(target, SpellIds.RamFatigue, args);
|
||||
if (aurEff.GetTickNumber() == 8)
|
||||
target.CastSpell(target, QuestIds.BrewfestSpeedBunnyYellow, true);
|
||||
break;
|
||||
}
|
||||
case SpellIds.RamGallop:
|
||||
{
|
||||
CastSpellExtraArgs args = new(TriggerCastFlags.FullMask);
|
||||
args.AddSpellMod(SpellValueMod.AuraStack, target.HasAura(SpellIds.RamFatigue) ? 4 : 5 /*Hack*/);
|
||||
target.CastSpell(target, SpellIds.RamFatigue, args);
|
||||
if (aurEff.GetTickNumber() == 8)
|
||||
target.CastSpell(target, QuestIds.BrewfestSpeedBunnyRed, true);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectPeriodic.Add(new EffectPeriodicHandler(OnPeriodic, 1, AuraType.PeriodicDummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 43052 - Ram Fatigue
|
||||
class spell_brewfest_ram_fatigue : AuraScript
|
||||
{
|
||||
void OnApply(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
Unit target = GetTarget();
|
||||
|
||||
if (GetStackAmount() == 101)
|
||||
{
|
||||
target.RemoveAura(SpellIds.RamLevelNeutral);
|
||||
target.RemoveAura(SpellIds.RamTrot);
|
||||
target.RemoveAura(SpellIds.RamCanter);
|
||||
target.RemoveAura(SpellIds.RamGallop);
|
||||
target.RemoveAura(SpellIds.Giddyup);
|
||||
|
||||
target.CastSpell(target, SpellIds.ExhaustedRam, true);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterEffectApply.Add(new EffectApplyHandler(OnApply, 0, AuraType.Dummy, AuraEffectHandleModes.RealOrReapplyMask));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 43450 - Brewfest - apple trap - friendly DND
|
||||
class spell_brewfest_apple_trap : AuraScript
|
||||
{
|
||||
void OnApply(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
GetTarget().RemoveAura(SpellIds.RamFatigue);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectApply.Add(new EffectApplyHandler(OnApply, 0, AuraType.ForceReaction, AuraEffectHandleModes.Real));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 43332 - Exhausted Ram
|
||||
class spell_brewfest_exhausted_ram : AuraScript
|
||||
{
|
||||
void OnRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
Unit target = GetTarget();
|
||||
target.CastSpell(target, SpellIds.RamLevelNeutral, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectRemove.Add(new EffectApplyHandler(OnRemove, 0, AuraType.ModDecreaseSpeed, AuraEffectHandleModes.Real));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 43714 - Brewfest - Relay Race - Intro - Force - Player to throw- DND
|
||||
class spell_brewfest_relay_race_intro_force_player_to_throw : SpellScript
|
||||
{
|
||||
void HandleForceCast(uint effIndex)
|
||||
{
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
// All this spells trigger a spell that requires reagents; if the
|
||||
// triggered spell is cast as "triggered", reagents are not consumed
|
||||
GetHitUnit().CastSpell((Unit)null, GetEffectInfo().TriggerSpell, new CastSpellExtraArgs(TriggerCastFlags.FullMask & ~TriggerCastFlags.IgnorePowerAndReagentCost));
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleForceCast, 0, SpellEffectName.ForceCast));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 43755 - Brewfest - Daily - Relay Race - Player - Increase Mount Duration - DND
|
||||
class spell_brewfest_relay_race_turn_in : SpellScript
|
||||
{
|
||||
void HandleDummy(uint effIndex)
|
||||
{
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
|
||||
Aura aura = GetHitUnit().GetAura(SpellIds.SwiftWorkRam);
|
||||
if (aura != null)
|
||||
{
|
||||
aura.SetDuration(aura.GetDuration() + 30 * Time.InMilliseconds);
|
||||
GetCaster().CastSpell(GetHitUnit(), SpellIds.RelayRaceTurnIn, new CastSpellExtraArgs(TriggerCastFlags.FullMask));
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 43876 - Dismount Ram
|
||||
class spell_brewfest_dismount_ram : SpellScript
|
||||
{
|
||||
void HandleScript(uint effIndex)
|
||||
{
|
||||
GetCaster().RemoveAura(SpellIds.RentalRacingRam);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect));
|
||||
}
|
||||
}
|
||||
|
||||
// 43259 Brewfest - Barker Bunny 1
|
||||
// 43260 Brewfest - Barker Bunny 2
|
||||
// 43261 Brewfest - Barker Bunny 3
|
||||
// 43262 Brewfest - Barker Bunny 4
|
||||
[Script]
|
||||
class spell_brewfest_barker_bunny : AuraScript
|
||||
{
|
||||
public override bool Load()
|
||||
{
|
||||
return GetUnitOwner().IsTypeId(TypeId.Player);
|
||||
}
|
||||
|
||||
void OnApply(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
Player target = GetTarget().ToPlayer();
|
||||
|
||||
uint BroadcastTextId = 0;
|
||||
|
||||
if (target.GetQuestStatus(QuestIds.BarkForDrohnsDistillery) == QuestStatus.Incomplete ||
|
||||
target.GetQuestStatus(QuestIds.BarkForDrohnsDistillery) == QuestStatus.Complete)
|
||||
BroadcastTextId = RandomHelper.RAND(TextIds.DrohnDistillery1, TextIds.DrohnDistillery2, TextIds.DrohnDistillery3, TextIds.DrohnDistillery4);
|
||||
|
||||
if (target.GetQuestStatus(QuestIds.BarkForTchalisVoodooBrewery) == QuestStatus.Incomplete ||
|
||||
target.GetQuestStatus(QuestIds.BarkForTchalisVoodooBrewery) == QuestStatus.Complete)
|
||||
BroadcastTextId = RandomHelper.RAND(TextIds.TChalisVoodoo1, TextIds.TChalisVoodoo2, TextIds.TChalisVoodoo3, TextIds.TChalisVoodoo4);
|
||||
|
||||
if (target.GetQuestStatus(QuestIds.BarkBarleybrew) == QuestStatus.Incomplete ||
|
||||
target.GetQuestStatus(QuestIds.BarkBarleybrew) == QuestStatus.Complete)
|
||||
BroadcastTextId = RandomHelper.RAND(TextIds.Barleybrew1, TextIds.Barleybrew2, TextIds.Barleybrew3, TextIds.Barleybrew4);
|
||||
|
||||
if (target.GetQuestStatus(QuestIds.BarkForThunderbrews) == QuestStatus.Incomplete ||
|
||||
target.GetQuestStatus(QuestIds.BarkForThunderbrews) == QuestStatus.Complete)
|
||||
BroadcastTextId = RandomHelper.RAND(TextIds.Thunderbrews1, TextIds.Thunderbrews2, TextIds.Thunderbrews3, TextIds.Thunderbrews4);
|
||||
|
||||
if (BroadcastTextId != 0)
|
||||
target.Talk(BroadcastTextId, ChatMsg.Say, WorldConfig.GetFloatValue(WorldCfg.ListenRangeSay), target);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectApply.Add(new EffectApplyHandler(OnApply, 1, AuraType.Dummy, AuraEffectHandleModes.Real));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,261 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Game.Entities;
|
||||
using Game.Scripting;
|
||||
using Game.Spells;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Scripts.Events.HallowsEnd
|
||||
{
|
||||
struct SpellIds
|
||||
{
|
||||
//HallowEndCandysSpells
|
||||
public const uint CandyOrangeGiant = 24924; // Effect 1: Apply Aura: Mod Size, Value: 30%
|
||||
public const uint CandySkeleton = 24925; // Effect 1: Apply Aura: Change Model (Skeleton). Effect 2: Apply Aura: Underwater Breathing
|
||||
public const uint CandyPirate = 24926; // Effect 1: Apply Aura: Increase Swim Speed, Value: 50%
|
||||
public const uint CandyGhost = 24927; // Effect 1: Apply Aura: Levitate / Hover. Effect 2: Apply Aura: Slow Fall, Effect 3: Apply Aura: Water Walking
|
||||
public const uint CandyFemaleDefiasPirate = 44742; // Effect 1: Apply Aura: Change Model (Defias Pirate, Female). Effect 2: Increase Swim Speed, Value: 50%
|
||||
public const uint CandyMaleDefiasPirate = 44743; // Effect 1: Apply Aura: Change Model (Defias Pirate, Male). Effect 2: Increase Swim Speed, Value: 50%
|
||||
|
||||
//Trickspells
|
||||
public const uint PirateCostumeMale = 24708;
|
||||
public const uint PirateCostumeFemale = 24709;
|
||||
public const uint NinjaCostumeMale = 24710;
|
||||
public const uint NinjaCostumeFemale = 24711;
|
||||
public const uint LeperGnomeCostumeMale = 24712;
|
||||
public const uint LeperGnomeCostumeFemale = 24713;
|
||||
public const uint SkeletonCostume = 24723;
|
||||
public const uint GhostCostumeMale = 24735;
|
||||
public const uint GhostCostumeFemale = 24736;
|
||||
public const uint TrickBuff = 24753;
|
||||
|
||||
//Trickortreatspells
|
||||
public const uint Trick = 24714;
|
||||
public const uint Treat = 24715;
|
||||
public const uint TrickedOrTreated = 24755;
|
||||
public const uint TrickyTreatSpeed = 42919;
|
||||
public const uint TrickyTreatTrigger = 42965;
|
||||
public const uint UpsetTummy = 42966;
|
||||
|
||||
//Wand Spells
|
||||
public const uint HallowedWandPirate = 24717;
|
||||
public const uint HallowedWandNinja = 24718;
|
||||
public const uint HallowedWandLeperGnome = 24719;
|
||||
public const uint HallowedWandRandom = 24720;
|
||||
public const uint HallowedWandSkeleton = 24724;
|
||||
public const uint HallowedWandWisp = 24733;
|
||||
public const uint HallowedWandGhost = 24737;
|
||||
public const uint HallowedWandBat = 24741;
|
||||
}
|
||||
|
||||
|
||||
[Script] // 24930 - Hallow's End Candy
|
||||
class spell_hallow_end_candy_SpellScript : SpellScript
|
||||
{
|
||||
uint[] spells =
|
||||
{
|
||||
SpellIds.CandyOrangeGiant,
|
||||
SpellIds.CandySkeleton,
|
||||
SpellIds.CandyPirate,
|
||||
SpellIds.CandyGhost
|
||||
};
|
||||
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(spells);
|
||||
}
|
||||
|
||||
void HandleDummy(uint effIndex)
|
||||
{
|
||||
GetCaster().CastSpell(GetCaster(), spells.SelectRandom(), true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHit.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 24926 - Hallow's End Candy
|
||||
class spell_hallow_end_candy_pirate_AuraScript : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.CandyFemaleDefiasPirate, SpellIds.CandyMaleDefiasPirate);
|
||||
}
|
||||
|
||||
void HandleApply(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
uint spell = GetTarget().GetNativeGender() == Gender.Female ? SpellIds.CandyFemaleDefiasPirate : SpellIds.CandyMaleDefiasPirate;
|
||||
GetTarget().CastSpell(GetTarget(), spell, true);
|
||||
}
|
||||
|
||||
void HandleRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
uint spell = GetTarget().GetNativeGender() == Gender.Female ? SpellIds.CandyFemaleDefiasPirate : SpellIds.CandyMaleDefiasPirate;
|
||||
GetTarget().RemoveAurasDueToSpell(spell);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterEffectApply.Add(new EffectApplyHandler(HandleApply, 0, AuraType.ModIncreaseSwimSpeed, AuraEffectHandleModes.Real));
|
||||
AfterEffectRemove.Add(new EffectApplyHandler(HandleRemove, 0, AuraType.ModIncreaseSwimSpeed, AuraEffectHandleModes.Real));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 24750 Trick
|
||||
class spell_hallow_end_trick : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spell)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.PirateCostumeMale, SpellIds.PirateCostumeFemale, SpellIds.NinjaCostumeMale, SpellIds.NinjaCostumeFemale,
|
||||
SpellIds.LeperGnomeCostumeMale, SpellIds.LeperGnomeCostumeFemale, SpellIds.SkeletonCostume, SpellIds.GhostCostumeMale, SpellIds.GhostCostumeFemale, SpellIds.TrickBuff);
|
||||
}
|
||||
|
||||
void HandleScript(uint effIndex)
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
Player target = GetHitPlayer();
|
||||
if (target)
|
||||
{
|
||||
Gender gender = target.GetNativeGender();
|
||||
uint spellId = SpellIds.TrickBuff;
|
||||
switch (RandomHelper.URand(0, 5))
|
||||
{
|
||||
case 1:
|
||||
spellId = gender == Gender.Female ? SpellIds.LeperGnomeCostumeFemale : SpellIds.LeperGnomeCostumeMale;
|
||||
break;
|
||||
case 2:
|
||||
spellId = gender == Gender.Female ? SpellIds.PirateCostumeFemale : SpellIds.PirateCostumeMale;
|
||||
break;
|
||||
case 3:
|
||||
spellId = gender == Gender.Female ? SpellIds.GhostCostumeFemale : SpellIds.GhostCostumeMale;
|
||||
break;
|
||||
case 4:
|
||||
spellId = gender == Gender.Female ? SpellIds.NinjaCostumeFemale : SpellIds.NinjaCostumeMale;
|
||||
break;
|
||||
case 5:
|
||||
spellId = SpellIds.SkeletonCostume;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
caster.CastSpell(target, spellId, true);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 24751 Trick or Treat
|
||||
class spell_hallow_end_trick_or_treat : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spell)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.Trick, SpellIds.Treat, SpellIds.TrickedOrTreated);
|
||||
}
|
||||
|
||||
void HandleScript(uint effIndex)
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
Player target = GetHitPlayer();
|
||||
if (target)
|
||||
{
|
||||
caster.CastSpell(target, RandomHelper.randChance(50) ? SpellIds.Trick : SpellIds.Treat, true);
|
||||
caster.CastSpell(target, SpellIds.TrickedOrTreated, true);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 44436 - Tricky Treat
|
||||
class spell_hallow_end_tricky_treat : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spell)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.TrickyTreatSpeed, SpellIds.TrickyTreatTrigger, SpellIds.UpsetTummy);
|
||||
}
|
||||
|
||||
void HandleScript(uint effIndex)
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
if (caster.HasAura(SpellIds.TrickyTreatTrigger) && caster.GetAuraCount(SpellIds.TrickyTreatSpeed) > 3 && RandomHelper.randChance(33))
|
||||
caster.CastSpell(caster, SpellIds.UpsetTummy, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 24717, 24718, 24719, 24720, 24724, 24733, 24737, 24741
|
||||
class spell_hallow_end_wand : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellEntry)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.PirateCostumeMale, SpellIds.PirateCostumeFemale, SpellIds.NinjaCostumeMale, SpellIds.NinjaCostumeFemale,
|
||||
SpellIds.LeperGnomeCostumeMale, SpellIds.LeperGnomeCostumeFemale, SpellIds.GhostCostumeMale, SpellIds.GhostCostumeFemale);
|
||||
}
|
||||
|
||||
void HandleScriptEffect()
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
Unit target = GetHitUnit();
|
||||
|
||||
uint spellId;
|
||||
bool female = target.GetNativeGender() == Gender.Female;
|
||||
|
||||
switch (GetSpellInfo().Id)
|
||||
{
|
||||
case SpellIds.HallowedWandLeperGnome:
|
||||
spellId = female ? SpellIds.LeperGnomeCostumeFemale : SpellIds.LeperGnomeCostumeMale;
|
||||
break;
|
||||
case SpellIds.HallowedWandPirate:
|
||||
spellId = female ? SpellIds.PirateCostumeFemale : SpellIds.PirateCostumeMale;
|
||||
break;
|
||||
case SpellIds.HallowedWandGhost:
|
||||
spellId = female ? SpellIds.GhostCostumeFemale : SpellIds.GhostCostumeMale;
|
||||
break;
|
||||
case SpellIds.HallowedWandNinja:
|
||||
spellId = female ? SpellIds.NinjaCostumeFemale : SpellIds.NinjaCostumeMale;
|
||||
break;
|
||||
case SpellIds.HallowedWandRandom:
|
||||
spellId = RandomHelper.RAND(SpellIds.HallowedWandPirate, SpellIds.HallowedWandNinja, SpellIds.HallowedWandLeperGnome, SpellIds.HallowedWandSkeleton, SpellIds.HallowedWandWisp, SpellIds.HallowedWandGhost, SpellIds.HallowedWandBat);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
caster.CastSpell(target, spellId, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterHit.Add(new HitHandler(HandleScriptEffect));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Game.Entities;
|
||||
using Game.Maps;
|
||||
using Game.Scripting;
|
||||
using Game.Spells;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Scripts.Events.LoveIsInTheAir
|
||||
{
|
||||
struct SpellIds
|
||||
{
|
||||
//Romantic Picnic
|
||||
public const uint BasketCheck = 45119; // Holiday - Valentine - Romantic Picnic Near Basket Check
|
||||
public const uint MealPeriodic = 45103; // Holiday - Valentine - Romantic Picnic Meal Periodic - Effect Dummy
|
||||
public const uint MealEatVisual = 45120; // Holiday - Valentine - Romantic Picnic Meal Eat Visual
|
||||
//public const uint MealParticle = 45114; // Holiday - Valentine - Romantic Picnic Meal Particle - Unused
|
||||
public const uint DrinkVisual = 45121; // Holiday - Valentine - Romantic Picnic Drink Visual
|
||||
public const uint RomanticPicnicAchiev = 45123; // Romantic Picnic Periodic = 5000
|
||||
}
|
||||
|
||||
[Script] // 45102 Romantic Picnic
|
||||
class spell_love_is_in_the_air_romantic_picnic : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.BasketCheck, SpellIds.MealPeriodic, SpellIds.MealEatVisual, SpellIds.DrinkVisual, SpellIds.RomanticPicnicAchiev);
|
||||
}
|
||||
|
||||
void OnApply(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
Unit target = GetTarget();
|
||||
target.SetStandState(UnitStandStateType.Sit);
|
||||
target.CastSpell(target, SpellIds.MealPeriodic);
|
||||
}
|
||||
|
||||
void OnPeriodic(AuraEffect aurEff)
|
||||
{
|
||||
// Every 5 seconds
|
||||
Unit target = GetTarget();
|
||||
|
||||
// If our player is no longer sit, Remove all auras
|
||||
if (target.GetStandState() != UnitStandStateType.Sit)
|
||||
{
|
||||
target.RemoveAura(SpellIds.RomanticPicnicAchiev);
|
||||
target.RemoveAura(GetAura());
|
||||
return;
|
||||
}
|
||||
|
||||
target.CastSpell(target, SpellIds.BasketCheck); // unknown use, it targets Romantic Basket
|
||||
target.CastSpell(target, RandomHelper.RAND(SpellIds.MealEatVisual, SpellIds.DrinkVisual));
|
||||
|
||||
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
|
||||
List<Unit> playerList = new();
|
||||
AnyPlayerInObjectRangeCheck checker = new(target, SharedConst.InteractionDistance * 2);
|
||||
var searcher = new PlayerListSearcher(target, playerList, checker);
|
||||
Cell.VisitWorldObjects(target, searcher, SharedConst.InteractionDistance * 2);
|
||||
foreach (Player playerFound in playerList)
|
||||
{
|
||||
if (target != playerFound && playerFound.HasAura(GetId()))
|
||||
{
|
||||
playerFound.CastSpell(playerFound, SpellIds.RomanticPicnicAchiev, true);
|
||||
target.CastSpell(target, SpellIds.RomanticPicnicAchiev, true);
|
||||
foundSomeone = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!foundSomeone && target.HasAura(SpellIds.RomanticPicnicAchiev))
|
||||
target.RemoveAura(SpellIds.RomanticPicnicAchiev);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterEffectApply.Add(new EffectApplyHandler(OnApply, 0, AuraType.PeriodicDummy, AuraEffectHandleModes.Real));
|
||||
OnEffectPeriodic.Add(new EffectPeriodicHandler(OnPeriodic, 0, AuraType.PeriodicDummy));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,472 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Game.AI;
|
||||
using Game.Entities;
|
||||
using Game.Scripting;
|
||||
using Game.Spells;
|
||||
using System;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Scripts.Events.LunarFestival
|
||||
{
|
||||
struct SpellIds
|
||||
{
|
||||
//Fireworks
|
||||
public const uint RocketBlue = 26344;
|
||||
public const uint RocketGreen = 26345;
|
||||
public const uint RocketPurple = 26346;
|
||||
public const uint RocketRed = 26347;
|
||||
public const uint RocketWhite = 26348;
|
||||
public const uint RocketYellow = 26349;
|
||||
public const uint RocketBigBlue = 26351;
|
||||
public const uint RocketBigGreen = 26352;
|
||||
public const uint RocketBigPurple = 26353;
|
||||
public const uint RocketBigRed = 26354;
|
||||
public const uint RocketBigWhite = 26355;
|
||||
public const uint RocketBigYellow = 26356;
|
||||
public const uint LunarFortune = 26522;
|
||||
|
||||
//Omen
|
||||
public const uint OmenCleave = 15284;
|
||||
public const uint OmenStarfall = 26540;
|
||||
public const uint OmenSummonSpotlight = 26392;
|
||||
public const uint EluneCandle = 26374;
|
||||
|
||||
//EluneCandle
|
||||
public const uint EluneCandleOmenHead = 26622;
|
||||
public const uint EluneCandleOmenChest = 26624;
|
||||
public const uint EluneCandleOmenHandR = 26625;
|
||||
public const uint EluneCandleOmenHandL = 26649;
|
||||
public const uint EluneCandleNormal = 26636;
|
||||
|
||||
}
|
||||
|
||||
struct CreatureIds
|
||||
{
|
||||
//Fireworks
|
||||
public const uint Omen = 15467;
|
||||
public const uint MinionOfOmen = 15466;
|
||||
public const uint FireworkBlue = 15879;
|
||||
public const uint FireworkGreen = 15880;
|
||||
public const uint FireworkPurple = 15881;
|
||||
public const uint FireworkRed = 15882;
|
||||
public const uint FireworkYellow = 15883;
|
||||
public const uint FireworkWhite = 15884;
|
||||
public const uint FireworkBigBlue = 15885;
|
||||
public const uint FireworkBigGreen = 15886;
|
||||
public const uint FireworkBigPurple = 15887;
|
||||
public const uint FireworkBigRed = 15888;
|
||||
public const uint FireworkBigYellow = 15889;
|
||||
public const uint FireworkBigWhite = 15890;
|
||||
|
||||
public const uint ClusterBlue = 15872;
|
||||
public const uint ClusterRed = 15873;
|
||||
public const uint ClusterGreen = 15874;
|
||||
public const uint ClusterPurple = 15875;
|
||||
public const uint ClusterWhite = 15876;
|
||||
public const uint ClusterYellow = 15877;
|
||||
public const uint ClusterBigBlue = 15911;
|
||||
public const uint ClusterBigGreen = 15912;
|
||||
public const uint ClusterBigPurple = 15913;
|
||||
public const uint ClusterBigRed = 15914;
|
||||
public const uint ClusterBigWhite = 15915;
|
||||
public const uint ClusterBigYellow = 15916;
|
||||
public const uint ClusterElune = 15918;
|
||||
}
|
||||
|
||||
struct GameObjectIds
|
||||
{
|
||||
//Fireworks
|
||||
public const uint FireworkLauncher1 = 180771;
|
||||
public const uint FireworkLauncher2 = 180868;
|
||||
public const uint FireworkLauncher3 = 180850;
|
||||
public const uint ClusterLauncher1 = 180772;
|
||||
public const uint ClusterLauncher2 = 180859;
|
||||
public const uint ClusterLauncher3 = 180869;
|
||||
public const uint ClusterLauncher4 = 180874;
|
||||
|
||||
//Omen
|
||||
public const uint EluneTrap1 = 180876;
|
||||
public const uint EluneTrap2 = 180877;
|
||||
}
|
||||
|
||||
struct MiscConst
|
||||
{
|
||||
//Fireworks
|
||||
public const uint AnimGoLaunchFirework = 3;
|
||||
public const uint ZoneMoonglade = 493;
|
||||
|
||||
//Omen
|
||||
public static Position OmenSummonPos = new(7558.993f, -2839.999f, 450.0214f, 4.46f);
|
||||
}
|
||||
|
||||
[Script]
|
||||
class npc_firework : ScriptedAI
|
||||
{
|
||||
public npc_firework(Creature creature) : base(creature) { }
|
||||
|
||||
bool isCluster()
|
||||
{
|
||||
switch (me.GetEntry())
|
||||
{
|
||||
case CreatureIds.FireworkBlue:
|
||||
case CreatureIds.FireworkGreen:
|
||||
case CreatureIds.FireworkPurple:
|
||||
case CreatureIds.FireworkRed:
|
||||
case CreatureIds.FireworkYellow:
|
||||
case CreatureIds.FireworkWhite:
|
||||
case CreatureIds.FireworkBigBlue:
|
||||
case CreatureIds.FireworkBigGreen:
|
||||
case CreatureIds.FireworkBigPurple:
|
||||
case CreatureIds.FireworkBigRed:
|
||||
case CreatureIds.FireworkBigYellow:
|
||||
case CreatureIds.FireworkBigWhite:
|
||||
return false;
|
||||
case CreatureIds.ClusterBlue:
|
||||
case CreatureIds.ClusterGreen:
|
||||
case CreatureIds.ClusterPurple:
|
||||
case CreatureIds.ClusterRed:
|
||||
case CreatureIds.ClusterYellow:
|
||||
case CreatureIds.ClusterWhite:
|
||||
case CreatureIds.ClusterBigBlue:
|
||||
case CreatureIds.ClusterBigGreen:
|
||||
case CreatureIds.ClusterBigPurple:
|
||||
case CreatureIds.ClusterBigRed:
|
||||
case CreatureIds.ClusterBigYellow:
|
||||
case CreatureIds.ClusterBigWhite:
|
||||
case CreatureIds.ClusterElune:
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
GameObject FindNearestLauncher()
|
||||
{
|
||||
GameObject launcher = null;
|
||||
|
||||
if (isCluster())
|
||||
{
|
||||
GameObject launcher1 = GetClosestGameObjectWithEntry(me, GameObjectIds.ClusterLauncher1, 0.5f);
|
||||
GameObject launcher2 = GetClosestGameObjectWithEntry(me, GameObjectIds.ClusterLauncher2, 0.5f);
|
||||
GameObject launcher3 = GetClosestGameObjectWithEntry(me, GameObjectIds.ClusterLauncher3, 0.5f);
|
||||
GameObject launcher4 = GetClosestGameObjectWithEntry(me, GameObjectIds.ClusterLauncher4, 0.5f);
|
||||
|
||||
if (launcher1)
|
||||
launcher = launcher1;
|
||||
else if (launcher2)
|
||||
launcher = launcher2;
|
||||
else if (launcher3)
|
||||
launcher = launcher3;
|
||||
else if (launcher4)
|
||||
launcher = launcher4;
|
||||
}
|
||||
else
|
||||
{
|
||||
GameObject launcher1 = GetClosestGameObjectWithEntry(me, GameObjectIds.FireworkLauncher1, 0.5f);
|
||||
GameObject launcher2 = GetClosestGameObjectWithEntry(me, GameObjectIds.FireworkLauncher2, 0.5f);
|
||||
GameObject launcher3 = GetClosestGameObjectWithEntry(me, GameObjectIds.FireworkLauncher3, 0.5f);
|
||||
|
||||
if (launcher1)
|
||||
launcher = launcher1;
|
||||
else if (launcher2)
|
||||
launcher = launcher2;
|
||||
else if (launcher3)
|
||||
launcher = launcher3;
|
||||
}
|
||||
|
||||
return launcher;
|
||||
}
|
||||
|
||||
uint GetFireworkSpell(uint entry)
|
||||
{
|
||||
switch (entry)
|
||||
{
|
||||
case CreatureIds.FireworkBlue:
|
||||
return SpellIds.RocketBlue;
|
||||
case CreatureIds.FireworkGreen:
|
||||
return SpellIds.RocketGreen;
|
||||
case CreatureIds.FireworkPurple:
|
||||
return SpellIds.RocketPurple;
|
||||
case CreatureIds.FireworkRed:
|
||||
return SpellIds.RocketRed;
|
||||
case CreatureIds.FireworkYellow:
|
||||
return SpellIds.RocketYellow;
|
||||
case CreatureIds.FireworkWhite:
|
||||
return SpellIds.RocketWhite;
|
||||
case CreatureIds.FireworkBigBlue:
|
||||
return SpellIds.RocketBigBlue;
|
||||
case CreatureIds.FireworkBigGreen:
|
||||
return SpellIds.RocketBigGreen;
|
||||
case CreatureIds.FireworkBigPurple:
|
||||
return SpellIds.RocketBigPurple;
|
||||
case CreatureIds.FireworkBigRed:
|
||||
return SpellIds.RocketBigRed;
|
||||
case CreatureIds.FireworkBigYellow:
|
||||
return SpellIds.RocketBigYellow;
|
||||
case CreatureIds.FireworkBigWhite:
|
||||
return SpellIds.RocketBigWhite;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
uint GetFireworkGameObjectId()
|
||||
{
|
||||
uint spellId = 0;
|
||||
|
||||
switch (me.GetEntry())
|
||||
{
|
||||
case CreatureIds.ClusterBlue:
|
||||
spellId = GetFireworkSpell(CreatureIds.FireworkBlue);
|
||||
break;
|
||||
case CreatureIds.ClusterGreen:
|
||||
spellId = GetFireworkSpell(CreatureIds.FireworkGreen);
|
||||
break;
|
||||
case CreatureIds.ClusterPurple:
|
||||
spellId = GetFireworkSpell(CreatureIds.FireworkPurple);
|
||||
break;
|
||||
case CreatureIds.ClusterRed:
|
||||
spellId = GetFireworkSpell(CreatureIds.FireworkRed);
|
||||
break;
|
||||
case CreatureIds.ClusterYellow:
|
||||
spellId = GetFireworkSpell(CreatureIds.FireworkYellow);
|
||||
break;
|
||||
case CreatureIds.ClusterWhite:
|
||||
spellId = GetFireworkSpell(CreatureIds.FireworkWhite);
|
||||
break;
|
||||
case CreatureIds.ClusterBigBlue:
|
||||
spellId = GetFireworkSpell(CreatureIds.FireworkBigBlue);
|
||||
break;
|
||||
case CreatureIds.ClusterBigGreen:
|
||||
spellId = GetFireworkSpell(CreatureIds.FireworkBigGreen);
|
||||
break;
|
||||
case CreatureIds.ClusterBigPurple:
|
||||
spellId = GetFireworkSpell(CreatureIds.FireworkBigPurple);
|
||||
break;
|
||||
case CreatureIds.ClusterBigRed:
|
||||
spellId = GetFireworkSpell(CreatureIds.FireworkBigRed);
|
||||
break;
|
||||
case CreatureIds.ClusterBigYellow:
|
||||
spellId = GetFireworkSpell(CreatureIds.FireworkBigYellow);
|
||||
break;
|
||||
case CreatureIds.ClusterBigWhite:
|
||||
spellId = GetFireworkSpell(CreatureIds.FireworkBigWhite);
|
||||
break;
|
||||
case CreatureIds.ClusterElune:
|
||||
spellId = GetFireworkSpell(RandomHelper.URand(CreatureIds.FireworkBlue, CreatureIds.FireworkWhite));
|
||||
break;
|
||||
}
|
||||
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, Difficulty.None);
|
||||
|
||||
if (spellInfo != null && spellInfo.GetEffect(0).Effect == SpellEffectName.SummonObjectWild)
|
||||
return (uint)spellInfo.GetEffect(0).MiscValue;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
GameObject launcher = FindNearestLauncher();
|
||||
if (launcher)
|
||||
{
|
||||
launcher.SendCustomAnim(MiscConst.AnimGoLaunchFirework);
|
||||
me.SetOrientation(launcher.GetOrientation() + MathF.PI / 2);
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
||||
if (isCluster())
|
||||
{
|
||||
// Check if we are near Elune'ara lake south, if so try to summon Omen or a minion
|
||||
if (me.GetZoneId() == MiscConst.ZoneMoonglade)
|
||||
{
|
||||
if (!me.FindNearestCreature(CreatureIds.Omen, 100.0f) && me.GetDistance2d(MiscConst.OmenSummonPos.GetPositionX(), MiscConst.OmenSummonPos.GetPositionY()) <= 100.0f)
|
||||
{
|
||||
switch (RandomHelper.URand(0, 9))
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
Creature minion = me.SummonCreature(CreatureIds.MinionOfOmen, me.GetPositionX() + RandomHelper.FRand(-5.0f, 5.0f), me.GetPositionY() + RandomHelper.FRand(-5.0f, 5.0f), me.GetPositionZ(), 0.0f, TempSummonType.CorpseTimedDespawn, TimeSpan.FromSeconds(20));
|
||||
if (minion)
|
||||
minion.GetAI().AttackStart(me.SelectNearestPlayer(20.0f));
|
||||
break;
|
||||
case 9:
|
||||
me.SummonCreature(CreatureIds.Omen, MiscConst.OmenSummonPos);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (me.GetEntry() == CreatureIds.ClusterElune)
|
||||
DoCast(SpellIds.LunarFortune);
|
||||
|
||||
float displacement = 0.7f;
|
||||
for (byte i = 0; i < 4; i++)
|
||||
me.SummonGameObject(GetFireworkGameObjectId(), me.GetPositionX() + (i % 2 == 0 ? displacement : -displacement), me.GetPositionY() + (i > 1 ? displacement : -displacement), me.GetPositionZ() + 4.0f, me.GetOrientation(), Quaternion.CreateFromRotationMatrix(Extensions.fromEulerAnglesZYX(me.GetOrientation(), 0.0f, 0.0f)), TimeSpan.FromSeconds(1));
|
||||
}
|
||||
else
|
||||
//me.CastSpell(me, GetFireworkSpell(me.GetEntry()), true);
|
||||
me.CastSpell(me.GetPosition(), GetFireworkSpell(me.GetEntry()), new CastSpellExtraArgs(true));
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class npc_omen : ScriptedAI
|
||||
{
|
||||
public npc_omen(Creature creature) : base(creature)
|
||||
{
|
||||
me.SetImmuneToPC(true);
|
||||
me.GetMotionMaster().MovePoint(1, 7549.977f, -2855.137f, 456.9678f);
|
||||
}
|
||||
|
||||
public override void MovementInform(MovementGeneratorType type, uint pointId)
|
||||
{
|
||||
if (type != MovementGeneratorType.Point)
|
||||
return;
|
||||
|
||||
if (pointId == 1)
|
||||
{
|
||||
me.SetHomePosition(me.GetPositionX(), me.GetPositionY(), me.GetPositionZ(), me.GetOrientation());
|
||||
me.SetImmuneToPC(false);
|
||||
Player player = me.SelectNearestPlayer(40.0f);
|
||||
if (player)
|
||||
AttackStart(player);
|
||||
}
|
||||
}
|
||||
|
||||
public override void JustEngagedWith(Unit attacker)
|
||||
{
|
||||
_scheduler.CancelAll();
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(5), task =>
|
||||
{
|
||||
DoCastVictim(SpellIds.OmenCleave);
|
||||
task.Repeat(TimeSpan.FromSeconds(8), TimeSpan.FromSeconds(10));
|
||||
});
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(8), TimeSpan.FromSeconds(10), 1, task =>
|
||||
{
|
||||
Unit target = SelectTarget(SelectTargetMethod.Random, 0);
|
||||
if (target)
|
||||
DoCast(target, SpellIds.OmenStarfall);
|
||||
task.Repeat(TimeSpan.FromSeconds(14), TimeSpan.FromSeconds(16));
|
||||
});
|
||||
}
|
||||
|
||||
public override void JustDied(Unit killer)
|
||||
{
|
||||
DoCast(SpellIds.OmenSummonSpotlight);
|
||||
}
|
||||
|
||||
public override void SpellHit(WorldObject caster, SpellInfo spellInfo)
|
||||
{
|
||||
if (spellInfo.Id == SpellIds.EluneCandle)
|
||||
{
|
||||
if (me.HasAura(SpellIds.OmenStarfall))
|
||||
me.RemoveAurasDueToSpell(SpellIds.OmenStarfall);
|
||||
|
||||
_scheduler.RescheduleGroup(1, TimeSpan.FromSeconds(14), TimeSpan.FromSeconds(16));
|
||||
}
|
||||
}
|
||||
|
||||
public override void UpdateAI(uint diff)
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
_scheduler.Update(diff);
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class npc_giant_spotlight : ScriptedAI
|
||||
{
|
||||
public npc_giant_spotlight(Creature creature) : base(creature) { }
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
_scheduler.CancelAll();
|
||||
_scheduler.Schedule(TimeSpan.FromMinutes(5), task =>
|
||||
{
|
||||
GameObject trap = me.FindNearestGameObject(GameObjectIds.EluneTrap1, 5.0f);
|
||||
if (trap)
|
||||
trap.RemoveFromWorld();
|
||||
|
||||
trap = me.FindNearestGameObject(GameObjectIds.EluneTrap2, 5.0f);
|
||||
if (trap)
|
||||
trap.RemoveFromWorld();
|
||||
|
||||
Creature omen = me.FindNearestCreature(CreatureIds.Omen, 5.0f, false);
|
||||
if (omen)
|
||||
omen.DespawnOrUnsummon();
|
||||
|
||||
me.DespawnOrUnsummon();
|
||||
});
|
||||
}
|
||||
|
||||
public override void UpdateAI(uint diff)
|
||||
{
|
||||
_scheduler.Update(diff);
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 26374 - Elune's Candle
|
||||
class spell_lunar_festival_elune_candle : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.EluneCandleOmenHead, SpellIds.EluneCandleOmenChest, SpellIds.EluneCandleOmenHandR, SpellIds.EluneCandleOmenHandL, SpellIds.EluneCandleNormal);
|
||||
}
|
||||
|
||||
void HandleScript(uint effIndex)
|
||||
{
|
||||
uint spellId = 0;
|
||||
|
||||
if (GetHitUnit().GetEntry() == CreatureIds.Omen)
|
||||
{
|
||||
switch (RandomHelper.URand(0, 3))
|
||||
{
|
||||
case 0:
|
||||
spellId = SpellIds.EluneCandleOmenHead;
|
||||
break;
|
||||
case 1:
|
||||
spellId = SpellIds.EluneCandleOmenChest;
|
||||
break;
|
||||
case 2:
|
||||
spellId = SpellIds.EluneCandleOmenHandR;
|
||||
break;
|
||||
case 3:
|
||||
spellId = SpellIds.EluneCandleOmenHandL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
spellId = SpellIds.EluneCandleNormal;
|
||||
|
||||
GetCaster().CastSpell(GetHitUnit(), spellId, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,399 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Game.Entities;
|
||||
using Game.Scripting;
|
||||
using Game.Spells;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Scripts.Events.Midsummer
|
||||
{
|
||||
struct SpellIds
|
||||
{
|
||||
//Brazierhit
|
||||
public const uint TorchTossingTraining = 45716;
|
||||
public const uint TorchTossingPractice = 46630;
|
||||
public const uint TorchTossingTrainingSuccessAlliance = 45719;
|
||||
public const uint TorchTossingTrainingSuccessHorde = 46651;
|
||||
public const uint TargetIndicatorCosmetic = 46901;
|
||||
public const uint TargetIndicator = 45723;
|
||||
public const uint BraziersHit = 45724;
|
||||
|
||||
//RibbonPoleData
|
||||
public const uint HasFullMidsummerSet = 58933;
|
||||
public const uint BurningHotPoleDance = 58934;
|
||||
public const uint RibbonPolePeriodicVisual = 45406;
|
||||
public const uint RibbonDance = 29175;
|
||||
public const uint TestRibbonPole1 = 29705;
|
||||
public const uint TestRibbonPole2 = 29726;
|
||||
public const uint TestRibbonPole3 = 29727;
|
||||
|
||||
//Jugglingtorch
|
||||
public const uint JuggleTorchSlow = 45792;
|
||||
public const uint JuggleTorchMedium = 45806;
|
||||
public const uint JuggleTorchFast = 45816;
|
||||
public const uint JuggleTorchSelf = 45638;
|
||||
public const uint JuggleTorchShadowSlow = 46120;
|
||||
public const uint JuggleTorchShadowMedium = 46118;
|
||||
public const uint JuggleTorchShadowFast = 46117;
|
||||
public const uint JuggleTorchShadowSelf = 46121;
|
||||
public const uint GiveTorch = 45280;
|
||||
|
||||
//Flingtorch
|
||||
public const uint FlingTorchTriggered = 45669;
|
||||
public const uint FlingTorchShadow = 46105;
|
||||
public const uint JuggleTorchMissed = 45676;
|
||||
public const uint TorchesCaught = 45693;
|
||||
public const uint TorchCatchingSuccessAlliance = 46081;
|
||||
public const uint TorchCatchingSuccessHorde = 46654;
|
||||
public const uint TorchCatchingRemoveTorches = 46084;
|
||||
}
|
||||
|
||||
struct QuestIds
|
||||
{
|
||||
//JugglingTorch
|
||||
public const uint TorchCatchingA = 11657;
|
||||
public const uint TorchCatchingH = 11923;
|
||||
public const uint MoreTorchCatchingA = 11924;
|
||||
public const uint MoreTorchCatchingH = 1192;
|
||||
}
|
||||
|
||||
[Script] // 45724 - Braziers Hit!
|
||||
class spell_midsummer_braziers_hit : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.TorchTossingTraining, SpellIds.TorchTossingPractice);
|
||||
}
|
||||
|
||||
void HandleEffectApply(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
Player player = GetTarget().ToPlayer();
|
||||
if (!player)
|
||||
return;
|
||||
|
||||
if ((player.HasAura(SpellIds.TorchTossingTraining) && GetStackAmount() == 8) || (player.HasAura(SpellIds.TorchTossingPractice) && GetStackAmount() == 20))
|
||||
{
|
||||
if (player.GetTeam() == Team.Alliance)
|
||||
player.CastSpell(player, SpellIds.TorchTossingTrainingSuccessAlliance, true);
|
||||
else if (player.GetTeam() == Team.Horde)
|
||||
player.CastSpell(player, SpellIds.TorchTossingTrainingSuccessHorde, true);
|
||||
Remove();
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterEffectApply.Add(new EffectApplyHandler(HandleEffectApply, 0, AuraType.Dummy, AuraEffectHandleModes.Reapply));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 45907 - Torch Target Picker
|
||||
class spell_midsummer_torch_target_picker : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.TargetIndicatorCosmetic, SpellIds.TargetIndicator);
|
||||
}
|
||||
|
||||
void HandleScript(uint effIndex)
|
||||
{
|
||||
Unit target = GetHitUnit();
|
||||
target.CastSpell(target, SpellIds.TargetIndicatorCosmetic, true);
|
||||
target.CastSpell(target, SpellIds.TargetIndicator, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 46054 - Torch Toss (land)
|
||||
class spell_midsummer_torch_toss_land : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.BraziersHit);
|
||||
}
|
||||
|
||||
void HandleScript(uint effIndex)
|
||||
{
|
||||
GetHitUnit().CastSpell(GetCaster(), SpellIds.BraziersHit, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 29705, 29726, 29727 - Test Ribbon Pole Channel
|
||||
class spell_midsummer_test_ribbon_pole_channel : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.RibbonPolePeriodicVisual, SpellIds.BurningHotPoleDance, SpellIds.HasFullMidsummerSet, SpellIds.RibbonDance);
|
||||
}
|
||||
|
||||
void HandleRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
GetTarget().RemoveAurasDueToSpell(SpellIds.RibbonPolePeriodicVisual);
|
||||
}
|
||||
|
||||
void PeriodicTick(AuraEffect aurEff)
|
||||
{
|
||||
Unit target = GetTarget();
|
||||
target.CastSpell(target, SpellIds.RibbonPolePeriodicVisual, true);
|
||||
|
||||
Aura aur = target.GetAura(SpellIds.RibbonDance);
|
||||
if (aur != null)
|
||||
{
|
||||
aur.SetMaxDuration(Math.Min(3600000, aur.GetMaxDuration() + 180000));
|
||||
aur.RefreshDuration();
|
||||
|
||||
if (aur.GetMaxDuration() == 3600000 && target.HasAura(SpellIds.HasFullMidsummerSet))
|
||||
target.CastSpell(target, SpellIds.BurningHotPoleDance, true);
|
||||
}
|
||||
else
|
||||
target.CastSpell(target, SpellIds.RibbonDance, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterEffectRemove.Add(new EffectApplyHandler(HandleRemove, 1, AuraType.PeriodicTriggerSpell, AuraEffectHandleModes.Real));
|
||||
OnEffectPeriodic.Add(new EffectPeriodicHandler(PeriodicTick, 1, AuraType.PeriodicTriggerSpell));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 45406 - Holiday - Midsummer, Ribbon Pole Periodic Visual
|
||||
class spell_midsummer_ribbon_pole_periodic_visual : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.TestRibbonPole1, SpellIds.TestRibbonPole2, SpellIds.TestRibbonPole3);
|
||||
}
|
||||
|
||||
void PeriodicTick(AuraEffect aurEff)
|
||||
{
|
||||
Unit target = GetTarget();
|
||||
if (!target.HasAura(SpellIds.TestRibbonPole1) && !target.HasAura(SpellIds.TestRibbonPole2) && !target.HasAura(SpellIds.TestRibbonPole3))
|
||||
Remove();
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectPeriodic.Add(new EffectPeriodicHandler(PeriodicTick, 0, AuraType.PeriodicDummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 45819 - Throw Torch
|
||||
class spell_midsummer_juggle_torch : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.JuggleTorchSlow, SpellIds.JuggleTorchMedium, SpellIds.JuggleTorchFast, SpellIds.JuggleTorchSelf,
|
||||
SpellIds.JuggleTorchShadowSlow, SpellIds.JuggleTorchShadowMedium, SpellIds.JuggleTorchShadowFast, SpellIds.JuggleTorchShadowSelf);
|
||||
}
|
||||
|
||||
void HandleDummy(uint effIndex)
|
||||
{
|
||||
if (GetExplTargetDest() == null)
|
||||
return;
|
||||
|
||||
Position spellDest = GetExplTargetDest();
|
||||
float distance = GetCaster().GetExactDist2d(spellDest.GetPositionX(), spellDest.GetPositionY());
|
||||
|
||||
uint torchSpellID = 0;
|
||||
uint torchShadowSpellID = 0;
|
||||
|
||||
if (distance <= 1.5f)
|
||||
{
|
||||
torchSpellID = SpellIds.JuggleTorchSelf;
|
||||
torchShadowSpellID = SpellIds.JuggleTorchShadowSelf;
|
||||
spellDest = GetCaster().GetPosition();
|
||||
}
|
||||
else if (distance <= 10.0f)
|
||||
{
|
||||
torchSpellID = SpellIds.JuggleTorchSlow;
|
||||
torchShadowSpellID = SpellIds.JuggleTorchShadowSlow;
|
||||
}
|
||||
else if (distance <= 20.0f)
|
||||
{
|
||||
torchSpellID = SpellIds.JuggleTorchMedium;
|
||||
torchShadowSpellID = SpellIds.JuggleTorchShadowMedium;
|
||||
}
|
||||
else
|
||||
{
|
||||
torchSpellID = SpellIds.JuggleTorchFast;
|
||||
torchShadowSpellID = SpellIds.JuggleTorchShadowFast;
|
||||
}
|
||||
|
||||
GetCaster().CastSpell(spellDest, torchSpellID, new CastSpellExtraArgs(false));
|
||||
GetCaster().CastSpell(spellDest, torchShadowSpellID, new CastSpellExtraArgs(false));
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHit.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 45644 - Juggle Torch (Catch)
|
||||
class spell_midsummer_torch_catch : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.GiveTorch);
|
||||
}
|
||||
|
||||
void HandleDummy(uint effIndex)
|
||||
{
|
||||
Player player = GetHitPlayer();
|
||||
if (!player)
|
||||
return;
|
||||
|
||||
if (player.GetQuestStatus(QuestIds.TorchCatchingA) == QuestStatus.Rewarded || player.GetQuestStatus(QuestIds.TorchCatchingH) == QuestStatus.Rewarded)
|
||||
player.CastSpell(player, SpellIds.GiveTorch);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 46747 - Fling torch
|
||||
class spell_midsummer_fling_torch : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.FlingTorchTriggered, SpellIds.FlingTorchShadow);
|
||||
}
|
||||
|
||||
void HandleDummy(uint effIndex)
|
||||
{
|
||||
Position dest = GetCaster().GetFirstCollisionPosition(30.0f, (float)RandomHelper.NextDouble() * (2 * MathF.PI));
|
||||
GetCaster().CastSpell(dest, SpellIds.FlingTorchTriggered, new CastSpellExtraArgs(true));
|
||||
GetCaster().CastSpell(dest, SpellIds.FlingTorchShadow, new CastSpellExtraArgs(false));
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHit.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 45669 - Fling Torch
|
||||
class spell_midsummer_fling_torch_triggered : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.JuggleTorchMissed);
|
||||
}
|
||||
|
||||
void HandleTriggerMissile(uint effIndex)
|
||||
{
|
||||
Position pos = GetHitDest();
|
||||
if (pos != null)
|
||||
{
|
||||
if (GetCaster().GetExactDist2d(pos) > 3.0f)
|
||||
{
|
||||
PreventHitEffect(effIndex);
|
||||
GetCaster().CastSpell(GetExplTargetDest(), SpellIds.JuggleTorchMissed, new CastSpellExtraArgs(false));
|
||||
GetCaster().RemoveAura(SpellIds.TorchesCaught);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHit.Add(new EffectHandler(HandleTriggerMissile, 0, SpellEffectName.TriggerMissile));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 45671 - Juggle Torch (Catch, Quest)
|
||||
class spell_midsummer_fling_torch_catch : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.FlingTorchTriggered, SpellIds.TorchCatchingSuccessAlliance, SpellIds.TorchCatchingSuccessHorde, SpellIds.TorchCatchingRemoveTorches, SpellIds.FlingTorchShadow);
|
||||
}
|
||||
|
||||
void HandleScriptEffect(uint effIndex)
|
||||
{
|
||||
Player player = GetHitPlayer();
|
||||
if (!player)
|
||||
return;
|
||||
|
||||
if (GetExplTargetDest() == null)
|
||||
return;
|
||||
|
||||
// Only the caster can catch the torch
|
||||
if (player.GetGUID() != GetCaster().GetGUID())
|
||||
return;
|
||||
|
||||
byte requiredCatches = 0;
|
||||
// Number of required catches depends on quest - 4 for the normal quest, 10 for the daily version
|
||||
if (player.GetQuestStatus(QuestIds.TorchCatchingA) == QuestStatus.Incomplete || player.GetQuestStatus(QuestIds.TorchCatchingH) == QuestStatus.Incomplete)
|
||||
requiredCatches = 3;
|
||||
else if (player.GetQuestStatus(QuestIds.MoreTorchCatchingA) == QuestStatus.Incomplete || player.GetQuestStatus(QuestIds.MoreTorchCatchingH) == QuestStatus.Incomplete)
|
||||
requiredCatches = 9;
|
||||
|
||||
// Used quest item without being on quest - do nothing
|
||||
if (requiredCatches == 0)
|
||||
return;
|
||||
|
||||
if (player.GetAuraCount(SpellIds.TorchesCaught) >= requiredCatches)
|
||||
{
|
||||
player.CastSpell(player, (player.GetTeam() == Team.Alliance) ? SpellIds.TorchCatchingSuccessAlliance : SpellIds.TorchCatchingSuccessHorde);
|
||||
player.CastSpell(player, SpellIds.TorchCatchingRemoveTorches);
|
||||
player.RemoveAura(SpellIds.TorchesCaught);
|
||||
}
|
||||
else
|
||||
{
|
||||
Position dest = player.GetFirstCollisionPosition(15.0f, (float)RandomHelper.NextDouble() * (2 * MathF.PI));
|
||||
player.CastSpell(player, SpellIds.TorchesCaught);
|
||||
player.CastSpell(dest, SpellIds.FlingTorchTriggered, new CastSpellExtraArgs(true));
|
||||
player.CastSpell(dest, SpellIds.FlingTorchShadow, new CastSpellExtraArgs(false));
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleScriptEffect, 0, SpellEffectName.ScriptEffect));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 45676 - Juggle Torch (Quest, Missed)
|
||||
class spell_midsummer_fling_torch_missed : SpellScript
|
||||
{
|
||||
void FilterTargets(List<WorldObject> targets)
|
||||
{
|
||||
// This spell only hits the caster
|
||||
targets.RemoveAll(obj => obj.GetGUID() != GetCaster().GetGUID());
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 0, Targets.UnitDestAreaEntry));
|
||||
OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 2, Targets.UnitDestAreaEntry));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,494 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Game.Entities;
|
||||
using Game.Scripting;
|
||||
using Game.Spells;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Scripts.Events.PilgrimsBounty
|
||||
{
|
||||
struct SpellIds
|
||||
{
|
||||
//Pilgrims Bounty
|
||||
public const uint WellFedApTrigger = 65414;
|
||||
public const uint WellFedZmTrigger = 65412;
|
||||
public const uint WellFedHitTrigger = 65416;
|
||||
public const uint WellFedHasteTrigger = 65410;
|
||||
public const uint WellFedSpiritTrigger = 65415;
|
||||
|
||||
//FeastOnSpells
|
||||
//Feastonspells
|
||||
public const uint FeastOnTurkey = 61784;
|
||||
public const uint FeastOnCranberries = 61785;
|
||||
public const uint FeastOnSweetPotatoes = 61786;
|
||||
public const uint FeastOnPie = 61787;
|
||||
public const uint FeastOnStuffing = 61788;
|
||||
public const uint CranberryHelpins = 61841;
|
||||
public const uint TurkeyHelpins = 61842;
|
||||
public const uint StuffingHelpins = 61843;
|
||||
public const uint SweetPotatoHelpins = 61844;
|
||||
public const uint PieHelpins = 61845;
|
||||
public const uint OnPlateEatVisual = 61826;
|
||||
|
||||
//Theturkinator
|
||||
public const uint KillCounterVisual = 62015;
|
||||
public const uint KillCounterVisualMax = 62021;
|
||||
|
||||
//Spiritofsharing
|
||||
public const uint TheSpiritOfSharing = 61849;
|
||||
|
||||
//Bountifultablemisc
|
||||
public const uint OnPlateTurkey = 61928;
|
||||
public const uint OnPlateCranberries = 61925;
|
||||
public const uint OnPlateStuffing = 61927;
|
||||
public const uint OnPlateSweetPotatoes = 61929;
|
||||
public const uint OnPlatePie = 61926;
|
||||
public const uint PassTheTurkey = 66373;
|
||||
public const uint PassTheCranberries = 66372;
|
||||
public const uint PassTheStuffing = 66375;
|
||||
public const uint PassTheSweetPotatoes = 66376;
|
||||
public const uint PassThePie = 66374;
|
||||
public const uint OnPlateVisualPie = 61825;
|
||||
public const uint OnPlateVisualCranberries = 61821;
|
||||
public const uint OnPlateVisualPotatoes = 61824;
|
||||
public const uint OnPlateVisualTurkey = 61822;
|
||||
public const uint OnPlateVisualStuffing = 61823;
|
||||
public const uint AServingOfCranberriesPlate = 61833;
|
||||
public const uint AServingOfTurkeyPlate = 61835;
|
||||
public const uint AServingOfStuffingPlate = 61836;
|
||||
public const uint AServingOfSweetPotatoesPlate = 61837;
|
||||
public const uint AServingOfPiePlate = 61838;
|
||||
public const uint AServingOfCranberriesChair = 61804;
|
||||
public const uint AServingOfTurkeyChair = 61807;
|
||||
public const uint AServingOfStuffingChair = 61806;
|
||||
public const uint AServingOfSweetPotatoesChair = 61808;
|
||||
public const uint AServingOfPieChair = 61805;
|
||||
}
|
||||
|
||||
struct CreatureIds
|
||||
{
|
||||
//BountifulTableMisc
|
||||
public const uint BountifulTable = 32823;
|
||||
}
|
||||
|
||||
struct EmoteIds
|
||||
{
|
||||
//TheTurkinator
|
||||
public const uint TurkeyHunter = 0;
|
||||
public const uint TurkeyDomination = 1;
|
||||
public const uint TurkeySlaughter = 2;
|
||||
public const uint TurkeyTriumph = 3;
|
||||
}
|
||||
|
||||
struct SeatIds
|
||||
{
|
||||
//BountifulTableMisc
|
||||
public const sbyte Player = 0;
|
||||
public const sbyte PlateHolder = 6;
|
||||
}
|
||||
|
||||
[Script("spell_gen_slow_roasted_turkey", SpellIds.WellFedApTrigger)]
|
||||
[Script("spell_gen_cranberry_chutney", SpellIds.WellFedZmTrigger)]
|
||||
[Script("spell_gen_spice_bread_stuffing", SpellIds.WellFedHitTrigger)]
|
||||
[Script("spell_gen_pumpkin_pie", SpellIds.WellFedSpiritTrigger)]
|
||||
[Script("spell_gen_candied_sweet_potato", SpellIds.WellFedHasteTrigger)]
|
||||
class spell_pilgrims_bounty_buff_food : AuraScript
|
||||
{
|
||||
public spell_pilgrims_bounty_buff_food(uint triggeredSpellId)
|
||||
{
|
||||
_triggeredSpellId = triggeredSpellId;
|
||||
_handled = false;
|
||||
}
|
||||
|
||||
void HandleTriggerSpell(AuraEffect aurEff)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
if (_handled)
|
||||
return;
|
||||
|
||||
_handled = true;
|
||||
GetTarget().CastSpell(GetTarget(), _triggeredSpellId, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectPeriodic.Add(new EffectPeriodicHandler(HandleTriggerSpell, 2, AuraType.PeriodicTriggerSpell));
|
||||
}
|
||||
|
||||
readonly uint _triggeredSpellId;
|
||||
|
||||
bool _handled;
|
||||
}
|
||||
|
||||
/* 61784 - Feast On Turkey
|
||||
* 61785 - Feast On Cranberries
|
||||
* 61786 - Feast On Sweet Potatoes
|
||||
* 61787 - Feast On Pie
|
||||
* 61788 - Feast On Stuffing */
|
||||
[Script]
|
||||
class spell_pilgrims_bounty_feast_on_SpellScript : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return !spellInfo.GetEffects().Empty()
|
||||
&& ValidateSpellInfo((uint)spellInfo.GetEffect(0).CalcValue())
|
||||
&& !Global.SpellMgr.GetSpellInfo((uint)spellInfo.GetEffect(0).CalcValue(), Difficulty.None).GetEffects().Empty();
|
||||
}
|
||||
|
||||
void HandleDummy(uint effIndex)
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
|
||||
uint _spellId = 0;
|
||||
switch (GetSpellInfo().Id)
|
||||
{
|
||||
case SpellIds.FeastOnTurkey:
|
||||
_spellId = SpellIds.TurkeyHelpins;
|
||||
break;
|
||||
case SpellIds.FeastOnCranberries:
|
||||
_spellId = SpellIds.CranberryHelpins;
|
||||
break;
|
||||
case SpellIds.FeastOnSweetPotatoes:
|
||||
_spellId = SpellIds.SweetPotatoHelpins;
|
||||
break;
|
||||
case SpellIds.FeastOnPie:
|
||||
_spellId = SpellIds.PieHelpins;
|
||||
break;
|
||||
case SpellIds.FeastOnStuffing:
|
||||
_spellId = SpellIds.StuffingHelpins;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
Vehicle vehicle = caster.GetVehicleKit();
|
||||
if (vehicle != null)
|
||||
{
|
||||
Unit target = vehicle.GetPassenger(0);
|
||||
if (target != null)
|
||||
{
|
||||
Player player = target.ToPlayer();
|
||||
if (player != null)
|
||||
{
|
||||
player.CastSpell(player, SpellIds.OnPlateEatVisual, true);
|
||||
caster.CastSpell(player, _spellId, new CastSpellExtraArgs(TriggerCastFlags.FullMask)
|
||||
.SetOriginalCaster(player.GetGUID()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Aura aura = caster.GetAura((uint)GetEffectValue());
|
||||
if (aura != null)
|
||||
{
|
||||
if (aura.GetStackAmount() == 1)
|
||||
caster.RemoveAurasDueToSpell((uint)aura.GetSpellInfo().GetEffect(0).CalcValue());
|
||||
aura.ModStackAmount(-1);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 62014 - Turkey Tracker
|
||||
class spell_pilgrims_bounty_turkey_tracker_SpellScript : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spell)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.KillCounterVisual, SpellIds.KillCounterVisualMax);
|
||||
}
|
||||
|
||||
void HandleScript(uint effIndex)
|
||||
{
|
||||
Creature caster = GetCaster().ToCreature();
|
||||
Unit target = GetHitUnit();
|
||||
|
||||
if (target == null || caster == null)
|
||||
return;
|
||||
|
||||
if (target.HasAura(SpellIds.KillCounterVisualMax))
|
||||
return;
|
||||
|
||||
Aura aura = target.GetAura(GetSpellInfo().Id);
|
||||
if (aura != null)
|
||||
{
|
||||
switch (aura.GetStackAmount())
|
||||
{
|
||||
case 10:
|
||||
caster.GetAI().Talk(EmoteIds.TurkeyHunter, target);
|
||||
break;
|
||||
case 20:
|
||||
caster.GetAI().Talk(EmoteIds.TurkeyDomination, target);
|
||||
break;
|
||||
case 30:
|
||||
caster.GetAI().Talk(EmoteIds.TurkeySlaughter, target);
|
||||
break;
|
||||
case 40:
|
||||
caster.GetAI().Talk(EmoteIds.TurkeyTriumph, target);
|
||||
target.CastSpell(target, SpellIds.KillCounterVisualMax, true);
|
||||
target.RemoveAurasDueToSpell(GetSpellInfo().Id);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
target.CastSpell(target, SpellIds.KillCounterVisual, true);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleScript, 1, SpellEffectName.ScriptEffect));
|
||||
}
|
||||
}
|
||||
|
||||
[Script("spell_pilgrims_bounty_well_fed_turkey", SpellIds.WellFedApTrigger)]
|
||||
[Script("spell_pilgrims_bounty_well_fed_cranberry", SpellIds.WellFedZmTrigger)]
|
||||
[Script("spell_pilgrims_bounty_well_fed_stuffing", SpellIds.WellFedHitTrigger)]
|
||||
[Script("spell_pilgrims_bounty_well_fed_sweet_potatoes", SpellIds.WellFedHasteTrigger)]
|
||||
[Script("spell_pilgrims_bounty_well_fed_pie", SpellIds.WellFedSpiritTrigger)]
|
||||
class spell_pilgrims_bounty_well_fed_SpellScript : SpellScript
|
||||
{
|
||||
uint _triggeredSpellId;
|
||||
|
||||
public spell_pilgrims_bounty_well_fed_SpellScript(uint triggeredSpellId)
|
||||
{
|
||||
_triggeredSpellId = triggeredSpellId;
|
||||
}
|
||||
|
||||
public override bool Validate(SpellInfo spell)
|
||||
{
|
||||
return ValidateSpellInfo(_triggeredSpellId);
|
||||
}
|
||||
|
||||
void HandleScript(uint effIndex)
|
||||
{
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
Player target = GetHitPlayer();
|
||||
if (target == null)
|
||||
return;
|
||||
|
||||
Aura aura = target.GetAura(GetSpellInfo().Id);
|
||||
if (aura != null)
|
||||
{
|
||||
if (aura.GetStackAmount() == 5)
|
||||
target.CastSpell(target, _triggeredSpellId, true);
|
||||
}
|
||||
|
||||
Aura turkey = target.GetAura(SpellIds.TurkeyHelpins);
|
||||
Aura cranberies = target.GetAura(SpellIds.CranberryHelpins);
|
||||
Aura stuffing = target.GetAura(SpellIds.StuffingHelpins);
|
||||
Aura sweetPotatoes = target.GetAura(SpellIds.SweetPotatoHelpins);
|
||||
Aura pie = target.GetAura(SpellIds.PieHelpins);
|
||||
|
||||
if ((turkey != null && turkey.GetStackAmount() == 5) && (cranberies != null && cranberies.GetStackAmount() == 5) && (stuffing != null && stuffing.GetStackAmount() == 5)
|
||||
&& (sweetPotatoes != null && sweetPotatoes.GetStackAmount() == 5) && (pie != null && pie.GetStackAmount() == 5))
|
||||
{
|
||||
target.CastSpell(target, SpellIds.TheSpiritOfSharing, true);
|
||||
target.RemoveAurasDueToSpell(SpellIds.TurkeyHelpins);
|
||||
target.RemoveAurasDueToSpell(SpellIds.CranberryHelpins);
|
||||
target.RemoveAurasDueToSpell(SpellIds.StuffingHelpins);
|
||||
target.RemoveAurasDueToSpell(SpellIds.SweetPotatoHelpins);
|
||||
target.RemoveAurasDueToSpell(SpellIds.PieHelpins);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleScript, 1, SpellEffectName.ScriptEffect));
|
||||
}
|
||||
}
|
||||
|
||||
[Script("spell_pilgrims_bounty_on_plate_turkey", SpellIds.OnPlateTurkey, SpellIds.PassTheTurkey, SpellIds.OnPlateVisualTurkey, SpellIds.AServingOfTurkeyChair)]
|
||||
[Script("spell_pilgrims_bounty_on_plate_cranberries", SpellIds.OnPlateCranberries, SpellIds.PassTheCranberries, SpellIds.OnPlateVisualCranberries, SpellIds.AServingOfCranberriesChair)]
|
||||
[Script("spell_pilgrims_bounty_on_plate_stuffing", SpellIds.OnPlateStuffing, SpellIds.PassTheStuffing, SpellIds.OnPlateVisualStuffing, SpellIds.AServingOfStuffingChair)]
|
||||
[Script("spell_pilgrims_bounty_on_plate_sweet_potatoes", SpellIds.OnPlateSweetPotatoes, SpellIds.PassTheSweetPotatoes, SpellIds.OnPlateVisualPotatoes, SpellIds.AServingOfSweetPotatoesChair)]
|
||||
[Script("spell_pilgrims_bounty_on_plate_pie", SpellIds.OnPlatePie, SpellIds.PassThePie, SpellIds.OnPlateVisualPie, SpellIds.AServingOfPieChair)]
|
||||
class spell_pilgrims_bounty_on_plate_SpellScript : SpellScript
|
||||
{
|
||||
uint _triggeredSpellId1;
|
||||
uint _triggeredSpellId2;
|
||||
uint _triggeredSpellId3;
|
||||
uint _triggeredSpellId4;
|
||||
|
||||
public spell_pilgrims_bounty_on_plate_SpellScript(uint triggeredSpellId1, uint triggeredSpellId2, uint triggeredSpellId3, uint triggeredSpellId4)
|
||||
{
|
||||
_triggeredSpellId1 = triggeredSpellId1;
|
||||
_triggeredSpellId2 = triggeredSpellId2;
|
||||
_triggeredSpellId3 = triggeredSpellId3;
|
||||
_triggeredSpellId4 = triggeredSpellId4;
|
||||
}
|
||||
|
||||
public override bool Validate(SpellInfo spell)
|
||||
{
|
||||
return ValidateSpellInfo(_triggeredSpellId1, _triggeredSpellId2, _triggeredSpellId3, _triggeredSpellId4);
|
||||
}
|
||||
|
||||
Vehicle GetTable(Unit target)
|
||||
{
|
||||
if (target.IsPlayer())
|
||||
{
|
||||
Unit vehBase = target.GetVehicleBase();
|
||||
if (vehBase != null)
|
||||
{
|
||||
Vehicle table = vehBase.GetVehicle();
|
||||
if (table != null)
|
||||
if (table.GetCreatureEntry() == CreatureIds.BountifulTable)
|
||||
return table;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Vehicle veh = target.GetVehicle();
|
||||
if (veh != null)
|
||||
if (veh.GetCreatureEntry() == CreatureIds.BountifulTable)
|
||||
return veh;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
Unit GetPlateInSeat(Vehicle table, sbyte seat)
|
||||
{
|
||||
Unit holderUnit = table.GetPassenger(SeatIds.PlateHolder);
|
||||
if (holderUnit != null)
|
||||
{
|
||||
Vehicle holder = holderUnit.GetVehicleKit();
|
||||
if (holder != null)
|
||||
return holder.GetPassenger(seat);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
void HandleDummy(uint effIndex)
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
Unit target = GetHitUnit();
|
||||
if (!target || caster == target)
|
||||
return;
|
||||
|
||||
Vehicle table = GetTable(caster);
|
||||
if (!table || table != GetTable(target))
|
||||
return;
|
||||
|
||||
Vehicle casterChair = caster.GetVehicleKit();
|
||||
if (casterChair != null)
|
||||
{
|
||||
Unit casterPlr = casterChair.GetPassenger(SeatIds.Player);
|
||||
if (casterPlr != null)
|
||||
{
|
||||
if (casterPlr == target)
|
||||
return;
|
||||
|
||||
casterPlr.CastSpell(casterPlr, _triggeredSpellId2, true); //Credit for Sharing is Caring(always)
|
||||
|
||||
sbyte seat = target.GetTransSeat();
|
||||
if (target.IsPlayer() && target.GetVehicleBase())
|
||||
seat = target.GetVehicleBase().GetTransSeat();
|
||||
|
||||
Unit plate = GetPlateInSeat(table, seat);
|
||||
if (plate != null)
|
||||
{
|
||||
if (target.IsPlayer()) //Food Fight case
|
||||
{
|
||||
casterPlr.CastSpell(target, _triggeredSpellId1, true);
|
||||
caster.CastSpell(target.GetVehicleBase(), _triggeredSpellId4, true); //CanEat-chair(always)
|
||||
}
|
||||
else
|
||||
{
|
||||
casterPlr.CastSpell(plate, _triggeredSpellId3, true); //Food Visual on plate
|
||||
caster.CastSpell(target, _triggeredSpellId4, true); //CanEat-chair(always)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script("spell_pilgrims_bounty_a_serving_of_cranberries", SpellIds.AServingOfCranberriesPlate)]
|
||||
[Script("spell_pilgrims_bounty_a_serving_of_turkey", SpellIds.AServingOfTurkeyPlate)]
|
||||
[Script("spell_pilgrims_bounty_a_serving_of_stuffing", SpellIds.AServingOfStuffingPlate)]
|
||||
[Script("spell_pilgrims_bounty_a_serving_of_potatoes", SpellIds.AServingOfSweetPotatoesPlate)]
|
||||
[Script("spell_pilgrims_bounty_a_serving_of_pie", SpellIds.AServingOfPiePlate)]
|
||||
class spell_pilgrims_bounty_a_serving_of_AuraScript : AuraScript
|
||||
{
|
||||
uint _triggeredSpellId;
|
||||
|
||||
public spell_pilgrims_bounty_a_serving_of_AuraScript(uint triggeredSpellId)
|
||||
{
|
||||
_triggeredSpellId = triggeredSpellId;
|
||||
}
|
||||
|
||||
public override bool Validate(SpellInfo spell)
|
||||
{
|
||||
return ValidateSpellInfo(_triggeredSpellId);
|
||||
}
|
||||
|
||||
void OnApply(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
Unit target = GetTarget();
|
||||
target.CastSpell(target, (uint)aurEff.GetAmount(), true);
|
||||
HandlePlate(target, true);
|
||||
}
|
||||
|
||||
void OnRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
Unit target = GetTarget();
|
||||
target.RemoveAurasDueToSpell((uint)aurEff.GetAmount());
|
||||
HandlePlate(target, false);
|
||||
}
|
||||
|
||||
void HandlePlate(Unit target, bool apply)
|
||||
{
|
||||
Vehicle table = target.GetVehicle();
|
||||
if (table != null)
|
||||
{
|
||||
Unit holderUnit = table.GetPassenger(SeatIds.PlateHolder);
|
||||
if (holderUnit != null)
|
||||
{
|
||||
Vehicle holder = holderUnit.GetVehicleKit();
|
||||
if (holder != null)
|
||||
{
|
||||
Unit plate = holder.GetPassenger(target.GetTransSeat());
|
||||
if (plate != null)
|
||||
{
|
||||
if (apply)
|
||||
target.CastSpell(plate, _triggeredSpellId, true);
|
||||
else
|
||||
plate.RemoveAurasDueToSpell(_triggeredSpellId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterEffectApply.Add(new EffectApplyHandler(OnApply, 0, AuraType.Dummy, AuraEffectHandleModes.Real));
|
||||
OnEffectRemove.Add(new EffectApplyHandler(OnRemove, 0, AuraType.Dummy, AuraEffectHandleModes.Real));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Game.Entities;
|
||||
using Game.Scripting;
|
||||
using Game.Spells;
|
||||
|
||||
namespace Scripts.Events.WinterVeil
|
||||
{
|
||||
struct SpellIds
|
||||
{
|
||||
//Mistletoe
|
||||
public const uint CreateMistletoe = 26206;
|
||||
public const uint CreateHolly = 26207;
|
||||
public const uint CreateSnowflakes = 45036;
|
||||
|
||||
//Winter Wondervolt
|
||||
public const uint Px238WinterWondervoltTransform1 = 26157;
|
||||
public const uint Px238WinterWondervoltTransform2 = 26272;
|
||||
public const uint Px238WinterWondervoltTransform3 = 26273;
|
||||
public const uint Px238WinterWondervoltTransform4 = 26274;
|
||||
}
|
||||
|
||||
[Script] // 26218 - Mistletoe
|
||||
class spell_winter_veil_mistletoe : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spell)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.CreateMistletoe, SpellIds.CreateHolly, SpellIds.CreateSnowflakes);
|
||||
}
|
||||
|
||||
void HandleScript(uint effIndex)
|
||||
{
|
||||
Player target = GetHitPlayer();
|
||||
if (target)
|
||||
{
|
||||
uint spellId = RandomHelper.RAND(SpellIds.CreateHolly, SpellIds.CreateMistletoe, SpellIds.CreateSnowflakes);
|
||||
GetCaster().CastSpell(target, spellId, true);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 26275 - PX-238 Winter Wondervolt TRAP
|
||||
class spell_winter_veil_px_238_winter_wondervolt : SpellScript
|
||||
{
|
||||
static uint[] spells =
|
||||
{
|
||||
SpellIds.Px238WinterWondervoltTransform1,
|
||||
SpellIds.Px238WinterWondervoltTransform2,
|
||||
SpellIds.Px238WinterWondervoltTransform3,
|
||||
SpellIds.Px238WinterWondervoltTransform4
|
||||
};
|
||||
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.Px238WinterWondervoltTransform1, SpellIds.Px238WinterWondervoltTransform2,
|
||||
SpellIds.Px238WinterWondervoltTransform3, SpellIds.Px238WinterWondervoltTransform4);
|
||||
}
|
||||
|
||||
void HandleScript(uint effIndex)
|
||||
{
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
|
||||
Unit target = GetHitUnit();
|
||||
if (target)
|
||||
{
|
||||
for (byte i = 0; i < 4; ++i)
|
||||
if (target.HasAura(spells[i]))
|
||||
return;
|
||||
|
||||
target.CastSpell(target, spells[RandomHelper.URand(0, 3)], true);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,794 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Game;
|
||||
using Game.Entities;
|
||||
using Game.Maps;
|
||||
using Game.Scripting;
|
||||
using Game.Spells;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Scripts.Spells.Holiday
|
||||
{
|
||||
struct SpellIds
|
||||
{
|
||||
//Romantic Picnic
|
||||
public const uint BasketCheck = 45119; // Holiday - Valentine - Romantic Picnic Near Basket Check
|
||||
public const uint MealPeriodic = 45103; // Holiday - Valentine - Romantic Picnic Meal Periodic - Effect Dummy
|
||||
public const uint MealEatVisual = 45120; // Holiday - Valentine - Romantic Picnic Meal Eat Visual
|
||||
//public const uint MealParticle = 45114; // Holiday - Valentine - Romantic Picnic Meal Particle - Unused
|
||||
public const uint DrinkVisual = 45121; // Holiday - Valentine - Romantic Picnic Drink Visual
|
||||
public const uint RomanticPicnicAchiev = 45123; // Romantic Picnic Periodic = 5000
|
||||
|
||||
//Trickspells
|
||||
public const uint PirateCostumeMale = 24708;
|
||||
public const uint PirateCostumeFemale = 24709;
|
||||
public const uint NinjaCostumeMale = 24710;
|
||||
public const uint NinjaCostumeFemale = 24711;
|
||||
public const uint LeperGnomeCostumeMale = 24712;
|
||||
public const uint LeperGnomeCostumeFemale = 24713;
|
||||
public const uint SkeletonCostume = 24723;
|
||||
public const uint GhostCostumeMale = 24735;
|
||||
public const uint GhostCostumeFemale = 24736;
|
||||
public const uint TrickBuff = 24753;
|
||||
|
||||
//Trickortreatspells
|
||||
public const uint Trick = 24714;
|
||||
public const uint Treat = 24715;
|
||||
public const uint TrickedOrTreated = 24755;
|
||||
public const uint TrickyTreatSpeed = 42919;
|
||||
public const uint TrickyTreatTrigger = 42965;
|
||||
public const uint UpsetTummy = 42966;
|
||||
|
||||
//Wand Spells
|
||||
public const uint HallowedWandPirate = 24717;
|
||||
public const uint HallowedWandNinja = 24718;
|
||||
public const uint HallowedWandLeperGnome = 24719;
|
||||
public const uint HallowedWandRandom = 24720;
|
||||
public const uint HallowedWandSkeleton = 24724;
|
||||
public const uint HallowedWandWisp = 24733;
|
||||
public const uint HallowedWandGhost = 24737;
|
||||
public const uint HallowedWandBat = 24741;
|
||||
|
||||
//Pilgrims Bounty
|
||||
public const uint WellFedApTrigger = 65414;
|
||||
public const uint WellFedZmTrigger = 65412;
|
||||
public const uint WellFedHitTrigger = 65416;
|
||||
public const uint WellFedHasteTrigger = 65410;
|
||||
public const uint WellFedSpiritTrigger = 65415;
|
||||
|
||||
//Mistletoe
|
||||
public const uint CreateMistletoe = 26206;
|
||||
public const uint CreateHolly = 26207;
|
||||
public const uint CreateSnowflakes = 45036;
|
||||
|
||||
//Winter Wondervolt
|
||||
public const uint Px238WinterWondervoltTransform1 = 26157;
|
||||
public const uint Px238WinterWondervoltTransform2 = 26272;
|
||||
public const uint Px238WinterWondervoltTransform3 = 26273;
|
||||
public const uint Px238WinterWondervoltTransform4 = 26274;
|
||||
|
||||
//Ramblabla
|
||||
public const uint Giddyup = 42924;
|
||||
public const uint RentalRacingRam = 43883;
|
||||
public const uint SwiftWorkRam = 43880;
|
||||
public const uint RentalRacingRamAura = 42146;
|
||||
public const uint RamLevelNeutral = 43310;
|
||||
public const uint RamTrot = 42992;
|
||||
public const uint RamCanter = 42993;
|
||||
public const uint RamGallop = 42994;
|
||||
public const uint RamFatigue = 43052;
|
||||
public const uint ExhaustedRam = 43332;
|
||||
public const uint RelayRaceTurnIn = 44501;
|
||||
|
||||
//Brazierhit
|
||||
public const uint TorchTossingTraining = 45716;
|
||||
public const uint TorchTossingPractice = 46630;
|
||||
public const uint TorchTossingTrainingSuccessAlliance = 45719;
|
||||
public const uint TorchTossingTrainingSuccessHorde = 46651;
|
||||
public const uint BraziersHit = 45724;
|
||||
|
||||
//Ribbonpoledata
|
||||
public const uint HasFullMidsummerSet = 58933;
|
||||
public const uint BurningHotPoleDance = 58934;
|
||||
public const uint RibbonDanceCosmetic = 29726;
|
||||
public const uint RibbonDance = 29175;
|
||||
}
|
||||
|
||||
struct QuestIds
|
||||
{
|
||||
//Ramblabla
|
||||
public const uint BrewfestSpeedBunnyGreen = 43345;
|
||||
public const uint BrewfestSpeedBunnyYellow = 43346;
|
||||
public const uint BrewfestSpeedBunnyRed = 43347;
|
||||
|
||||
//Barkerbunny
|
||||
// Horde
|
||||
public const uint BarkForDrohnsDistillery = 11407;
|
||||
public const uint BarkForTchalisVoodooBrewery = 11408;
|
||||
|
||||
// Alliance
|
||||
public const uint BarkBarleybrew = 11293;
|
||||
public const uint BarkForThunderbrews = 11294;
|
||||
}
|
||||
|
||||
struct TextIds
|
||||
{
|
||||
// Bark For Drohn'S Distillery!
|
||||
public const uint DrohnDistillery1 = 23520;
|
||||
public const uint DrohnDistillery2 = 23521;
|
||||
public const uint DrohnDistillery3 = 23522;
|
||||
public const uint DrohnDistillery4 = 23523;
|
||||
|
||||
// Bark For T'Chali'S Voodoo Brewery!
|
||||
public const uint TChalisVoodoo1 = 23524;
|
||||
public const uint TChalisVoodoo2 = 23525;
|
||||
public const uint TChalisVoodoo3 = 23526;
|
||||
public const uint TChalisVoodoo4 = 23527;
|
||||
|
||||
// Bark For The Barleybrews!
|
||||
public const uint Barleybrew1 = 23464;
|
||||
public const uint Barleybrew2 = 23465;
|
||||
public const uint Barleybrew3 = 23466;
|
||||
public const uint Barleybrew4 = 22941;
|
||||
|
||||
// Bark For The Thunderbrews!
|
||||
public const uint Thunderbrews1 = 23467;
|
||||
public const uint Thunderbrews2 = 23468;
|
||||
public const uint Thunderbrews3 = 23469;
|
||||
public const uint Thunderbrews4 = 22942;
|
||||
}
|
||||
|
||||
struct GameobjectIds
|
||||
{
|
||||
public const uint RibbonPole = 181605;
|
||||
}
|
||||
|
||||
[Script] // 45102 Romantic Picnic
|
||||
class spell_love_is_in_the_air_romantic_picnic : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.BasketCheck, SpellIds.MealPeriodic, SpellIds.MealEatVisual, SpellIds.DrinkVisual, SpellIds.RomanticPicnicAchiev);
|
||||
}
|
||||
|
||||
void OnApply(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
Unit target = GetTarget();
|
||||
target.SetStandState(UnitStandStateType.Sit);
|
||||
target.CastSpell(target, SpellIds.MealPeriodic);
|
||||
}
|
||||
|
||||
void OnPeriodic(AuraEffect aurEff)
|
||||
{
|
||||
// Every 5 seconds
|
||||
Unit target = GetTarget();
|
||||
|
||||
// If our player is no longer sit, Remove all auras
|
||||
if (target.GetStandState() != UnitStandStateType.Sit)
|
||||
{
|
||||
target.RemoveAura(SpellIds.RomanticPicnicAchiev);
|
||||
target.RemoveAura(GetAura());
|
||||
return;
|
||||
}
|
||||
|
||||
target.CastSpell(target, SpellIds.BasketCheck); // unknown use, it targets Romantic Basket
|
||||
target.CastSpell(target, RandomHelper.RAND(SpellIds.MealEatVisual, SpellIds.DrinkVisual));
|
||||
|
||||
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
|
||||
List<Unit> playerList = new();
|
||||
AnyPlayerInObjectRangeCheck checker = new(target, SharedConst.InteractionDistance * 2);
|
||||
var searcher = new PlayerListSearcher(target, playerList, checker);
|
||||
Cell.VisitWorldObjects(target, searcher, SharedConst.InteractionDistance * 2);
|
||||
foreach (Player playerFound in playerList)
|
||||
{
|
||||
if (target != playerFound && playerFound.HasAura(GetId()))
|
||||
{
|
||||
playerFound.CastSpell(playerFound, SpellIds.RomanticPicnicAchiev, true);
|
||||
target.CastSpell(target, SpellIds.RomanticPicnicAchiev, true);
|
||||
foundSomeone = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!foundSomeone && target.HasAura(SpellIds.RomanticPicnicAchiev))
|
||||
target.RemoveAura(SpellIds.RomanticPicnicAchiev);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterEffectApply.Add(new EffectApplyHandler(OnApply, 0, AuraType.PeriodicDummy, AuraEffectHandleModes.Real));
|
||||
OnEffectPeriodic.Add(new EffectPeriodicHandler(OnPeriodic, 0, AuraType.PeriodicDummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 24750 Trick
|
||||
class spell_hallow_end_trick : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spell)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.PirateCostumeMale, SpellIds.PirateCostumeFemale, SpellIds.NinjaCostumeMale, SpellIds.NinjaCostumeFemale,
|
||||
SpellIds.LeperGnomeCostumeMale, SpellIds.LeperGnomeCostumeFemale, SpellIds.SkeletonCostume, SpellIds.GhostCostumeMale, SpellIds.GhostCostumeFemale, SpellIds.TrickBuff);
|
||||
}
|
||||
|
||||
void HandleScript(uint effIndex)
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
Player target = GetHitPlayer();
|
||||
if (target)
|
||||
{
|
||||
Gender gender = target.GetNativeGender();
|
||||
uint spellId = SpellIds.TrickBuff;
|
||||
switch (RandomHelper.URand(0, 5))
|
||||
{
|
||||
case 1:
|
||||
spellId = gender == Gender.Female ? SpellIds.LeperGnomeCostumeFemale : SpellIds.LeperGnomeCostumeMale;
|
||||
break;
|
||||
case 2:
|
||||
spellId = gender == Gender.Female ? SpellIds.PirateCostumeFemale : SpellIds.PirateCostumeMale;
|
||||
break;
|
||||
case 3:
|
||||
spellId = gender == Gender.Female ? SpellIds.GhostCostumeFemale : SpellIds.GhostCostumeMale;
|
||||
break;
|
||||
case 4:
|
||||
spellId = gender == Gender.Female ? SpellIds.NinjaCostumeFemale : SpellIds.NinjaCostumeMale;
|
||||
break;
|
||||
case 5:
|
||||
spellId = SpellIds.SkeletonCostume;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
caster.CastSpell(target, spellId, true);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 24751 Trick or Treat
|
||||
class spell_hallow_end_trick_or_treat : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spell)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.Trick, SpellIds.Treat, SpellIds.TrickedOrTreated);
|
||||
}
|
||||
|
||||
void HandleScript(uint effIndex)
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
Player target = GetHitPlayer();
|
||||
if (target)
|
||||
{
|
||||
caster.CastSpell(target, RandomHelper.randChance(50) ? SpellIds.Trick : SpellIds.Treat, true);
|
||||
caster.CastSpell(target, SpellIds.TrickedOrTreated, true);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 44436 - Tricky Treat
|
||||
class spell_hallow_end_tricky_treat : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spell)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.TrickyTreatSpeed, SpellIds.TrickyTreatTrigger, SpellIds.UpsetTummy);
|
||||
}
|
||||
|
||||
void HandleScript(uint effIndex)
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
if (caster.HasAura(SpellIds.TrickyTreatTrigger) && caster.GetAuraCount(SpellIds.TrickyTreatSpeed) > 3 && RandomHelper.randChance(33))
|
||||
caster.CastSpell(caster, SpellIds.UpsetTummy, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 24717, 24718, 24719, 24720, 24724, 24733, 24737, 24741
|
||||
class spell_hallow_end_wand : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellEntry)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.PirateCostumeMale, SpellIds.PirateCostumeFemale, SpellIds.NinjaCostumeMale, SpellIds.NinjaCostumeFemale,
|
||||
SpellIds.LeperGnomeCostumeMale, SpellIds.LeperGnomeCostumeFemale, SpellIds.GhostCostumeMale, SpellIds.GhostCostumeFemale);
|
||||
}
|
||||
|
||||
void HandleScriptEffect()
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
Unit target = GetHitUnit();
|
||||
|
||||
uint spellId;
|
||||
bool female = target.GetNativeGender() == Gender.Female;
|
||||
|
||||
switch (GetSpellInfo().Id)
|
||||
{
|
||||
case SpellIds.HallowedWandLeperGnome:
|
||||
spellId = female ? SpellIds.LeperGnomeCostumeFemale : SpellIds.LeperGnomeCostumeMale;
|
||||
break;
|
||||
case SpellIds.HallowedWandPirate:
|
||||
spellId = female ? SpellIds.PirateCostumeFemale : SpellIds.PirateCostumeMale;
|
||||
break;
|
||||
case SpellIds.HallowedWandGhost:
|
||||
spellId = female ? SpellIds.GhostCostumeFemale : SpellIds.GhostCostumeMale;
|
||||
break;
|
||||
case SpellIds.HallowedWandNinja:
|
||||
spellId = female ? SpellIds.NinjaCostumeFemale : SpellIds.NinjaCostumeMale;
|
||||
break;
|
||||
case SpellIds.HallowedWandRandom:
|
||||
spellId = RandomHelper.RAND(SpellIds.HallowedWandPirate, SpellIds.HallowedWandNinja, SpellIds.HallowedWandLeperGnome, SpellIds.HallowedWandSkeleton, SpellIds.HallowedWandWisp, SpellIds.HallowedWandGhost, SpellIds.HallowedWandBat);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
caster.CastSpell(target, spellId, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterHit.Add(new HitHandler(HandleScriptEffect));
|
||||
}
|
||||
}
|
||||
|
||||
[Script("spell_gen_slow_roasted_turkey", SpellIds.WellFedApTrigger)]
|
||||
[Script("spell_gen_cranberry_chutney", SpellIds.WellFedZmTrigger)]
|
||||
[Script("spell_gen_spice_bread_stuffing", SpellIds.WellFedHitTrigger)]
|
||||
[Script("spell_gen_pumpkin_pie", SpellIds.WellFedSpiritTrigger)]
|
||||
[Script("spell_gen_candied_sweet_potato", SpellIds.WellFedHasteTrigger)]
|
||||
class spell_pilgrims_bounty_buff_food : AuraScript
|
||||
{
|
||||
public spell_pilgrims_bounty_buff_food(uint triggeredSpellId)
|
||||
{
|
||||
_triggeredSpellId = triggeredSpellId;
|
||||
_handled = false;
|
||||
}
|
||||
|
||||
void HandleTriggerSpell(AuraEffect aurEff)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
if (_handled)
|
||||
return;
|
||||
|
||||
_handled = true;
|
||||
GetTarget().CastSpell(GetTarget(), _triggeredSpellId, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectPeriodic.Add(new EffectPeriodicHandler(HandleTriggerSpell, 2, AuraType.PeriodicTriggerSpell));
|
||||
}
|
||||
|
||||
readonly uint _triggeredSpellId;
|
||||
|
||||
bool _handled;
|
||||
}
|
||||
|
||||
[Script] // 26218 - Mistletoe
|
||||
class spell_winter_veil_mistletoe : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spell)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.CreateMistletoe, SpellIds.CreateHolly, SpellIds.CreateSnowflakes);
|
||||
}
|
||||
|
||||
void HandleScript(uint effIndex)
|
||||
{
|
||||
Player target = GetHitPlayer();
|
||||
if (target)
|
||||
{
|
||||
uint spellId = RandomHelper.RAND(SpellIds.CreateHolly, SpellIds.CreateMistletoe, SpellIds.CreateSnowflakes);
|
||||
GetCaster().CastSpell(target, spellId, true);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 26275 - PX-238 Winter Wondervolt TRAP
|
||||
class spell_winter_veil_px_238_winter_wondervolt : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.Px238WinterWondervoltTransform1, SpellIds.Px238WinterWondervoltTransform2,
|
||||
SpellIds.Px238WinterWondervoltTransform3, SpellIds.Px238WinterWondervoltTransform4);
|
||||
}
|
||||
|
||||
void HandleScript(uint effIndex)
|
||||
{
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
|
||||
uint[] spells =
|
||||
{
|
||||
SpellIds.Px238WinterWondervoltTransform1,
|
||||
SpellIds.Px238WinterWondervoltTransform2,
|
||||
SpellIds.Px238WinterWondervoltTransform3,
|
||||
SpellIds.Px238WinterWondervoltTransform4
|
||||
};
|
||||
|
||||
Unit target = GetHitUnit();
|
||||
if (target)
|
||||
{
|
||||
for (byte i = 0; i < 4; ++i)
|
||||
if (target.HasAura(spells[i]))
|
||||
return;
|
||||
|
||||
target.CastSpell(target, spells[RandomHelper.URand(0, 3)], true);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 42924 - Giddyup!
|
||||
class spell_brewfest_giddyup : AuraScript
|
||||
{
|
||||
void OnChange(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
Unit target = GetTarget();
|
||||
if (!target.HasAura(SpellIds.RentalRacingRam) && !target.HasAura(SpellIds.SwiftWorkRam))
|
||||
{
|
||||
target.RemoveAura(GetId());
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.HasAura(SpellIds.ExhaustedRam))
|
||||
return;
|
||||
|
||||
switch (GetStackAmount())
|
||||
{
|
||||
case 1: // green
|
||||
target.RemoveAura(SpellIds.RamLevelNeutral);
|
||||
target.RemoveAura(SpellIds.RamCanter);
|
||||
target.CastSpell(target, SpellIds.RamTrot, true);
|
||||
break;
|
||||
case 6: // yellow
|
||||
target.RemoveAura(SpellIds.RamTrot);
|
||||
target.RemoveAura(SpellIds.RamGallop);
|
||||
target.CastSpell(target, SpellIds.RamCanter, true);
|
||||
break;
|
||||
case 11: // red
|
||||
target.RemoveAura(SpellIds.RamCanter);
|
||||
target.CastSpell(target, SpellIds.RamGallop, true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (GetTargetApplication().GetRemoveMode() == AuraRemoveMode.Default)
|
||||
{
|
||||
target.RemoveAura(SpellIds.RamTrot);
|
||||
target.CastSpell(target, SpellIds.RamLevelNeutral, true);
|
||||
}
|
||||
}
|
||||
|
||||
void OnPeriodic(AuraEffect aurEff)
|
||||
{
|
||||
GetTarget().RemoveAuraFromStack(GetId());
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterEffectApply.Add(new EffectApplyHandler(OnChange, 0, AuraType.PeriodicDummy, AuraEffectHandleModes.ChangeAmountMask));
|
||||
OnEffectRemove.Add(new EffectApplyHandler(OnChange, 0, AuraType.PeriodicDummy, AuraEffectHandleModes.ChangeAmountMask));
|
||||
OnEffectPeriodic.Add(new EffectPeriodicHandler(OnPeriodic, 0, AuraType.PeriodicDummy));
|
||||
}
|
||||
}
|
||||
|
||||
// 43310 - Ram Level - Neutral
|
||||
// 42992 - Ram - Trot
|
||||
// 42993 - Ram - Canter
|
||||
// 42994 - Ram - Gallop
|
||||
[Script]
|
||||
class spell_brewfest_ram : AuraScript
|
||||
{
|
||||
void OnPeriodic(AuraEffect aurEff)
|
||||
{
|
||||
Unit target = GetTarget();
|
||||
if (target.HasAura(SpellIds.ExhaustedRam))
|
||||
return;
|
||||
|
||||
switch (GetId())
|
||||
{
|
||||
case SpellIds.RamLevelNeutral:
|
||||
{
|
||||
Aura aura = target.GetAura(SpellIds.RamFatigue);
|
||||
if (aura != null)
|
||||
aura.ModStackAmount(-4);
|
||||
}
|
||||
break;
|
||||
case SpellIds.RamTrot: // green
|
||||
{
|
||||
Aura aura = target.GetAura(SpellIds.RamFatigue);
|
||||
if (aura != null)
|
||||
aura.ModStackAmount(-2);
|
||||
if (aurEff.GetTickNumber() == 4)
|
||||
target.CastSpell(target, QuestIds.BrewfestSpeedBunnyGreen, true);
|
||||
}
|
||||
break;
|
||||
case SpellIds.RamCanter:
|
||||
{
|
||||
CastSpellExtraArgs args = new(TriggerCastFlags.FullMask);
|
||||
args.AddSpellMod(SpellValueMod.AuraStack, 1);
|
||||
target.CastSpell(target, SpellIds.RamFatigue, args);
|
||||
if (aurEff.GetTickNumber() == 8)
|
||||
target.CastSpell(target, QuestIds.BrewfestSpeedBunnyYellow, true);
|
||||
break;
|
||||
}
|
||||
case SpellIds.RamGallop:
|
||||
{
|
||||
CastSpellExtraArgs args = new(TriggerCastFlags.FullMask);
|
||||
args.AddSpellMod(SpellValueMod.AuraStack, target.HasAura(SpellIds.RamFatigue) ? 4 : 5 /*Hack*/);
|
||||
target.CastSpell(target, SpellIds.RamFatigue, args);
|
||||
if (aurEff.GetTickNumber() == 8)
|
||||
target.CastSpell(target, QuestIds.BrewfestSpeedBunnyRed, true);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectPeriodic.Add(new EffectPeriodicHandler(OnPeriodic, 1, AuraType.PeriodicDummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 43052 - Ram Fatigue
|
||||
class spell_brewfest_ram_fatigue : AuraScript
|
||||
{
|
||||
void OnApply(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
Unit target = GetTarget();
|
||||
|
||||
if (GetStackAmount() == 101)
|
||||
{
|
||||
target.RemoveAura(SpellIds.RamLevelNeutral);
|
||||
target.RemoveAura(SpellIds.RamTrot);
|
||||
target.RemoveAura(SpellIds.RamCanter);
|
||||
target.RemoveAura(SpellIds.RamGallop);
|
||||
target.RemoveAura(SpellIds.Giddyup);
|
||||
|
||||
target.CastSpell(target, SpellIds.ExhaustedRam, true);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterEffectApply.Add(new EffectApplyHandler(OnApply, 0, AuraType.Dummy, AuraEffectHandleModes.RealOrReapplyMask));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 43450 - Brewfest - apple trap - friendly DND
|
||||
class spell_brewfest_apple_trap : AuraScript
|
||||
{
|
||||
void OnApply(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
GetTarget().RemoveAura(SpellIds.RamFatigue);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectApply.Add(new EffectApplyHandler(OnApply, 0, AuraType.ForceReaction, AuraEffectHandleModes.Real));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 43332 - Exhausted Ram
|
||||
class spell_brewfest_exhausted_ram : AuraScript
|
||||
{
|
||||
void OnRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
Unit target = GetTarget();
|
||||
target.CastSpell(target, SpellIds.RamLevelNeutral, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectRemove.Add(new EffectApplyHandler(OnRemove, 0, AuraType.ModDecreaseSpeed, AuraEffectHandleModes.Real));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 43714 - Brewfest - Relay Race - Intro - Force - Player to throw- DND
|
||||
class spell_brewfest_relay_race_intro_force_player_to_throw : SpellScript
|
||||
{
|
||||
void HandleForceCast(uint effIndex)
|
||||
{
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
// All this spells trigger a spell that requires reagents; if the
|
||||
// triggered spell is cast as "triggered", reagents are not consumed
|
||||
GetHitUnit().CastSpell((Unit)null, GetEffectInfo().TriggerSpell, new CastSpellExtraArgs(TriggerCastFlags.FullMask & ~TriggerCastFlags.IgnorePowerAndReagentCost));
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleForceCast, 0, SpellEffectName.ForceCast));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 43755 - Brewfest - Daily - Relay Race - Player - Increase Mount Duration - DND
|
||||
class spell_brewfest_relay_race_turn_in : SpellScript
|
||||
{
|
||||
void HandleDummy(uint effIndex)
|
||||
{
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
|
||||
Aura aura = GetHitUnit().GetAura(SpellIds.SwiftWorkRam);
|
||||
if (aura != null)
|
||||
{
|
||||
aura.SetDuration(aura.GetDuration() + 30 * Time.InMilliseconds);
|
||||
GetCaster().CastSpell(GetHitUnit(), SpellIds.RelayRaceTurnIn, new CastSpellExtraArgs(TriggerCastFlags.FullMask));
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 43876 - Dismount Ram
|
||||
class spell_brewfest_dismount_ram : SpellScript
|
||||
{
|
||||
void HandleScript(uint effIndex)
|
||||
{
|
||||
GetCaster().RemoveAura(SpellIds.RentalRacingRam);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect));
|
||||
}
|
||||
}
|
||||
|
||||
// 43259 Brewfest - Barker Bunny 1
|
||||
// 43260 Brewfest - Barker Bunny 2
|
||||
// 43261 Brewfest - Barker Bunny 3
|
||||
// 43262 Brewfest - Barker Bunny 4
|
||||
[Script]
|
||||
class spell_brewfest_barker_bunny : AuraScript
|
||||
{
|
||||
public override bool Load()
|
||||
{
|
||||
return GetUnitOwner().IsTypeId(TypeId.Player);
|
||||
}
|
||||
|
||||
void OnApply(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
Player target = GetTarget().ToPlayer();
|
||||
|
||||
uint BroadcastTextId = 0;
|
||||
|
||||
if (target.GetQuestStatus(QuestIds.BarkForDrohnsDistillery) == QuestStatus.Incomplete ||
|
||||
target.GetQuestStatus(QuestIds.BarkForDrohnsDistillery) == QuestStatus.Complete)
|
||||
BroadcastTextId = RandomHelper.RAND(TextIds.DrohnDistillery1, TextIds.DrohnDistillery2, TextIds.DrohnDistillery3, TextIds.DrohnDistillery4);
|
||||
|
||||
if (target.GetQuestStatus(QuestIds.BarkForTchalisVoodooBrewery) == QuestStatus.Incomplete ||
|
||||
target.GetQuestStatus(QuestIds.BarkForTchalisVoodooBrewery) == QuestStatus.Complete)
|
||||
BroadcastTextId = RandomHelper.RAND(TextIds.TChalisVoodoo1, TextIds.TChalisVoodoo2, TextIds.TChalisVoodoo3, TextIds.TChalisVoodoo4);
|
||||
|
||||
if (target.GetQuestStatus(QuestIds.BarkBarleybrew) == QuestStatus.Incomplete ||
|
||||
target.GetQuestStatus(QuestIds.BarkBarleybrew) == QuestStatus.Complete)
|
||||
BroadcastTextId = RandomHelper.RAND(TextIds.Barleybrew1, TextIds.Barleybrew2, TextIds.Barleybrew3, TextIds.Barleybrew4);
|
||||
|
||||
if (target.GetQuestStatus(QuestIds.BarkForThunderbrews) == QuestStatus.Incomplete ||
|
||||
target.GetQuestStatus(QuestIds.BarkForThunderbrews) == QuestStatus.Complete)
|
||||
BroadcastTextId = RandomHelper.RAND(TextIds.Thunderbrews1, TextIds.Thunderbrews2, TextIds.Thunderbrews3, TextIds.Thunderbrews4);
|
||||
|
||||
if (BroadcastTextId != 0)
|
||||
target.Talk(BroadcastTextId, ChatMsg.Say, WorldConfig.GetFloatValue(WorldCfg.ListenRangeSay), target);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectApply.Add(new EffectApplyHandler(OnApply, 1, AuraType.Dummy, AuraEffectHandleModes.Real));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 45724 - Braziers Hit!
|
||||
class spell_midsummer_braziers_hit : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.TorchTossingTraining, SpellIds.TorchTossingPractice);
|
||||
}
|
||||
|
||||
void HandleEffectApply(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
Player player = GetTarget().ToPlayer();
|
||||
if (!player)
|
||||
return;
|
||||
|
||||
if ((player.HasAura(SpellIds.TorchTossingTraining) && GetStackAmount() == 8) || (player.HasAura(SpellIds.TorchTossingPractice) && GetStackAmount() == 20))
|
||||
{
|
||||
if (player.GetTeam() == Team.Alliance)
|
||||
player.CastSpell(player, SpellIds.TorchTossingTrainingSuccessAlliance, true);
|
||||
else if (player.GetTeam() == Team.Horde)
|
||||
player.CastSpell(player, SpellIds.TorchTossingTrainingSuccessHorde, true);
|
||||
Remove();
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterEffectApply.Add(new EffectApplyHandler(HandleEffectApply, 0, AuraType.Dummy, AuraEffectHandleModes.Reapply));
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class spell_gen_ribbon_pole_dancer_check : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.HasFullMidsummerSet, SpellIds.RibbonDance, SpellIds.BurningHotPoleDance);
|
||||
}
|
||||
|
||||
void PeriodicTick(AuraEffect aurEff)
|
||||
{
|
||||
Unit target = GetTarget();
|
||||
|
||||
// check if aura needs to be Removed
|
||||
if (!target.FindNearestGameObject(GameobjectIds.RibbonPole, 8.0f) || !target.HasUnitState(UnitState.Casting))
|
||||
{
|
||||
target.InterruptNonMeleeSpells(false);
|
||||
target.RemoveAurasDueToSpell(GetId());
|
||||
target.RemoveAura(SpellIds.RibbonDanceCosmetic);
|
||||
return;
|
||||
}
|
||||
|
||||
// set xp buff duration
|
||||
Aura aur = target.GetAura(SpellIds.RibbonDance);
|
||||
if (aur != null)
|
||||
{
|
||||
aur.SetMaxDuration(Math.Min(3600000, aur.GetMaxDuration() + 180000));
|
||||
aur.RefreshDuration();
|
||||
|
||||
// reward achievement criteria
|
||||
if (aur.GetMaxDuration() == 3600000 && target.HasAura(SpellIds.HasFullMidsummerSet))
|
||||
target.CastSpell(target, SpellIds.BurningHotPoleDance, true);
|
||||
}
|
||||
else
|
||||
target.AddAura(SpellIds.RibbonDance, target);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectPeriodic.Add(new EffectPeriodicHandler(PeriodicTick, 0, AuraType.PeriodicDummy));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user