Scripts/Spells: Add script for Salvage Wreckage & update similar scripts

Port From (https://github.com/TrinityCore/TrinityCore/commit/2583aee17aa73f182d6867d504c2720a94deb6dc)
This commit is contained in:
hondacrx
2022-05-26 16:39:48 -04:00
parent 7aa1d7aa7a
commit a880cd8327
+44 -29
View File
@@ -94,10 +94,10 @@ namespace Scripts.Spells.Quest
public const uint SummonNorthSeaBlueShark = 66740; public const uint SummonNorthSeaBlueShark = 66740;
//Redsnapperverytasty //Redsnapperverytasty
public const uint CastNet = 29866; public const uint FishedUpRedSnapper = 29867;
public const uint FishedUpMurloc = 29869; public const uint FishedUpMurloc = 29869;
//Pounddrumspells //BreakfastOfChampions
public const uint SummonDeepJormungar = 66510; public const uint SummonDeepJormungar = 66510;
public const uint StormforgedMoleMachine = 66492; public const uint StormforgedMoleMachine = 66492;
@@ -121,6 +121,10 @@ namespace Scripts.Spells.Quest
public const uint ChooseLoc = 40056; public const uint ChooseLoc = 40056;
public const uint AggroCheck = 40112; public const uint AggroCheck = 40112;
//RecoverTheCargo
public const uint SummonLockbox = 42288;
public const uint SummonBurrower = 42289;
//Spellzuldrakrat //Spellzuldrakrat
public const uint SummonGorgedLurkingBasilisk = 50928; public const uint SummonGorgedLurkingBasilisk = 50928;
@@ -297,9 +301,6 @@ namespace Scripts.Spells.Quest
public const byte Say1 = 1; public const byte Say1 = 1;
public const byte Say2 = 2; public const byte Say2 = 2;
//RedSnapperVeryTasty
public const uint ItemIdRedSnapper = 23614;
//Acleansingsong //Acleansingsong
public const uint AreaIdBittertidelake = 4385; public const uint AreaIdBittertidelake = 4385;
public const uint AreaIdRiversheart = 4290; public const uint AreaIdRiversheart = 4290;
@@ -1016,42 +1017,38 @@ namespace Scripts.Spells.Quest
} }
} }
// http://old01.wowhead.com/quest=9452 - Red Snapper - Very Tasty! [Script] // 29866 - Cast Fishing Net
[Script]
class spell_q9452_cast_net : SpellScript class spell_q9452_cast_net : SpellScript
{ {
public override bool Load() public override bool Validate(SpellInfo spell)
{ {
return GetCaster().IsTypeId(TypeId.Player); return ValidateSpellInfo(SpellIds.FishedUpRedSnapper, SpellIds.FishedUpMurloc);
} }
void HandleDummy(uint effIndex) void HandleDummy(uint effIndex)
{ {
Player caster = GetCaster().ToPlayer(); Unit caster = GetCaster();
if (RandomHelper.randChance(66))
caster.AddItem(Misc.ItemIdRedSnapper, 1);
else
caster.CastSpell(caster, SpellIds.FishedUpMurloc, true);
}
void HandleActiveObject(uint effIndex) if (RandomHelper.randChance(66))
{ caster.CastSpell(caster, SpellIds.FishedUpRedSnapper, true);
PreventHitDefaultEffect(effIndex); else
GetHitGObj().SetRespawnTime(RandomHelper.randChance(50) ? 2 * Time.Minute : 3 * Time.Minute); caster.CastSpell(null, SpellIds.FishedUpMurloc, true);
GetHitGObj().Use(GetCaster());
GetHitGObj().SetLootState(LootState.JustDeactivated);
} }
public override void Register() public override void Register()
{ {
OnEffectHit.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy)); OnEffectHit.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy));
OnEffectHitTarget.Add(new EffectHandler(HandleActiveObject, 1, SpellEffectName.ActivateObject));
} }
} }
[Script] [Script] // 66512 - Pound Drum
class spell_q14076_14092_pound_drum : SpellScript class spell_q14076_14092_pound_drum : SpellScript
{ {
public override bool Validate(SpellInfo spell)
{
return ValidateSpellInfo(SpellIds.SummonDeepJormungar, SpellIds.StormforgedMoleMachine);
}
void HandleSummon() void HandleSummon()
{ {
Unit caster = GetCaster(); Unit caster = GetCaster();
@@ -1062,15 +1059,9 @@ namespace Scripts.Spells.Quest
caster.CastSpell(caster, SpellIds.StormforgedMoleMachine, true); caster.CastSpell(caster, SpellIds.StormforgedMoleMachine, true);
} }
void HandleActiveObject(uint effIndex)
{
GetHitGObj().SetLootState(LootState.JustDeactivated);
}
public override void Register() public override void Register()
{ {
OnCast.Add(new CastHandler(HandleSummon)); OnCast.Add(new CastHandler(HandleSummon));
OnEffectHitTarget.Add(new EffectHandler(HandleActiveObject, 0, SpellEffectName.ActivateObject));
} }
} }
@@ -1362,6 +1353,30 @@ namespace Scripts.Spells.Quest
} }
} }
[Script] // 42287 - Salvage Wreckage
class spell_q11140salvage_wreckage : SpellScript
{
public override bool Validate(SpellInfo spell)
{
return ValidateSpellInfo(SpellIds.SummonLockbox, SpellIds.SummonBurrower);
}
void HandleDummy(uint effIndex)
{
Unit caster = GetCaster();
if (RandomHelper.randChance(50))
caster.CastSpell(caster, SpellIds.SummonLockbox, true);
else
caster.CastSpell(null, SpellIds.SummonBurrower, true);
}
public override void Register()
{
OnEffectHit.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy));
}
}
[Script] [Script]
class spell_q12527_zuldrak_rat : SpellScript class spell_q12527_zuldrak_rat : SpellScript
{ {