diff --git a/Source/Scripts/Spells/Generic.cs b/Source/Scripts/Spells/Generic.cs index b2f4977ea..d4bf03d71 100644 --- a/Source/Scripts/Spells/Generic.cs +++ b/Source/Scripts/Spells/Generic.cs @@ -275,6 +275,10 @@ namespace Scripts.Spells.Generic // AuraprocRemovespells public const uint FaceRage = 99947; public const uint ImpatientMind = 187213; + + //enum DefenderOfAzerothData + public const uint DeathGateTeleportStormwind = 316999; + public const uint DeathGateTeleportOrgrimmar = 317000; } struct CreatureIds @@ -304,6 +308,12 @@ namespace Scripts.Spells.Generic //VendorBarkTrigger public const uint AmphitheaterVendor = 30098; + + //DefenderOfAzerothData + public const uint Nazgrim = 161706; + public const uint Trollbane = 161707; + public const uint Whitemane = 161708; + public const uint Morgaine = 161709; } struct ModelIds @@ -362,6 +372,10 @@ namespace Scripts.Spells.Generic public const uint A_ValiantOfUndercity = 13695; public const uint ValiantOfSilvermoon = 13711; public const uint A_ValiantOfSilvermoon = 13696; + + //DefenderOfAzerothData + public const uint DefenderOfAzerothAlliance = 58902; + public const uint DefenderOfAzerothHorde = 58903; } struct Misc @@ -818,53 +832,53 @@ namespace Scripts.Spells.Generic switch (effIndex) { case 0: // On spells wich trigger the damaging spell (and also the visual) - { - uint spellId; + { + uint spellId; - switch (GetSpellInfo().Id) - { - case SpellIds.BreakShieldTriggerUnk: - case SpellIds.BreakShieldTriggerCampaingWarhorse: - spellId = SpellIds.BreakShieldDamage10k; - break; - case SpellIds.BreakShieldTriggerFactionMounts: - spellId = SpellIds.BreakShieldDamage2k; - break; - default: - return; - } - Unit rider = GetCaster().GetCharmer(); - if (rider) - rider.CastSpell(target, spellId, false); - else - GetCaster().CastSpell(target, spellId, false); - break; - } - case 1: // On damaging spells, for removing a defend layer + switch (GetSpellInfo().Id) { - var auras = target.GetAppliedAuras(); - foreach (var pair in auras) + case SpellIds.BreakShieldTriggerUnk: + case SpellIds.BreakShieldTriggerCampaingWarhorse: + spellId = SpellIds.BreakShieldDamage10k; + break; + case SpellIds.BreakShieldTriggerFactionMounts: + spellId = SpellIds.BreakShieldDamage2k; + break; + default: + return; + } + Unit rider = GetCaster().GetCharmer(); + if (rider) + rider.CastSpell(target, spellId, false); + else + GetCaster().CastSpell(target, spellId, false); + break; + } + case 1: // On damaging spells, for removing a defend layer + { + var auras = target.GetAppliedAuras(); + foreach (var pair in auras) + { + Aura aura = pair.Value.GetBase(); + if (aura != null) { - Aura aura = pair.Value.GetBase(); - if (aura != null) + if (aura.GetId() == 62552 || aura.GetId() == 62719 || aura.GetId() == 64100 || aura.GetId() == 66482) { - if (aura.GetId() == 62552 || aura.GetId() == 62719 || aura.GetId() == 64100 || aura.GetId() == 66482) + aura.ModStackAmount(-1, AuraRemoveMode.EnemySpell); + // Remove dummys from rider (Necessary for updating visual shields) + Unit rider = target.GetCharmer(); + if (rider) { - aura.ModStackAmount(-1, AuraRemoveMode.EnemySpell); - // Remove dummys from rider (Necessary for updating visual shields) - Unit rider = target.GetCharmer(); - if (rider) - { - Aura defend = rider.GetAura(aura.GetId()); - if (defend != null) - defend.ModStackAmount(-1, AuraRemoveMode.EnemySpell); - } - break; + Aura defend = rider.GetAura(aura.GetId()); + if (defend != null) + defend.ModStackAmount(-1, AuraRemoveMode.EnemySpell); } + break; } } - break; } + break; + } default: break; } @@ -1065,51 +1079,51 @@ namespace Scripts.Spells.Generic case SpellIds.WeaponAura: case SpellIds.Weapon2Aura: case SpellIds.Weapon3Aura: - { - prevItem = target.GetVirtualItemId(0); + { + prevItem = target.GetVirtualItemId(0); - Player player = caster.ToPlayer(); - if (player) - { - Item mainItem = player.GetItemByPos(InventorySlots.Bag0, EquipmentSlot.MainHand); - if (mainItem) - target.SetVirtualItem(0, mainItem.GetEntry()); - } - else - target.SetVirtualItem(0, caster.GetVirtualItemId(0)); - break; + Player player = caster.ToPlayer(); + if (player) + { + Item mainItem = player.GetItemByPos(InventorySlots.Bag0, EquipmentSlot.MainHand); + if (mainItem) + target.SetVirtualItem(0, mainItem.GetEntry()); } + else + target.SetVirtualItem(0, caster.GetVirtualItemId(0)); + break; + } case SpellIds.OffhandAura: case SpellIds.Offhand2Aura: - { - prevItem = target.GetVirtualItemId(1); + { + prevItem = target.GetVirtualItemId(1); - Player player = caster.ToPlayer(); - if (player) - { - Item offItem = player.GetItemByPos(InventorySlots.Bag0, EquipmentSlot.OffHand); - if (offItem) - target.SetVirtualItem(1, offItem.GetEntry()); - } - else - target.SetVirtualItem(1, caster.GetVirtualItemId(1)); - break; + Player player = caster.ToPlayer(); + if (player) + { + Item offItem = player.GetItemByPos(InventorySlots.Bag0, EquipmentSlot.OffHand); + if (offItem) + target.SetVirtualItem(1, offItem.GetEntry()); } + else + target.SetVirtualItem(1, caster.GetVirtualItemId(1)); + break; + } case SpellIds.RangedAura: - { - prevItem = target.GetVirtualItemId(2); + { + prevItem = target.GetVirtualItemId(2); - Player player = caster.ToPlayer(); - if (player) - { - Item rangedItem = player.GetItemByPos(InventorySlots.Bag0, EquipmentSlot.MainHand); - if (rangedItem) - target.SetVirtualItem(2, rangedItem.GetEntry()); - } - else - target.SetVirtualItem(2, caster.GetVirtualItemId(2)); - break; + Player player = caster.ToPlayer(); + if (player) + { + Item rangedItem = player.GetItemByPos(InventorySlots.Bag0, EquipmentSlot.MainHand); + if (rangedItem) + target.SetVirtualItem(2, rangedItem.GetEntry()); } + else + target.SetVirtualItem(2, caster.GetVirtualItemId(2)); + break; + } default: break; } @@ -1697,58 +1711,58 @@ namespace Scripts.Spells.Generic switch (effIndex) { case 0: // On spells wich trigger the damaging spell (and also the visual) + { + uint spellId; + + switch (GetSpellInfo().Id) { - uint spellId; - - switch (GetSpellInfo().Id) - { - case SpellIds.TriggerTrialChampion: - spellId = SpellIds.Charging20k1; - break; - case SpellIds.TriggerFactionMounts: - spellId = SpellIds.ChargingEffect8k5; - break; - default: - return; - } - - // If target isn't a training dummy there's a chance of failing the charge - if (!target.IsCharmedOwnedByPlayerOrPlayer() && RandomHelper.randChance(12.5f)) - spellId = SpellIds.MissEffect; - - Unit vehicle = GetCaster().GetVehicleBase(); - if (vehicle) - vehicle.CastSpell(target, spellId, false); - else - GetCaster().CastSpell(target, spellId, false); - break; + case SpellIds.TriggerTrialChampion: + spellId = SpellIds.Charging20k1; + break; + case SpellIds.TriggerFactionMounts: + spellId = SpellIds.ChargingEffect8k5; + break; + default: + return; } + + // If target isn't a training dummy there's a chance of failing the charge + if (!target.IsCharmedOwnedByPlayerOrPlayer() && RandomHelper.randChance(12.5f)) + spellId = SpellIds.MissEffect; + + Unit vehicle = GetCaster().GetVehicleBase(); + if (vehicle) + vehicle.CastSpell(target, spellId, false); + else + GetCaster().CastSpell(target, spellId, false); + break; + } case 1: // On damaging spells, for removing a defend layer case 2: + { + var auras = target.GetAppliedAuras(); + foreach (var pair in auras) { - var auras = target.GetAppliedAuras(); - foreach (var pair in auras) + Aura aura = pair.Value.GetBase(); + if (aura != null) { - Aura aura = pair.Value.GetBase(); - if (aura != null) + if (aura.GetId() == 62552 || aura.GetId() == 62719 || aura.GetId() == 64100 || aura.GetId() == 66482) { - if (aura.GetId() == 62552 || aura.GetId() == 62719 || aura.GetId() == 64100 || aura.GetId() == 66482) + aura.ModStackAmount(-1, AuraRemoveMode.EnemySpell); + // Remove dummys from rider (Necessary for updating visual shields) + Unit rider = target.GetCharmer(); + if (rider) { - aura.ModStackAmount(-1, AuraRemoveMode.EnemySpell); - // Remove dummys from rider (Necessary for updating visual shields) - Unit rider = target.GetCharmer(); - if (rider) - { - Aura defend = rider.GetAura(aura.GetId()); - if (defend != null) - defend.ModStackAmount(-1, AuraRemoveMode.EnemySpell); - } - break; + Aura defend = rider.GetAura(aura.GetId()); + if (defend != null) + defend.ModStackAmount(-1, AuraRemoveMode.EnemySpell); } + break; } } - break; } + break; + } } } @@ -1985,7 +1999,7 @@ namespace Scripts.Spells.Generic { return spellInfo.GetEffects().Count > 1; } - + public override bool Load() { return GetCaster().IsTypeId(TypeId.Player); @@ -2301,7 +2315,7 @@ namespace Scripts.Spells.Generic { return spellInfo.GetEffects().Count > 1; } - + void PeriodicTick(AuraEffect aurEff) { // they apply damage so no need to check for ticks here @@ -3644,4 +3658,71 @@ namespace Scripts.Spells.Generic OnEffectRemove.Add(new EffectApplyHandler(OnRemove, 0, AuraType.ProcTriggerSpell, AuraEffectHandleModes.Real)); } } + + [Script] + class spell_defender_of_azeroth_death_gate_selector : SpellScript + { + (WorldLocation, uint) StormwindInnLoc = (new WorldLocation(0, -8868.1f, 675.82f, 97.9f, 5.164778709411621093f), 5148); + (WorldLocation, uint) OrgrimmarInnLoc = (new WorldLocation(1, 1573.18f, -4441.62f, 16.06f, 1.818284034729003906f), 8618); + + public override bool Validate(SpellInfo spell) + { + return ValidateSpellInfo(SpellIds.DeathGateTeleportStormwind, SpellIds.DeathGateTeleportOrgrimmar); + } + + void HandleDummy(uint effIndex) + { + Player player = GetHitUnit().ToPlayer(); + if (player == null) + return; + + if (player.GetQuestStatus(QuestIds.DefenderOfAzerothAlliance) == QuestStatus.None && player.GetQuestStatus(QuestIds.DefenderOfAzerothHorde) == QuestStatus.None) + return; + + (WorldLocation Loc, uint AreaId) bindLoc = player.GetTeam() == Team.Alliance ? StormwindInnLoc : OrgrimmarInnLoc; + player.SetHomebind(bindLoc.Loc, bindLoc.AreaId); + player.SendBindPointUpdate(); + player.SendPlayerBound(player.GetGUID(), bindLoc.AreaId); + + player.CastSpell(player, player.GetTeam() == Team.Alliance ? SpellIds.DeathGateTeleportStormwind : SpellIds.DeathGateTeleportOrgrimmar); + } + + public override void Register() + { + OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy)); + } + } + + [Script] + class spell_defender_of_azeroth_speak_with_mograine : SpellScript + { + void HandleDummy(uint effIndex) + { + if (!GetCaster()) + return; + + Player player = GetCaster().ToPlayer(); + if (player == null) + return; + + Creature nazgrim = GetHitUnit().FindNearestCreature(CreatureIds.Nazgrim, 10.0f); + if (nazgrim != null) + nazgrim.HandleEmoteCommand(Emote.OneshotPoint, player); + + Creature trollbane = GetHitUnit().FindNearestCreature(CreatureIds.Trollbane, 10.0f); + if (trollbane != null) + trollbane.HandleEmoteCommand(Emote.OneshotPoint, player); + + Creature whitemane = GetHitUnit().FindNearestCreature(CreatureIds.Whitemane, 10.0f); + if (whitemane != null) + whitemane.HandleEmoteCommand(Emote.OneshotPoint, player); + + // @TODO: spawntracking - show death gate for casting player + } + + public override void Register() + { + OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy)); + } + } } diff --git a/sql/updates/world/master/2021_10_13_00_world.sql b/sql/updates/world/master/2021_10_13_00_world.sql new file mode 100644 index 000000000..1c67df1ab --- /dev/null +++ b/sql/updates/world/master/2021_10_13_00_world.sql @@ -0,0 +1,49 @@ +-- +SET @OGUID := 600015; +SET @WLSID := 100000; + +DELETE FROM `gameobject` WHERE `guid`=@OGUID+0; +INSERT INTO `gameobject` (`guid`, `id`, `map`, `zoneId`, `areaId`, `spawnDifficulties`, `PhaseId`, `PhaseGroup`, `position_x`, `position_y`, `position_z`, `orientation`, `rotation0`, `rotation1`, `rotation2`, `rotation3`, `spawntimesecs`, `animprogress`, `state`, `VerifiedBuild`) VALUES +(@OGUID+0, 341833, 2297, 12952, 12951, '0', 0, 0, 529.26043701171875, -2124.81591796875, 840.85693359375, 0, 0, 0, 0, 1, 120, 255, 1, 40120); -- Death Gate (Area: The Frozen Throne - Difficulty: 0) + +DELETE FROM `serverside_spell` WHERE `Id`=316990 AND `DifficultyID`=0; +INSERT INTO `serverside_spell` (`Id`, `DifficultyID`, `SpellName`, `RangeIndex`, `Attributes`, `AttributesEx`, `AttributesEx2`, `AttributesEx3`, `AttributesEx4`, `AttributesEx5`, `AttributesEx6`) VALUES +(316990, 0, '"Defender of Azeroth": 02 Death Gate Selector', 1, 0x29000180, 0x00000420, 0x10484004, 0x10030200, 0x00800080, 0x00060008, 0x00001200); + +DELETE FROM `serverside_spell_effect` WHERE `SpellID`=316990 AND `EffectIndex`=0 AND `DifficultyID`=0; +INSERT INTO `serverside_spell_effect` (`SpellID`, `EffectIndex`, `DifficultyID`, `Effect`, `EffectMiscValue1`, `ImplicitTarget1`, `ImplicitTarget2`) VALUES +(316990, 0, 0, 3, 0, 1, 0); -- Death Gate Selector + +DELETE FROM `spell_script_names` WHERE `ScriptName` IN('spell_defender_of_azeroth_death_gate_selector', 'spell_defender_of_azeroth_speak_with_mograine'); +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(316983, 'spell_defender_of_azeroth_speak_with_mograine'), +(316990, 'spell_defender_of_azeroth_death_gate_selector'); + +DELETE FROM `spell_target_position` WHERE `ID` IN(316999, 317000) AND `EffectIndex`=0; +INSERT INTO `spell_target_position` (`ID`, `EffectIndex`, `MapID`, `PositionX`, `PositionY`, `PositionZ`, `VerifiedBuild`) VALUES +(316999, 0, 0, -9088.990234375, 415.220001220703125, 92.1699981689453125, 40120), -- Spell: 316999 (Death Gate) Efffect: 252 (SPELL_EFFECT_TELEPORT_UNITS) +(317000, 0, 1, 1370.1600341796875, -4371.6201171875, 26.04999923706054687, 40443); -- Spell: 317000 (Death Gate) Efffect: 252 (SPELL_EFFECT_TELEPORT_UNITS) + +DELETE FROM `world_safe_locs` WHERE `ID` IN(@WLSID+0); +INSERT INTO `world_safe_locs` (`ID`, `MapID`, `LocX`, `LocY`, `LocZ`, `Facing`, `Comment`) VALUES +(@WLSID+0, 2297, 544.54865, -2124.7031, 840.85693, 3.141906976699829101, 'Icecrown Citadel - Allied Race DK Intro - GY'); + +DELETE FROM `graveyard_zone` WHERE `ID`=@WLSID+0 AND `GhostZone`=12952; +INSERT INTO `graveyard_zone` (`ID`, `GhostZone`, `Faction`, `Comment`) VALUES +(@WLSID+0, 12952, 0, 'Icecrown Citadel - Allied Race DK Intro - GY'); + +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=161709; +DELETE FROM `smart_scripts` WHERE `entryorguid`=161709 AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `event_type`, `event_param1`, `action_type`, `action_param1`, `action_param2`, `target_type`, `target_param1`, `comment`) VALUES +(161709, 0, 0, 62, 25082, 85, 316983, 0, 1, 0, 'Darion Mograine - On Gossip Option Select - Invoker Cast - Self'), +(161709, 0, 1, 62, 25082, 143, 13254, 1, 7, 0, 'Darion Mograine - On Gossip Option Select - Create Conversation - Invoker'), +(161709, 0, 2, 62, 25082, 72, 0, 0, 7, 0, 'Darion Mograine - On Gossip Option Select - Close Gossip - Invoker'); + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceGroup`=1 AND `SourceEntry`=316983; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ConditionTarget`, `ConditionTypeOrReference`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `Comment`) VALUES +(13, 1, 316983, 0, 0, 31, 3, 161709, 0, 'Defender of Azeroth: Speak.. should only hit creatures with entry 161709'); + +-- some fixups +DELETE FROM `creature_questender` WHERE `id`=163016 AND `quest` IN(58902, 58903); +UPDATE `conditions` SET `ConditionValue1`=395159 WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup`=25082 AND `ConditionTypeOrReference`=48 AND `ElseGroup`=1; +UPDATE `conditions` SET `ConditionValue1`=395215 WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup`=25082 AND `ConditionTypeOrReference`=48 AND `ElseGroup`=2;