Scripts/Misc: Migrate world event scripts to separate files 2
Port From (https://github.com/TrinityCore/TrinityCore/commit/4281049e0c0d38a968d1d37bdd3ec04e35b81850)
This commit is contained in:
@@ -37,6 +37,14 @@ namespace Scripts.Events.Brewfest
|
||||
public const uint RamFatigue = 43052;
|
||||
public const uint ExhaustedRam = 43332;
|
||||
public const uint RelayRaceTurnIn = 44501;
|
||||
|
||||
//Brewfestmounttransformation
|
||||
public const uint MountRam100 = 43900;
|
||||
public const uint MountRam60 = 43899;
|
||||
public const uint MountKodo100 = 49379;
|
||||
public const uint MountKodo60 = 49378;
|
||||
public const uint BrewfestMountTransform = 49357;
|
||||
public const uint BrewfestMountTransformReverse = 52845;
|
||||
}
|
||||
|
||||
struct QuestIds
|
||||
@@ -348,27 +356,46 @@ namespace Scripts.Events.Brewfest
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[Script]
|
||||
class spell_item_brewfest_mount_transformation : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spell)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.MountRam100, SpellIds.MountRam60, SpellIds.MountKodo100, SpellIds.MountKodo60);
|
||||
}
|
||||
|
||||
void HandleDummy(uint effIndex)
|
||||
{
|
||||
Player caster = GetCaster().ToPlayer();
|
||||
if (caster.HasAuraType(AuraType.Mounted))
|
||||
{
|
||||
caster.RemoveAurasByType(AuraType.Mounted);
|
||||
uint spell_id;
|
||||
|
||||
switch (GetSpellInfo().Id)
|
||||
{
|
||||
case SpellIds.BrewfestMountTransform:
|
||||
if (caster.GetSpeedRate(UnitMoveType.Run) >= 2.0f)
|
||||
spell_id = caster.GetTeam() == Team.Alliance ? SpellIds.MountRam100 : SpellIds.MountKodo100;
|
||||
else
|
||||
spell_id = caster.GetTeam() == Team.Alliance ? SpellIds.MountRam60 : SpellIds.MountKodo60;
|
||||
break;
|
||||
case SpellIds.BrewfestMountTransformReverse:
|
||||
if (caster.GetSpeedRate(UnitMoveType.Run) >= 2.0f)
|
||||
spell_id = caster.GetTeam() == Team.Horde ? SpellIds.MountRam100 : SpellIds.MountKodo100;
|
||||
else
|
||||
spell_id = caster.GetTeam() == Team.Horde ? SpellIds.MountRam60 : SpellIds.MountKodo60;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
caster.CastSpell(caster, spell_id, true);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,16 @@ namespace Scripts.Events.LoveIsInTheAir
|
||||
//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
|
||||
|
||||
//CreateHeartCandy
|
||||
public const uint CreateHeartCandy1 = 26668;
|
||||
public const uint CreateHeartCandy2 = 26670;
|
||||
public const uint CreateHeartCandy3 = 26671;
|
||||
public const uint CreateHeartCandy4 = 26672;
|
||||
public const uint CreateHeartCandy5 = 26673;
|
||||
public const uint CreateHeartCandy6 = 26674;
|
||||
public const uint CreateHeartCandy7 = 26675;
|
||||
public const uint CreateHeartCandy8 = 26676;
|
||||
}
|
||||
|
||||
[Script] // 45102 Romantic Picnic
|
||||
@@ -94,4 +104,32 @@ namespace Scripts.Events.LoveIsInTheAir
|
||||
OnEffectPeriodic.Add(new EffectPeriodicHandler(OnPeriodic, 0, AuraType.PeriodicDummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 26678 - Create Heart Candy
|
||||
class spell_item_create_heart_candy : SpellScript
|
||||
{
|
||||
uint[] CreateHeartCandySpells =
|
||||
{
|
||||
SpellIds.CreateHeartCandy1, SpellIds.CreateHeartCandy2, SpellIds.CreateHeartCandy3, SpellIds.CreateHeartCandy4,
|
||||
SpellIds.CreateHeartCandy5, SpellIds.CreateHeartCandy6, SpellIds.CreateHeartCandy7, SpellIds.CreateHeartCandy8
|
||||
};
|
||||
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(CreateHeartCandySpells);
|
||||
}
|
||||
|
||||
void HandleScript(uint effIndex)
|
||||
{
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
Player target = GetHitPlayer();
|
||||
if (target != null)
|
||||
target.CastSpell(target, CreateHeartCandySpells.SelectRandom(), true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,13 @@ namespace Scripts.Events.WinterVeil
|
||||
public const uint Px238WinterWondervoltTransform2 = 26272;
|
||||
public const uint Px238WinterWondervoltTransform3 = 26273;
|
||||
public const uint Px238WinterWondervoltTransform4 = 26274;
|
||||
|
||||
//Reindeertransformation
|
||||
public const uint FlyingReindeer310 = 44827;
|
||||
public const uint FlyingReindeer280 = 44825;
|
||||
public const uint FlyingReindeer60 = 44824;
|
||||
public const uint Reindeer100 = 25859;
|
||||
public const uint Reindeer60 = 25858;
|
||||
}
|
||||
|
||||
[Script] // 26218 - Mistletoe
|
||||
@@ -98,35 +105,46 @@ namespace Scripts.Events.WinterVeil
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[Script]
|
||||
class spell_item_reindeer_transformation : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spell)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.FlyingReindeer310, SpellIds.FlyingReindeer280, SpellIds.FlyingReindeer60, SpellIds.Reindeer100, SpellIds.Reindeer60);
|
||||
}
|
||||
|
||||
void HandleDummy(uint effIndex)
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
if (caster.HasAuraType(AuraType.Mounted))
|
||||
{
|
||||
float flyspeed = caster.GetSpeedRate(UnitMoveType.Flight);
|
||||
float speed = caster.GetSpeedRate(UnitMoveType.Run);
|
||||
|
||||
caster.RemoveAurasByType(AuraType.Mounted);
|
||||
//5 different spells used depending on mounted speed and if mount can fly or not
|
||||
|
||||
if (flyspeed >= 4.1f)
|
||||
// Flying Reindeer
|
||||
caster.CastSpell(caster, SpellIds.FlyingReindeer310, true); //310% flying Reindeer
|
||||
else if (flyspeed >= 3.8f)
|
||||
// Flying Reindeer
|
||||
caster.CastSpell(caster, SpellIds.FlyingReindeer280, true); //280% flying Reindeer
|
||||
else if (flyspeed >= 1.6f)
|
||||
// Flying Reindeer
|
||||
caster.CastSpell(caster, SpellIds.FlyingReindeer60, true); //60% flying Reindeer
|
||||
else if (speed >= 2.0f)
|
||||
// Reindeer
|
||||
caster.CastSpell(caster, SpellIds.Reindeer100, true); //100% ground Reindeer
|
||||
else
|
||||
// Reindeer
|
||||
caster.CastSpell(caster, SpellIds.Reindeer60, true); //60% ground Reindeer
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1724,48 +1724,6 @@ namespace Scripts.Spells.Generic
|
||||
bool _handled;
|
||||
}
|
||||
|
||||
[Script]
|
||||
class spell_gen_elune_candle : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.OmenHead, SpellIds.OmenChest, SpellIds.OmenHandR, SpellIds.OmenHandL, SpellIds.Normal);
|
||||
}
|
||||
|
||||
void HandleScript(uint effIndex)
|
||||
{
|
||||
uint spellId = 0;
|
||||
|
||||
if (GetHitUnit().GetEntry() == CreatureIds.Omen)
|
||||
{
|
||||
switch (RandomHelper.URand(0, 3))
|
||||
{
|
||||
case 0:
|
||||
spellId = SpellIds.OmenHead;
|
||||
break;
|
||||
case 1:
|
||||
spellId = SpellIds.OmenChest;
|
||||
break;
|
||||
case 2:
|
||||
spellId = SpellIds.OmenHandR;
|
||||
break;
|
||||
case 3:
|
||||
spellId = SpellIds.OmenHandL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
spellId = SpellIds.Normal;
|
||||
|
||||
GetCaster().CastSpell(GetHitUnit(), spellId, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
// 50051 - Ethereal Pet Aura
|
||||
[Script]
|
||||
class spell_ethereal_pet_aura : AuraScript
|
||||
|
||||
@@ -260,16 +260,6 @@ namespace Scripts.Spells.Items
|
||||
public const uint AirRifleShoot = 67532;
|
||||
public const uint AirRifleShootSelf = 65577;
|
||||
|
||||
//CreateHeartCandy
|
||||
public const uint CreateHeartCandy1 = 26668;
|
||||
public const uint CreateHeartCandy2 = 26670;
|
||||
public const uint CreateHeartCandy3 = 26671;
|
||||
public const uint CreateHeartCandy4 = 26672;
|
||||
public const uint CreateHeartCandy5 = 26673;
|
||||
public const uint CreateHeartCandy6 = 26674;
|
||||
public const uint CreateHeartCandy7 = 26675;
|
||||
public const uint CreateHeartCandy8 = 26676;
|
||||
|
||||
//Genericdata
|
||||
public const uint ArcaniteDragonling = 19804;
|
||||
public const uint BattleChicken = 13166;
|
||||
@@ -293,13 +283,6 @@ namespace Scripts.Spells.Items
|
||||
public const uint SummonPurifiedHelboarMeat = 29277;
|
||||
public const uint SummonToxicHelboarMeat = 29278;
|
||||
|
||||
//Reindeertransformation
|
||||
public const uint FlyingReindeer310 = 44827;
|
||||
public const uint FlyingReindeer280 = 44825;
|
||||
public const uint FlyingReindeer60 = 44824;
|
||||
public const uint Reindeer100 = 25859;
|
||||
public const uint Reindeer60 = 25858;
|
||||
|
||||
//Nighinvulnerability
|
||||
public const uint NighInvulnerability = 30456;
|
||||
public const uint CompleteVulnerability = 30457;
|
||||
@@ -321,14 +304,6 @@ namespace Scripts.Spells.Items
|
||||
//Impaleleviroth
|
||||
public const uint LevirothSelfImpale = 49882;
|
||||
|
||||
//Brewfestmounttransformation
|
||||
public const uint MountRam100 = 43900;
|
||||
public const uint MountRam60 = 43899;
|
||||
public const uint MountKodo100 = 49379;
|
||||
public const uint MountKodo60 = 49378;
|
||||
public const uint BrewfestMountTransform = 49357;
|
||||
public const uint BrewfestMountTransformReverse = 52845;
|
||||
|
||||
//Nitroboots
|
||||
public const uint NitroBoostsSuccess = 54861;
|
||||
public const uint NitroBoostsBackfire = 46014;
|
||||
@@ -2441,34 +2416,6 @@ namespace Scripts.Spells.Items
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 26678 - Create Heart Candy
|
||||
class spell_item_create_heart_candy : SpellScript
|
||||
{
|
||||
uint[] CreateHeartCandySpells =
|
||||
{
|
||||
SpellIds.CreateHeartCandy1, SpellIds.CreateHeartCandy2, SpellIds.CreateHeartCandy3, SpellIds.CreateHeartCandy4,
|
||||
SpellIds.CreateHeartCandy5, SpellIds.CreateHeartCandy6, SpellIds.CreateHeartCandy7, SpellIds.CreateHeartCandy8
|
||||
};
|
||||
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(CreateHeartCandySpells);
|
||||
}
|
||||
|
||||
void HandleScript(uint effIndex)
|
||||
{
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
Player target = GetHitPlayer();
|
||||
if (target != null)
|
||||
target.CastSpell(target, CreateHeartCandySpells.SelectRandom(), true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect));
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class spell_item_book_of_glyph_mastery : SpellScript
|
||||
{
|
||||
@@ -2658,49 +2605,6 @@ namespace Scripts.Spells.Items
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class spell_item_reindeer_transformation : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spell)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.FlyingReindeer310, SpellIds.FlyingReindeer280, SpellIds.FlyingReindeer60, SpellIds.Reindeer100, SpellIds.Reindeer60);
|
||||
}
|
||||
|
||||
void HandleDummy(uint effIndex)
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
if (caster.HasAuraType(AuraType.Mounted))
|
||||
{
|
||||
float flyspeed = caster.GetSpeedRate(UnitMoveType.Flight);
|
||||
float speed = caster.GetSpeedRate(UnitMoveType.Run);
|
||||
|
||||
caster.RemoveAurasByType(AuraType.Mounted);
|
||||
//5 different spells used depending on mounted speed and if mount can fly or not
|
||||
|
||||
if (flyspeed >= 4.1f)
|
||||
// Flying Reindeer
|
||||
caster.CastSpell(caster, SpellIds.FlyingReindeer310, true); //310% flying Reindeer
|
||||
else if (flyspeed >= 3.8f)
|
||||
// Flying Reindeer
|
||||
caster.CastSpell(caster, SpellIds.FlyingReindeer280, true); //280% flying Reindeer
|
||||
else if (flyspeed >= 1.6f)
|
||||
// Flying Reindeer
|
||||
caster.CastSpell(caster, SpellIds.FlyingReindeer60, true); //60% flying Reindeer
|
||||
else if (speed >= 2.0f)
|
||||
// Reindeer
|
||||
caster.CastSpell(caster, SpellIds.Reindeer100, true); //100% ground Reindeer
|
||||
else
|
||||
// Reindeer
|
||||
caster.CastSpell(caster, SpellIds.Reindeer60, true); //60% ground Reindeer
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class spell_item_nigh_invulnerability : SpellScript
|
||||
{
|
||||
@@ -2877,49 +2781,6 @@ namespace Scripts.Spells.Items
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class spell_item_brewfest_mount_transformation : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spell)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.MountRam100, SpellIds.MountRam60, SpellIds.MountKodo100, SpellIds.MountKodo60);
|
||||
}
|
||||
|
||||
void HandleDummy(uint effIndex)
|
||||
{
|
||||
Player caster = GetCaster().ToPlayer();
|
||||
if (caster.HasAuraType(AuraType.Mounted))
|
||||
{
|
||||
caster.RemoveAurasByType(AuraType.Mounted);
|
||||
uint spell_id;
|
||||
|
||||
switch (GetSpellInfo().Id)
|
||||
{
|
||||
case SpellIds.BrewfestMountTransform:
|
||||
if (caster.GetSpeedRate(UnitMoveType.Run) >= 2.0f)
|
||||
spell_id = caster.GetTeam() == Team.Alliance ? SpellIds.MountRam100 : SpellIds.MountKodo100;
|
||||
else
|
||||
spell_id = caster.GetTeam() == Team.Alliance ? SpellIds.MountRam60 : SpellIds.MountKodo60;
|
||||
break;
|
||||
case SpellIds.BrewfestMountTransformReverse:
|
||||
if (caster.GetSpeedRate(UnitMoveType.Run) >= 2.0f)
|
||||
spell_id = caster.GetTeam() == Team.Horde ? SpellIds.MountRam100 : SpellIds.MountKodo100;
|
||||
else
|
||||
spell_id = caster.GetTeam() == Team.Horde ? SpellIds.MountRam60 : SpellIds.MountKodo60;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
caster.CastSpell(caster, spell_id, true);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class spell_item_nitro_boosts : SpellScript
|
||||
{
|
||||
|
||||
@@ -176,21 +176,6 @@ namespace Scripts.World.NpcSpecial
|
||||
public const uint HowlingFjord = 67838;
|
||||
public const uint Underground = 68081;
|
||||
|
||||
//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;
|
||||
|
||||
//Rabbitspells
|
||||
public const uint SpringFling = 61875;
|
||||
public const uint SpringRabbitJump = 61724;
|
||||
@@ -1531,217 +1516,6 @@ namespace Scripts.World.NpcSpecial
|
||||
}
|
||||
}
|
||||
|
||||
[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(Misc.AnimGoLaunchFirework);
|
||||
me.SetOrientation(launcher.GetOrientation() + MathFunctions.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() == Misc.ZoneMoonglade)
|
||||
{
|
||||
if (!me.FindNearestCreature(CreatureIds.Omen, 100.0f) && me.GetDistance2d(Misc.omenSummonPos.GetPositionX(), Misc.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, Misc.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_spring_rabbit : ScriptedAI
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user