More work on scripts

This commit is contained in:
hondacrx
2023-10-20 07:29:05 -04:00
parent c56e1752f5
commit 1c6563718e
16 changed files with 3224 additions and 607 deletions
+252 -78
View File
@@ -1,4 +1,4 @@
// Copyright (c) CypherCore <http://github.com/CypherCore> All rights reserved.
// Copyright (c) CypherCore <http://github.com/CypherCore> All rights reserved.
// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information.
using Framework.Constants;
@@ -11,7 +11,6 @@ namespace Scripts.Events.Brewfest
{
struct SpellIds
{
//Ramblabla
public const uint Giddyup = 42924;
public const uint RentalRacingRam = 43883;
public const uint SwiftWorkRam = 43880;
@@ -24,23 +23,14 @@ namespace Scripts.Events.Brewfest
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;
// Quest
public const uint BrewfestQuestSpeedBunnyGreen = 43345;
public const uint BrewfestQuestSpeedBunnyYellow = 43346;
public const uint BrewfestQuestSpeedBunnyRed = 43347;
}
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;
@@ -49,32 +39,31 @@ namespace Scripts.Events.Brewfest
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 Drohn's Distillery!
public const uint SayDrohnDistillery1 = 23520;
public const uint SayDrohnDistillery2 = 23521;
public const uint SayDrohnDistillery3 = 23522;
public const uint SayDrohnDistillery4 = 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 T'chali's Voodoo Brewery!
public const uint SayTchalisVoodoo1 = 23524;
public const uint SayTchalisVoodoo2 = 23525;
public const uint SayTchalisVoodoo3 = 23526;
public const uint SayTchalisVoodoo4 = 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 Barleybrews!
public const uint SayBarleybrew1 = 23464;
public const uint SayBarleybrew2 = 23465;
public const uint SayBarleybrew3 = 23466;
public const uint SayBarleybrew4 = 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;
// Bark for the Thunderbrews!
public const uint SayThunderbrews1 = 23467;
public const uint SayThunderbrews2 = 23468;
public const uint SayThunderbrews3 = 23469;
public const uint SayThunderbrews4 = 22942;
}
[Script] // 42924 - Giddyup!
@@ -126,17 +115,16 @@ namespace Scripts.Events.Brewfest
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));
AfterEffectApply.Add(new(OnChange, 0, AuraType.PeriodicDummy, AuraEffectHandleModes.ChangeAmountMask));
OnEffectRemove.Add(new(OnChange, 0, AuraType.PeriodicDummy, AuraEffectHandleModes.ChangeAmountMask));
OnEffectPeriodic.Add(new(OnPeriodic, 0, AuraType.PeriodicDummy));
}
}
// 43310 - Ram Level - Neutral
// 42992 - Ram - Trot
// 42993 - Ram - Canter
// 42994 - Ram - Gallop
[Script]
[Script] // 42994 - Ram - Gallop
class spell_brewfest_ram : AuraScript
{
void OnPeriodic(AuraEffect aurEff)
@@ -152,43 +140,44 @@ namespace Scripts.Events.Brewfest
Aura aura = target.GetAura(SpellIds.RamFatigue);
if (aura != null)
aura.ModStackAmount(-4);
break;
}
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);
target.CastSpell(target, SpellIds.BrewfestQuestSpeedBunnyGreen, true);
break;
}
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);
target.CastSpell(target, SpellIds.BrewfestQuestSpeedBunnyYellow, true);
break;
}
case SpellIds.RamGallop:
{
CastSpellExtraArgs args = new(TriggerCastFlags.FullMask);
args.AddSpellMod(SpellValueMod.AuraStack, target.HasAura(SpellIds.RamFatigue) ? 4 : 5 /*Hack*/);
args.AddSpellMod(SpellValueMod.AuraStack, target.HasAura(SpellIds.RamFatigue) ? 4 : 5);
target.CastSpell(target, SpellIds.RamFatigue, args);
if (aurEff.GetTickNumber() == 8)
target.CastSpell(target, QuestIds.BrewfestSpeedBunnyRed, true);
target.CastSpell(target, SpellIds.BrewfestQuestSpeedBunnyRed, true);
break;
}
default:
break;
}
}
public override void Register()
{
OnEffectPeriodic.Add(new EffectPeriodicHandler(OnPeriodic, 1, AuraType.PeriodicDummy));
OnEffectPeriodic.Add(new(OnPeriodic, 1, AuraType.PeriodicDummy));
}
}
@@ -213,11 +202,11 @@ namespace Scripts.Events.Brewfest
public override void Register()
{
AfterEffectApply.Add(new EffectApplyHandler(OnApply, 0, AuraType.Dummy, AuraEffectHandleModes.RealOrReapplyMask));
AfterEffectApply.Add(new(OnApply, 0, AuraType.Dummy, AuraEffectHandleModes.RealOrReapplyMask));
}
}
[Script] // 43450 - Brewfest - apple trap - friendly DND
[Script] // 43450 - Brewfest - apple trap - friendly Dnd
class spell_brewfest_apple_trap : AuraScript
{
void OnApply(AuraEffect aurEff, AuraEffectHandleModes mode)
@@ -227,7 +216,7 @@ namespace Scripts.Events.Brewfest
public override void Register()
{
OnEffectApply.Add(new EffectApplyHandler(OnApply, 0, AuraType.ForceReaction, AuraEffectHandleModes.Real));
OnEffectApply.Add(new(OnApply, 0, AuraType.ForceReaction, AuraEffectHandleModes.Real));
}
}
@@ -242,11 +231,11 @@ namespace Scripts.Events.Brewfest
public override void Register()
{
OnEffectRemove.Add(new EffectApplyHandler(OnRemove, 0, AuraType.ModDecreaseSpeed, AuraEffectHandleModes.Real));
OnEffectRemove.Add(new(OnRemove, 0, AuraType.ModDecreaseSpeed, AuraEffectHandleModes.Real));
}
}
[Script] // 43714 - Brewfest - Relay Race - Intro - Force - Player to throw- DND
[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)
@@ -254,16 +243,16 @@ namespace Scripts.Events.Brewfest
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));
GetHitUnit().CastSpell(null, GetEffectInfo().TriggerSpell, TriggerCastFlags.FullMask & ~TriggerCastFlags.IgnorePowerAndReagentCost);
}
public override void Register()
{
OnEffectHitTarget.Add(new EffectHandler(HandleForceCast, 0, SpellEffectName.ForceCast));
OnEffectHitTarget.Add(new(HandleForceCast, 0, SpellEffectName.ForceCast));
}
}
[Script] // 43755 - Brewfest - Daily - Relay Race - Player - Increase Mount Duration - DND
[Script] // 43755 - Brewfest - Daily - Relay Race - Player - Increase Mount Duration - Dnd
class spell_brewfest_relay_race_turn_in : SpellScript
{
void HandleDummy(uint effIndex)
@@ -274,13 +263,13 @@ namespace Scripts.Events.Brewfest
if (aura != null)
{
aura.SetDuration(aura.GetDuration() + 30 * Time.InMilliseconds);
GetCaster().CastSpell(GetHitUnit(), SpellIds.RelayRaceTurnIn, new CastSpellExtraArgs(TriggerCastFlags.FullMask));
GetCaster().CastSpell(GetHitUnit(), SpellIds.RelayRaceTurnIn, TriggerCastFlags.FullMask);
}
}
public override void Register()
{
OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy));
OnEffectHitTarget.Add(new(HandleDummy, 0, SpellEffectName.Dummy));
}
}
@@ -294,20 +283,19 @@ namespace Scripts.Events.Brewfest
public override void Register()
{
OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect));
OnEffectHitTarget.Add(new(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]
[Script] // 43262 Brewfest - Barker Bunny 4
class spell_brewfest_barker_bunny : AuraScript
{
public override bool Load()
{
return GetUnitOwner().IsTypeId(TypeId.Player);
return GetUnitOwner().IsPlayer();
}
void OnApply(AuraEffect aurEff, AuraEffectHandleModes mode)
@@ -318,19 +306,19 @@ namespace Scripts.Events.Brewfest
if (target.GetQuestStatus(QuestIds.BarkForDrohnsDistillery) == QuestStatus.Incomplete ||
target.GetQuestStatus(QuestIds.BarkForDrohnsDistillery) == QuestStatus.Complete)
BroadcastTextId = RandomHelper.RAND(TextIds.DrohnDistillery1, TextIds.DrohnDistillery2, TextIds.DrohnDistillery3, TextIds.DrohnDistillery4);
BroadcastTextId = RandomHelper.RAND(TextIds.SayDrohnDistillery1, TextIds.SayDrohnDistillery2, TextIds.SayDrohnDistillery3, TextIds.SayDrohnDistillery4);
if (target.GetQuestStatus(QuestIds.BarkForTchalisVoodooBrewery) == QuestStatus.Incomplete ||
target.GetQuestStatus(QuestIds.BarkForTchalisVoodooBrewery) == QuestStatus.Complete)
BroadcastTextId = RandomHelper.RAND(TextIds.TChalisVoodoo1, TextIds.TChalisVoodoo2, TextIds.TChalisVoodoo3, TextIds.TChalisVoodoo4);
BroadcastTextId = RandomHelper.RAND(TextIds.SayTchalisVoodoo1, TextIds.SayTchalisVoodoo2, TextIds.SayTchalisVoodoo3, TextIds.SayTchalisVoodoo4);
if (target.GetQuestStatus(QuestIds.BarkBarleybrew) == QuestStatus.Incomplete ||
target.GetQuestStatus(QuestIds.BarkBarleybrew) == QuestStatus.Complete)
BroadcastTextId = RandomHelper.RAND(TextIds.Barleybrew1, TextIds.Barleybrew2, TextIds.Barleybrew3, TextIds.Barleybrew4);
BroadcastTextId = RandomHelper.RAND(TextIds.SayBarleybrew1, TextIds.SayBarleybrew2, TextIds.SayBarleybrew3, TextIds.SayBarleybrew4);
if (target.GetQuestStatus(QuestIds.BarkForThunderbrews) == QuestStatus.Incomplete ||
target.GetQuestStatus(QuestIds.BarkForThunderbrews) == QuestStatus.Complete)
BroadcastTextId = RandomHelper.RAND(TextIds.Thunderbrews1, TextIds.Thunderbrews2, TextIds.Thunderbrews3, TextIds.Thunderbrews4);
BroadcastTextId = RandomHelper.RAND(TextIds.SayThunderbrews1, TextIds.SayThunderbrews2, TextIds.SayThunderbrews3, TextIds.SayThunderbrews4);
if (BroadcastTextId != 0)
target.Talk(BroadcastTextId, ChatMsg.Say, WorldConfig.GetFloatValue(WorldCfg.ListenRangeSay), target);
@@ -338,16 +326,24 @@ namespace Scripts.Events.Brewfest
public override void Register()
{
OnEffectApply.Add(new EffectApplyHandler(OnApply, 1, AuraType.Dummy, AuraEffectHandleModes.Real));
OnEffectApply.Add(new(OnApply, 1, AuraType.Dummy, AuraEffectHandleModes.Real));
}
}
[Script]
class spell_item_brewfest_mount_transformation : SpellScript
// 49357 - Brewfest Mount Transformation
[Script] // 52845 - Brewfest Mount Transformation (Faction Swap)
class spell_brewfest_mount_transformation : SpellScript
{
const uint SpellMountRam100 = 43900;
const uint SpellMountRam60 = 43899;
const uint SpellMountKodo100 = 49379;
const uint SpellMountKodo60 = 49378;
const uint SpellBrewfestMountTransform = 49357;
const uint SpellBrewfestMountTransformReverse = 52845;
public override bool Validate(SpellInfo spell)
{
return ValidateSpellInfo(SpellIds.MountRam100, SpellIds.MountRam60, SpellIds.MountKodo100, SpellIds.MountKodo60);
return ValidateSpellInfo(SpellMountRam100, SpellMountRam60, SpellMountKodo100, SpellMountKodo60);
}
void HandleDummy(uint effIndex)
@@ -360,17 +356,17 @@ namespace Scripts.Events.Brewfest
switch (GetSpellInfo().Id)
{
case SpellIds.BrewfestMountTransform:
case SpellBrewfestMountTransform:
if (caster.GetSpeedRate(UnitMoveType.Run) >= 2.0f)
spell_id = caster.GetTeam() == Team.Alliance ? SpellIds.MountRam100 : SpellIds.MountKodo100;
spell_id = caster.GetTeam() == Team.Alliance ? SpellMountRam100 : SpellMountKodo100;
else
spell_id = caster.GetTeam() == Team.Alliance ? SpellIds.MountRam60 : SpellIds.MountKodo60;
spell_id = caster.GetTeam() == Team.Alliance ? SpellMountRam60 : SpellMountKodo60;
break;
case SpellIds.BrewfestMountTransformReverse:
case SpellBrewfestMountTransformReverse:
if (caster.GetSpeedRate(UnitMoveType.Run) >= 2.0f)
spell_id = caster.GetTeam() == Team.Horde ? SpellIds.MountRam100 : SpellIds.MountKodo100;
spell_id = caster.GetTeam() == Team.Horde ? SpellMountRam100 : SpellMountKodo100;
else
spell_id = caster.GetTeam() == Team.Horde ? SpellIds.MountRam60 : SpellIds.MountKodo60;
spell_id = caster.GetTeam() == Team.Horde ? SpellMountRam60 : SpellMountKodo60;
break;
default:
return;
@@ -381,7 +377,185 @@ namespace Scripts.Events.Brewfest
public override void Register()
{
OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy));
OnEffectHit.Add(new(HandleDummy, 0, SpellEffectName.Dummy));
}
}
}
[Script] // 50098 - The Beast Within
class spell_brewfest_botm_the_beast_within : AuraScript
{
const uint SpellBotmUnleashTheBeast = 50099;
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellBotmUnleashTheBeast);
}
void AfterRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
{
GetTarget().CastSpell(GetTarget(), SpellBotmUnleashTheBeast);
}
public override void Register()
{
AfterEffectRemove.Add(new(AfterRemove, 0, AuraType.Dummy, AuraEffectHandleModes.Real));
}
}
[Script] // 49864 - Gassy
class spell_brewfest_botm_gassy : AuraScript
{
const uint SpellBotmBelchBrewBelchVisual = 49860;
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellBotmBelchBrewBelchVisual);
}
void AfterRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
{
GetTarget().CastSpell(GetTarget(), SpellBotmBelchBrewBelchVisual, true);
}
public override void Register()
{
AfterEffectRemove.Add(new(AfterRemove, 0, AuraType.Dummy, AuraEffectHandleModes.Real));
}
}
[Script] // 49822 - Bloated
class spell_brewfest_botm_bloated : AuraScript
{
const uint SpellBotmBubbleBrewTriggerMissile = 50072;
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellBotmBubbleBrewTriggerMissile);
}
void AfterRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
{
GetTarget().CastSpell(GetTarget(), SpellBotmBubbleBrewTriggerMissile, true);
}
public override void Register()
{
AfterEffectRemove.Add(new(AfterRemove, 0, AuraType.Dummy, AuraEffectHandleModes.Real));
}
}
[Script] // 49738 - Internal Combustion
class spell_brewfest_botm_internal_combustion : AuraScript
{
const uint SpellBotmBelchFireVisual = 49737;
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellBotmBelchFireVisual);
}
void AfterRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
{
GetTarget().CastSpell(GetTarget(), SpellBotmBelchFireVisual, true);
}
public override void Register()
{
AfterEffectRemove.Add(new(AfterRemove, 0, AuraType.Dummy, AuraEffectHandleModes.Real));
}
}
[Script] // 49962 - Jungle Madness!
class spell_brewfest_botm_jungle_madness : SpellScript
{
const uint SpellBotmJungleBrewVisionEffect = 50010;
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellBotmJungleBrewVisionEffect);
}
void HandleAfterCast()
{
GetCaster().CastSpell(GetCaster(), SpellBotmJungleBrewVisionEffect, true);
}
public override void Register()
{
AfterCast.Add(new(HandleAfterCast));
}
}
[Script] // 50243 - Teach Language
class spell_brewfest_botm_teach_language : SpellScript
{
const uint SpellLearnGnomishBinary = 50242;
const uint SpellLearnGoblinBinary = 50246;
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellLearnGnomishBinary, SpellLearnGoblinBinary);
}
void HandleDummy(uint effIndex)
{
Player caster = GetCaster().ToPlayer();
if (caster != null)
caster.CastSpell(caster, caster.GetTeam() == Team.Alliance ? SpellLearnGnomishBinary : SpellLearnGoblinBinary, true);
}
public override void Register()
{
OnEffectHit.Add(new(HandleDummy, 0, SpellEffectName.Dummy));
}
}
[Script] // 42254, 42255, 42256, 42257, 42258, 42259, 42260, 42261, 42263, 42264, 43959, 43961 - Weak Alcohol
class spell_brewfest_botm_weak_alcohol : SpellScript
{
const uint SpellBotmCreateEmptyBrewBottle = 51655;
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellBotmCreateEmptyBrewBottle);
}
void HandleAfterCast()
{
GetCaster().CastSpell(GetCaster(), SpellBotmCreateEmptyBrewBottle, true);
}
public override void Register()
{
AfterCast.Add(new(HandleAfterCast));
}
}
[Script] // 51694 - Botm - Empty Bottle Throw - Resolve
class spell_brewfest_botm_empty_bottle_throw_resolve : SpellScript
{
const uint SpellBotmEmptyBottleThrowImpactCreature = 51695; // Just unit, not creature
const uint SpellBotmEmptyBottleThrowImpactGround = 51697;
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellBotmEmptyBottleThrowImpactCreature, SpellBotmEmptyBottleThrowImpactGround);
}
void HandleDummy(uint effIndex)
{
Unit caster = GetCaster();
Unit target = GetHitUnit();
if (target != null)
caster.CastSpell(target, SpellBotmEmptyBottleThrowImpactCreature, true);
else
caster.CastSpell(GetHitDest().GetPosition(), SpellBotmEmptyBottleThrowImpactGround, true);
}
public override void Register()
{
OnEffectHitTarget.Add(new(HandleDummy, 0, SpellEffectName.Dummy));
}
}
}