aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/game/AI/CoreAI/CombatAI.cpp11
-rw-r--r--src/server/game/AI/CoreAI/CombatAI.h2
-rw-r--r--src/server/game/AI/CoreAI/GuardAI.cpp13
-rw-r--r--src/server/game/AI/CoreAI/GuardAI.h1
-rw-r--r--src/server/game/AI/CoreAI/UnitAI.cpp16
-rw-r--r--src/server/game/AI/CoreAI/UnitAI.h63
-rw-r--r--src/server/game/AI/CreatureAI.cpp20
-rw-r--r--src/server/game/AI/CreatureAI.h15
-rw-r--r--src/server/game/AI/CreatureAIImpl.h24
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedCreature.cpp39
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedCreature.h17
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp2
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp2
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.cpp17
-rw-r--r--src/server/game/Battlefield/Battlefield.cpp2
-rw-r--r--src/server/game/Battlefield/Battlefield.h9
-rw-r--r--src/server/game/Battlefield/Zones/BattlefieldTB.cpp10
-rw-r--r--src/server/game/Battlefield/Zones/BattlefieldWG.cpp6
-rw-r--r--src/server/game/Battlegrounds/Battleground.cpp9
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp4
-rw-r--r--src/server/game/DungeonFinding/LFGMgr.h2
-rw-r--r--src/server/game/Entities/GameObject/GameObject.cpp21
-rw-r--r--src/server/game/Entities/GameObject/GameObject.h24
-rw-r--r--src/server/game/Entities/Object/Object.cpp4
-rw-r--r--src/server/game/Entities/Object/Object.h10
-rw-r--r--src/server/game/Entities/Player/KillRewarder.cpp2
-rw-r--r--src/server/game/Entities/Transport/Transport.cpp4
-rw-r--r--src/server/game/Garrison/Garrison.cpp4
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp4
-rw-r--r--src/server/game/Instances/InstanceScript.cpp37
-rw-r--r--src/server/game/Instances/InstanceScript.h67
-rw-r--r--src/server/game/Maps/Map.cpp5
-rw-r--r--src/server/game/Maps/Map.h1
-rw-r--r--src/server/game/Server/Packets/CombatLogPackets.h2
-rw-r--r--src/server/game/Spells/SpellEffects.cpp12
-rw-r--r--src/server/game/Spells/SpellScript.cpp16
-rw-r--r--src/server/game/Spells/SpellScript.h14
-rw-r--r--src/server/scripts/Commands/cs_gobject.cpp5
-rw-r--r--src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp1
-rw-r--r--src/server/scripts/EasternKingdoms/BaradinHold/baradin_hold.h12
-rw-r--r--src/server/scripts/EasternKingdoms/BaradinHold/boss_alizabal.cpp9
-rw-r--r--src/server/scripts/EasternKingdoms/BaradinHold/boss_occuthar.cpp15
-rw-r--r--src/server/scripts/EasternKingdoms/BaradinHold/boss_pit_lord_argaloth.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/BaradinHold/instance_baradin_hold.cpp5
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/blackrock_caverns.cpp34
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/blackrock_caverns.h4
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/boss_romogg_bonecrusher.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/instance_blackrock_caverns.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp18
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.h9
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_magmus.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_tomb_of_seven.cpp7
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp8
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/blackrock_spire.h8
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_drakkisath.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_gizrul_the_slavener.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_gyth.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_halycon.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_highlord_omokk.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_lord_valthalak.cpp5
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_mother_smolderweb.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_overlord_wyrmthalak.cpp5
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_pyroguard_emberseer.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_quartermaster_zigris.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_rend_blackhand.cpp8
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_shadow_hunter_voshgajin.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_the_beast.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_urok_doomhowl.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_warmaster_voone.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/instance_blackrock_spire.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/blackwing_lair.h10
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_broodlord_lashlayer.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_chromaggus.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_ebonroc.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_firemaw.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_flamegor.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp11
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_razorgore.cpp8
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp7
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/instance_blackwing_lair.cpp9
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_baron_geddon.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_garr.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_gehennas.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_golemagg.cpp10
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_lucifron.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_magmadar.cpp5
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_majordomo_executus.cpp10
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp9
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_shazzrah.cpp8
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_sulfuron_harbinger.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/instance_molten_core.cpp12
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/molten_core.h15
-rw-r--r--src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp7
-rw-r--r--src/server/scripts/EasternKingdoms/Deadmines/deadmines.h9
-rw-r--r--src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp8
-rw-r--r--src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp27
-rw-r--r--src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.h9
-rw-r--r--src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp7
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp19
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp8
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp5
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp14
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp13
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp15
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp31
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp7
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp14
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/karazhan.h9
-rw-r--r--src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp30
-rw-r--r--src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp23
-rw-r--r--src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp8
-rw-r--r--src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp11
-rw-r--r--src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.h9
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp10
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp20
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp5
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp8
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/scarlet_monastery.h4
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_death_knight_darkreaver.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_doctor_theolen_krastinov.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_illucia_barov.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_jandice_barov.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_kirtonos_the_herald.cpp20
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_kormok.cpp13
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_lord_alexei_barov.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_the_ravenian.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_vectus.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/scholomance.h9
-rw-r--r--src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp9
-rw-r--r--src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp14
-rw-r--r--src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.h9
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/boss_cannon_master_willey.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/boss_dathrohan_balnazzar.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/boss_magistrate_barthilas.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/boss_nerubenkan.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp5
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/boss_postmaster_malown.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/boss_ramstein_the_gorger.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/boss_timmy_the_cruel.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp11
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp7
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/stratholme.h9
-rw-r--r--src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp13
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp12
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp22
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp16
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.h6
-rw-r--r--src/server/scripts/EasternKingdoms/TheStockade/instance_the_stockade.cpp1
-rw-r--r--src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp11
-rw-r--r--src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp10
-rw-r--r--src/server/scripts/EasternKingdoms/Uldaman/uldaman.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/Uldaman/uldaman.h9
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp8
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp8
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/zulaman.h10
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_grilek.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_hazzarah.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp8
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_wushoolay.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/zulgurub.h6
-rw-r--r--src/server/scripts/EasternKingdoms/zone_blasted_lands.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/zone_duskwood.cpp1
-rw-r--r--src/server/scripts/EasternKingdoms/zone_ghostlands.cpp11
-rw-r--r--src/server/scripts/EasternKingdoms/zone_isle_of_queldanas.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/zone_silverpine_forest.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/zone_stranglethorn_vale.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/zone_tol_barad.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/zone_undercity.cpp3
-rw-r--r--src/server/scripts/Events/childrens_week.cpp3
-rw-r--r--src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp9
-rw-r--r--src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.h9
-rw-r--r--src/server/scripts/Kalimdor/BlackfathomDeeps/boss_aku_mai.cpp4
-rw-r--r--src/server/scripts/Kalimdor/BlackfathomDeeps/boss_gelihast.cpp4
-rw-r--r--src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp4
-rw-r--r--src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp7
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp13
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp17
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp7
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp13
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp5
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp77
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.h9
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp25
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp28
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp9
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_chrono_lord_epoch.cpp4
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_infinite_corruptor.cpp4
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp6
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp4
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm_the_fleshcrafter.cpp4
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp15
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.h11
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp11
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp5
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp5
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp5
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp29
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp11
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.h11
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/boss_aeonus.cpp3
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/boss_chrono_lord_deja.cpp3
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/boss_temporus.cpp3
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/instance_the_black_morass.cpp11
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.cpp12
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.h9
-rw-r--r--src/server/scripts/Kalimdor/DireMaul/instance_dire_maul.cpp1
-rw-r--r--src/server/scripts/Kalimdor/Firelands/boss_alysrazor.cpp47
-rw-r--r--src/server/scripts/Kalimdor/Firelands/firelands.cpp26
-rw-r--r--src/server/scripts/Kalimdor/Firelands/firelands.h22
-rw-r--r--src/server/scripts/Kalimdor/Firelands/instance_firelands.cpp4
-rw-r--r--src/server/scripts/Kalimdor/HallsOfOrigination/boss_anraphet.cpp14
-rw-r--r--src/server/scripts/Kalimdor/HallsOfOrigination/boss_earthrager_ptah.cpp11
-rw-r--r--src/server/scripts/Kalimdor/HallsOfOrigination/boss_temple_guardian_anhuur.cpp11
-rw-r--r--src/server/scripts/Kalimdor/HallsOfOrigination/halls_of_origination.h12
-rw-r--r--src/server/scripts/Kalimdor/Maraudon/boss_landslide.cpp3
-rw-r--r--src/server/scripts/Kalimdor/Maraudon/boss_noxxion.cpp3
-rw-r--r--src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp4
-rw-r--r--src/server/scripts/Kalimdor/Maraudon/instance_maraudon.cpp4
-rw-r--r--src/server/scripts/Kalimdor/Maraudon/maraudon.h31
-rw-r--r--src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp10
-rw-r--r--src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp8
-rw-r--r--src/server/scripts/Kalimdor/OnyxiasLair/onyxias_lair.h1
-rw-r--r--src/server/scripts/Kalimdor/RagefireChasm/instance_ragefire_chasm.cpp1
-rw-r--r--src/server/scripts/Kalimdor/RazorfenDowns/boss_amnennar_the_coldbringer.cpp4
-rw-r--r--src/server/scripts/Kalimdor/RazorfenDowns/boss_glutton.cpp4
-rw-r--r--src/server/scripts/Kalimdor/RazorfenDowns/boss_mordresh_fire_eye.cpp4
-rw-r--r--src/server/scripts/Kalimdor/RazorfenDowns/boss_tuten_kash.cpp4
-rw-r--r--src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp20
-rw-r--r--src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.h6
-rw-r--r--src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp19
-rw-r--r--src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp12
-rw-r--r--src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.h10
-rw-r--r--src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp17
-rw-r--r--src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp18
-rw-r--r--src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp10
-rw-r--r--src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp4
-rw-r--r--src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp15
-rw-r--r--src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_rajaxx.cpp5
-rw-r--r--src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp4
-rw-r--r--src/server/scripts/Kalimdor/RuinsOfAhnQiraj/ruins_of_ahnqiraj.h9
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp9
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp20
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_fankriss.cpp4
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_huhuran.cpp3
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp2
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_sartura.cpp5
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp24
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp4
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp12
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp4
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp14
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/temple_of_ahnqiraj.h9
-rw-r--r--src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp8
-rw-r--r--src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp6
-rw-r--r--src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.h9
-rw-r--r--src/server/scripts/Kalimdor/ZulFarrak/boss_zum_rah.cpp3
-rw-r--r--src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp17
-rw-r--r--src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp11
-rw-r--r--src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.h9
-rw-r--r--src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp7
-rw-r--r--src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp16
-rw-r--r--src/server/scripts/Kalimdor/zone_durotar.cpp16
-rw-r--r--src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp13
-rw-r--r--src/server/scripts/Kalimdor/zone_silithus.cpp14
-rw-r--r--src/server/scripts/Kalimdor/zone_tanaris.cpp7
-rw-r--r--src/server/scripts/Kalimdor/zone_the_barrens.cpp7
-rw-r--r--src/server/scripts/Kalimdor/zone_winterspring.cpp7
-rw-r--r--src/server/scripts/Maelstrom/Stonecore/boss_corborus.cpp7
-rw-r--r--src/server/scripts/Maelstrom/Stonecore/boss_high_priestess_azil.cpp19
-rw-r--r--src/server/scripts/Maelstrom/Stonecore/boss_ozruk.cpp5
-rw-r--r--src/server/scripts/Maelstrom/Stonecore/boss_slabhide.cpp12
-rw-r--r--src/server/scripts/Maelstrom/Stonecore/instance_stonecore.cpp4
-rw-r--r--src/server/scripts/Maelstrom/Stonecore/stonecore.cpp11
-rw-r--r--src/server/scripts/Maelstrom/Stonecore/stonecore.h8
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/ahnkahet.h8
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp16
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_elder_nadox.cpp8
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp9
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp14
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp14
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp7
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/AzjolNerub/azjol_nerub.h8
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp5
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp30
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp16
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp8
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp9
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/instance_obsidian_sanctum.cpp3
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.cpp15
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.h6
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp4
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp5
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp44
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp3
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp14
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.cpp10
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.h25
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp21
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp8
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp20
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp17
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp9
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.h9
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp23
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp94
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp20
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp32
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp85
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp16
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp88
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h133
-rw-r--r--src/server/scripts/Northrend/DraktharonKeep/boss_king_dred.cpp4
-rw-r--r--src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp11
-rw-r--r--src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp8
-rw-r--r--src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp18
-rw-r--r--src/server/scripts/Northrend/DraktharonKeep/drak_tharon_keep.h6
-rw-r--r--src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp7
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp12
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp24
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp13
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.h8
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp4
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp4
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_horAI.cpp53
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_horAI.h27
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp6
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp12
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h51
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp11
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp7
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp10
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp17
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp3
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp28
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.h20
-rw-r--r--src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp3
-rw-r--r--src/server/scripts/Northrend/Gundrak/boss_eck.cpp2
-rw-r--r--src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp7
-rw-r--r--src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp2
-rw-r--r--src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp9
-rw-r--r--src/server/scripts/Northrend/Gundrak/gundrak.h4
-rw-r--r--src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp8
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp17
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp42
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp39
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp18
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp31
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp14
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp19
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp41
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp21
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp44
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp42
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp18
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp64
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h47
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel_teleport.cpp5
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp18
-rw-r--r--src/server/scripts/Northrend/IsleOfConquest/boss_ioc_horde_alliance.cpp2
-rw-r--r--src/server/scripts/Northrend/IsleOfConquest/isle_of_conquest.cpp14
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp8
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp8
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp15
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp11
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp18
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp20
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp13
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp16
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_loatheb.cpp11
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp10
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_noth.cpp4
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp5
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp8
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp24
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp49
-rw-r--r--src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp10
-rw-r--r--src/server/scripts/Northrend/Naxxramas/naxxramas.h16
-rw-r--r--src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp85
-rw-r--r--src/server/scripts/Northrend/Nexus/EyeOfEternity/eye_of_eternity.h9
-rw-r--r--src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp16
-rw-r--r--src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp9
-rw-r--r--src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp16
-rw-r--r--src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp9
-rw-r--r--src/server/scripts/Northrend/Nexus/Nexus/boss_nexus_commanders.cpp4
-rw-r--r--src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp7
-rw-r--r--src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp5
-rw-r--r--src/server/scripts/Northrend/Nexus/Nexus/nexus.h8
-rw-r--r--src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp5
-rw-r--r--src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp8
-rw-r--r--src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp2
-rw-r--r--src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp10
-rw-r--r--src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp9
-rw-r--r--src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp21
-rw-r--r--src/server/scripts/Northrend/Nexus/Oculus/oculus.h6
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp8
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp8
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp5
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp9
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfLightning/halls_of_lightning.h6
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp5
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp2
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_maiden_of_grief.cpp3
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp4
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp8
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.h6
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp6
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_assembly_of_iron.cpp9
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp13
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp55
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp34
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp20
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp16
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp10
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp26
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp92
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp35
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp78
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp88
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h25
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp7
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp4
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp2
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp3
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp20
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.h6
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp15
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp31
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp6
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp4
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_utgarde_pinnacle.cpp4
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/utgarde_pinnacle.h6
-rw-r--r--src/server/scripts/Northrend/VaultOfArchavon/boss_archavon.cpp17
-rw-r--r--src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp6
-rw-r--r--src/server/scripts/Northrend/VaultOfArchavon/boss_koralon.cpp13
-rw-r--r--src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp10
-rw-r--r--src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp4
-rw-r--r--src/server/scripts/Northrend/VaultOfArchavon/vault_of_archavon.h9
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp5
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_erekem.cpp2
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp25
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp16
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_moragg.cpp29
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp6
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp1
-rw-r--r--src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp13
-rw-r--r--src/server/scripts/Northrend/VioletHold/violet_hold.cpp10
-rw-r--r--src/server/scripts/Northrend/VioletHold/violet_hold.h8
-rw-r--r--src/server/scripts/Northrend/zone_borean_tundra.cpp10
-rw-r--r--src/server/scripts/Northrend/zone_crystalsong_forest.cpp33
-rw-r--r--src/server/scripts/Northrend/zone_dalaran.cpp6
-rw-r--r--src/server/scripts/Northrend/zone_dragonblight.cpp10
-rw-r--r--src/server/scripts/Northrend/zone_grizzly_hills.cpp13
-rw-r--r--src/server/scripts/Northrend/zone_howling_fjord.cpp11
-rw-r--r--src/server/scripts/Northrend/zone_icecrown.cpp5
-rw-r--r--src/server/scripts/Northrend/zone_sholazar_basin.cpp16
-rw-r--r--src/server/scripts/Northrend/zone_storm_peaks.cpp33
-rw-r--r--src/server/scripts/Northrend/zone_wintergrasp.cpp13
-rw-r--r--src/server/scripts/Northrend/zone_zuldrak.cpp94
-rw-r--r--src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp7
-rw-r--r--src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp7
-rw-r--r--src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp14
-rw-r--r--src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp8
-rw-r--r--src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp11
-rw-r--r--src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/auchenai_crypts.h6
-rw-r--r--src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp8
-rw-r--r--src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp5
-rw-r--r--src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/instance_auchenai_crypts.cpp3
-rw-r--r--src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp8
-rw-r--r--src/server/scripts/Outland/Auchindoun/ManaTombs/boss_pandemonius.cpp2
-rw-r--r--src/server/scripts/Outland/Auchindoun/ManaTombs/instance_mana_tombs.cpp1
-rw-r--r--src/server/scripts/Outland/Auchindoun/ManaTombs/mana_tombs.h6
-rw-r--r--src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_darkweaver_syth.cpp8
-rw-r--r--src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_talon_king_ikiss.cpp6
-rw-r--r--src/server/scripts/Outland/Auchindoun/SethekkHalls/instance_sethekk_halls.cpp3
-rw-r--r--src/server/scripts/Outland/Auchindoun/SethekkHalls/sethekk_halls.h6
-rw-r--r--src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp2
-rw-r--r--src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_blackheart_the_inciter.cpp1
-rw-r--r--src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp6
-rw-r--r--src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp7
-rw-r--r--src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp5
-rw-r--r--src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/shadow_labyrinth.cpp11
-rw-r--r--src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/shadow_labyrinth.h6
-rw-r--r--src/server/scripts/Outland/BlackTemple/black_temple.cpp3
-rw-r--r--src/server/scripts/Outland/BlackTemple/black_temple.h6
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_gurtogg_bloodboil.cpp5
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_illidan.cpp24
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp3
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp19
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp38
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_supremus.cpp9
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp13
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp7
-rw-r--r--src/server/scripts/Outland/BlackTemple/illidari_council.cpp19
-rw-r--r--src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp6
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp14
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp5
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp31
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp14
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp11
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp7
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp4
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/serpent_shrine.h10
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_hydromancer_thespia.cpp4
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp6
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp7
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp3
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SteamVault/steam_vault.h6
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_ahune.cpp52
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_mennu_the_betrayer.cpp2
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_quagmirran.cpp2
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_rokmar_the_crackler.cpp2
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/instance_the_slave_pens.cpp9
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/the_slave_pens.h8
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_hungarfen.cpp5
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_the_black_stalker.cpp4
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/instance_the_underbog.cpp4
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/the_underbog.h31
-rw-r--r--src/server/scripts/Outland/GruulsLair/boss_gruul.cpp9
-rw-r--r--src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp4
-rw-r--r--src/server/scripts/Outland/GruulsLair/gruuls_lair.h6
-rw-r--r--src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp5
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/BloodFurnace/blood_furnace.h6
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp13
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp9
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp2
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp7
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp7
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp12
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_watchkeeper_gargolmar.cpp4
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/hellfire_ramparts.h9
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp6
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp12
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp8
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/magtheridons_lair.h9
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp8
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp6
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp4
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp12
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/shattered_halls.cpp11
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/shattered_halls.h15
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp11
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp15
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp23
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp3
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp4
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/the_eye.h9
-rw-r--r--src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_gyrokill.cpp4
-rw-r--r--src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_ironhand.cpp4
-rw-r--r--src/server/scripts/Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp35
-rw-r--r--src/server/scripts/Outland/TempestKeep/Mechanar/boss_nethermancer_sepethrea.cpp7
-rw-r--r--src/server/scripts/Outland/TempestKeep/Mechanar/boss_pathaleon_the_calculator.cpp7
-rw-r--r--src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp4
-rw-r--r--src/server/scripts/Outland/TempestKeep/Mechanar/mechanar.h9
-rw-r--r--src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp5
-rw-r--r--src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.h6
-rw-r--r--src/server/scripts/Outland/TempestKeep/arcatraz/boss_dalliah_the_doomsayer.cpp4
-rw-r--r--src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp6
-rw-r--r--src/server/scripts/Outland/TempestKeep/arcatraz/boss_wrath_scryer_soccothrates.cpp4
-rw-r--r--src/server/scripts/Outland/TempestKeep/arcatraz/boss_zereketh_the_unbound.cpp4
-rw-r--r--src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp5
-rw-r--r--src/server/scripts/Outland/TempestKeep/botanica/boss_commander_sarannis.cpp5
-rw-r--r--src/server/scripts/Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp3
-rw-r--r--src/server/scripts/Outland/TempestKeep/botanica/boss_laj.cpp2
-rw-r--r--src/server/scripts/Outland/TempestKeep/botanica/boss_thorngrin_the_tender.cpp2
-rw-r--r--src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp6
-rw-r--r--src/server/scripts/Outland/TempestKeep/botanica/instance_the_botanica.cpp4
-rw-r--r--src/server/scripts/Outland/TempestKeep/botanica/the_botanica.h9
-rw-r--r--src/server/scripts/Outland/boss_doomlord_kazzak.cpp9
-rw-r--r--src/server/scripts/Outland/zone_blades_edge_mountains.cpp15
-rw-r--r--src/server/scripts/Outland/zone_hellfire_peninsula.cpp6
-rw-r--r--src/server/scripts/Outland/zone_nagrand.cpp9
-rw-r--r--src/server/scripts/Outland/zone_netherstorm.cpp4
-rw-r--r--src/server/scripts/Outland/zone_shadowmoon_valley.cpp4
-rw-r--r--src/server/scripts/Outland/zone_shattrath_city.cpp4
-rw-r--r--src/server/scripts/Outland/zone_terokkar_forest.cpp7
-rw-r--r--src/server/scripts/Outland/zone_zangarmarsh.cpp4
-rw-r--r--src/server/scripts/Pet/pet_dk.cpp7
-rw-r--r--src/server/scripts/Pet/pet_generic.cpp6
-rw-r--r--src/server/scripts/Pet/pet_hunter.cpp2
-rw-r--r--src/server/scripts/Pet/pet_mage.cpp8
-rw-r--r--src/server/scripts/Pet/pet_priest.cpp2
-rw-r--r--src/server/scripts/Spells/spell_generic.cpp2
-rw-r--r--src/server/scripts/Spells/spell_item.cpp2
-rw-r--r--src/server/scripts/World/achievement_scripts.cpp3
-rw-r--r--src/server/scripts/World/areatrigger_scripts.cpp4
-rw-r--r--src/server/scripts/World/boss_emerald_dragons.cpp13
-rw-r--r--src/server/scripts/World/go_scripts.cpp17
-rw-r--r--src/server/scripts/World/guards.cpp2
-rw-r--r--src/server/scripts/World/item_scripts.cpp10
-rw-r--r--src/server/scripts/World/mob_generic_creature.cpp3
-rw-r--r--src/server/scripts/World/npc_innkeeper.cpp4
-rw-r--r--src/server/scripts/World/npcs_special.cpp14
621 files changed, 4013 insertions, 3127 deletions
diff --git a/src/server/game/AI/CoreAI/CombatAI.cpp b/src/server/game/AI/CoreAI/CombatAI.cpp
index d9aaf102db7..88ef940ace3 100644
--- a/src/server/game/AI/CoreAI/CombatAI.cpp
+++ b/src/server/game/AI/CoreAI/CombatAI.cpp
@@ -17,12 +17,15 @@
*/
#include "CombatAI.h"
-#include "SpellMgr.h"
-#include "SpellInfo.h"
-#include "Vehicle.h"
+#include "ConditionMgr.h"
+#include "Creature.h"
+#include "CreatureAIImpl.h"
+#include "Log.h"
#include "ObjectAccessor.h"
#include "Player.h"
-#include "Log.h"
+#include "SpellInfo.h"
+#include "SpellMgr.h"
+#include "Vehicle.h"
/////////////////
// AggressorAI
diff --git a/src/server/game/AI/CoreAI/CombatAI.h b/src/server/game/AI/CoreAI/CombatAI.h
index 27f8efa712a..519c8a794c8 100644
--- a/src/server/game/AI/CoreAI/CombatAI.h
+++ b/src/server/game/AI/CoreAI/CombatAI.h
@@ -20,8 +20,6 @@
#define TRINITY_COMBATAI_H
#include "CreatureAI.h"
-#include "CreatureAIImpl.h"
-#include "ConditionMgr.h"
class Creature;
diff --git a/src/server/game/AI/CoreAI/GuardAI.cpp b/src/server/game/AI/CoreAI/GuardAI.cpp
index 25757ef5025..b52168a6f77 100644
--- a/src/server/game/AI/CoreAI/GuardAI.cpp
+++ b/src/server/game/AI/CoreAI/GuardAI.cpp
@@ -17,10 +17,15 @@
*/
#include "GuardAI.h"
+#include "Creature.h"
#include "Errors.h"
#include "Log.h"
#include "Player.h"
+GuardAI::GuardAI(Creature* creature) : ScriptedAI(creature)
+{
+}
+
int GuardAI::Permissible(Creature const* creature)
{
if (creature->IsGuard())
@@ -29,7 +34,13 @@ int GuardAI::Permissible(Creature const* creature)
return PERMIT_BASE_NO;
}
-GuardAI::GuardAI(Creature* creature) : ScriptedAI(creature) { }
+void GuardAI::UpdateAI(uint32 diff)
+{
+ if (!UpdateVictim())
+ return;
+
+ DoMeleeAttackIfReady();
+}
bool GuardAI::CanSeeAlways(WorldObject const* obj)
{
diff --git a/src/server/game/AI/CoreAI/GuardAI.h b/src/server/game/AI/CoreAI/GuardAI.h
index dfcf5997f4f..263f1d6abf3 100644
--- a/src/server/game/AI/CoreAI/GuardAI.h
+++ b/src/server/game/AI/CoreAI/GuardAI.h
@@ -29,6 +29,7 @@ class TC_GAME_API GuardAI : public ScriptedAI
explicit GuardAI(Creature* creature);
static int Permissible(Creature const* creature);
+ void UpdateAI(uint32 diff) override;
bool CanSeeAlways(WorldObject const* obj) override;
void EnterEvadeMode(EvadeReason /*why*/) override;
diff --git a/src/server/game/AI/CoreAI/UnitAI.cpp b/src/server/game/AI/CoreAI/UnitAI.cpp
index 65ce74106d3..4507d064bea 100644
--- a/src/server/game/AI/CoreAI/UnitAI.cpp
+++ b/src/server/game/AI/CoreAI/UnitAI.cpp
@@ -40,6 +40,12 @@ void UnitAI::AttackStart(Unit* victim)
}
}
+void UnitAI::InitializeAI()
+{
+ if (!me->isDead())
+ Reset();
+}
+
void UnitAI::AttackStartCaster(Unit* victim, float dist)
{
if (victim && me->Attack(victim, false))
@@ -230,6 +236,11 @@ void UnitAI::FillAISpellInfo()
}
}
+ThreatManager& UnitAI::GetThreatManager()
+{
+ return me->getThreatManager();
+}
+
bool DefaultTargetSelector::operator()(Unit const* target) const
{
if (!me)
@@ -347,3 +358,8 @@ bool NonTankTargetSelector::operator()(Unit const* target) const
return target != _source->GetVictim();
}
+
+void SortByDistanceTo(Unit* reference, std::list<Unit*>& targets)
+{
+ targets.sort(Trinity::ObjectDistanceOrderPred(reference));
+}
diff --git a/src/server/game/AI/CoreAI/UnitAI.h b/src/server/game/AI/CoreAI/UnitAI.h
index c9f56d5caba..e34c17e641a 100644
--- a/src/server/game/AI/CoreAI/UnitAI.h
+++ b/src/server/game/AI/CoreAI/UnitAI.h
@@ -19,11 +19,10 @@
#ifndef TRINITY_UNITAI_H
#define TRINITY_UNITAI_H
-#include "Define.h"
-#include "Unit.h"
#include "Containers.h"
#include "EventMap.h"
-#include <list>
+#include "ObjectGuid.h"
+#include "ThreatManager.h"
#define CAST_AI(a, b) (dynamic_cast<a*>(b))
#define ENSURE_AI(a,b) (EnsureAI<a>(b))
@@ -38,7 +37,11 @@ inline T* EnsureAI(U* ai)
class Player;
class Quest;
+class SpellInfo;
+class Unit;
struct AISpellInfoType;
+enum DamageEffectType : uint8;
+enum SpellEffIndex : uint8;
//Selection method used by SelectTarget
enum SelectAggroTarget
@@ -51,9 +54,9 @@ enum SelectAggroTarget
};
// default predicate function to select target based on distance, player and/or aura criteria
-struct TC_GAME_API DefaultTargetSelector : public std::unary_function<Unit*, bool>
+struct TC_GAME_API DefaultTargetSelector
{
- const Unit* me;
+ Unit const* me;
float m_dist;
bool m_playerOnly;
int32 m_aura;
@@ -94,6 +97,8 @@ struct TC_GAME_API NonTankTargetSelector : public std::unary_function<Unit*, boo
bool _playerOnly;
};
+TC_GAME_API void SortByDistanceTo(Unit* reference, std::list<Unit*>& targets);
+
class TC_GAME_API UnitAI
{
protected:
@@ -106,7 +111,7 @@ class TC_GAME_API UnitAI
virtual void AttackStart(Unit* /*target*/);
virtual void UpdateAI(uint32 diff) = 0;
- virtual void InitializeAI() { if (!me->isDead()) Reset(); }
+ virtual void InitializeAI();
virtual void Reset() { }
@@ -122,16 +127,16 @@ class TC_GAME_API UnitAI
Unit* SelectTarget(SelectAggroTarget targetType, uint32 position = 0, float dist = 0.0f, bool playerOnly = false, int32 aura = 0);
// Select the targets satisfying the predicate.
- // predicate shall extend std::unary_function<Unit*, bool>
- template<class PREDICATE> Unit* SelectTarget(SelectAggroTarget targetType, uint32 position, PREDICATE const& predicate)
+ template<class PREDICATE>
+ Unit* SelectTarget(SelectAggroTarget targetType, uint32 position, PREDICATE const& predicate)
{
- ThreatContainer::StorageType const& threatlist = me->getThreatManager().getThreatList();
+ ThreatContainer::StorageType const& threatlist = GetThreatManager().getThreatList();
if (position >= threatlist.size())
return nullptr;
std::list<Unit*> targetList;
Unit* currentVictim = nullptr;
- if (auto currentVictimReference = me->getThreatManager().getCurrentVictim())
+ if (auto currentVictimReference = GetThreatManager().getCurrentVictim())
{
currentVictim = currentVictimReference->getTarget();
@@ -140,42 +145,38 @@ class TC_GAME_API UnitAI
targetList.push_back(currentVictim);
}
- for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
+ for (HostileReference* hostileRef : threatlist)
{
- if (currentVictim != nullptr && (*itr)->getTarget() != currentVictim && predicate((*itr)->getTarget()))
- targetList.push_back((*itr)->getTarget());
- else if (currentVictim == nullptr && predicate((*itr)->getTarget()))
- targetList.push_back((*itr)->getTarget());
+ if (currentVictim != nullptr && hostileRef->getTarget() != currentVictim && predicate(hostileRef->getTarget()))
+ targetList.push_back(hostileRef->getTarget());
+ else if (currentVictim == nullptr && predicate(hostileRef->getTarget()))
+ targetList.push_back(hostileRef->getTarget());
}
if (position >= targetList.size())
return nullptr;
if (targetType == SELECT_TARGET_NEAREST || targetType == SELECT_TARGET_FARTHEST)
- targetList.sort(Trinity::ObjectDistanceOrderPred(me));
+ SortByDistanceTo(me, targetList);
switch (targetType)
{
case SELECT_TARGET_NEAREST:
case SELECT_TARGET_TOPAGGRO:
{
- std::list<Unit*>::iterator itr = targetList.begin();
+ auto itr = targetList.begin();
std::advance(itr, position);
return *itr;
}
case SELECT_TARGET_FARTHEST:
case SELECT_TARGET_BOTTOMAGGRO:
{
- std::list<Unit*>::reverse_iterator ritr = targetList.rbegin();
+ auto ritr = targetList.rbegin();
std::advance(ritr, position);
return *ritr;
}
case SELECT_TARGET_RANDOM:
- {
- std::list<Unit*>::iterator itr = targetList.begin();
- std::advance(itr, urand(position, uint32(targetList.size() - 1)));
- return *itr;
- }
+ return Trinity::Containers::SelectRandomContainerElement(targetList);
default:
break;
}
@@ -186,22 +187,22 @@ class TC_GAME_API UnitAI
void SelectTargetList(std::list<Unit*>& targetList, uint32 num, SelectAggroTarget targetType, float dist = 0.0f, bool playerOnly = false, int32 aura = 0);
// Select the targets satifying the predicate.
- // predicate shall extend std::unary_function<Unit*, bool>
- template <class PREDICATE> void SelectTargetList(std::list<Unit*>& targetList, PREDICATE const& predicate, uint32 maxTargets, SelectAggroTarget targetType)
+ template <class PREDICATE>
+ void SelectTargetList(std::list<Unit*>& targetList, PREDICATE const& predicate, uint32 maxTargets, SelectAggroTarget targetType)
{
- ThreatContainer::StorageType const& threatlist = me->getThreatManager().getThreatList();
+ ThreatContainer::StorageType const& threatlist = GetThreatManager().getThreatList();
if (threatlist.empty())
return;
- for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
- if (predicate((*itr)->getTarget()))
- targetList.push_back((*itr)->getTarget());
+ for (HostileReference* hostileRef : threatlist)
+ if (predicate(hostileRef->getTarget()))
+ targetList.push_back(hostileRef->getTarget());
if (targetList.size() < maxTargets)
return;
if (targetType == SELECT_TARGET_NEAREST || targetType == SELECT_TARGET_FARTHEST)
- targetList.sort(Trinity::ObjectDistanceOrderPred(me));
+ SortByDistanceTo(me, targetList);
if (targetType == SELECT_TARGET_FARTHEST || targetType == SELECT_TARGET_BOTTOMAGGRO)
targetList.reverse();
@@ -256,6 +257,8 @@ class TC_GAME_API UnitAI
private:
UnitAI(UnitAI const& right) = delete;
UnitAI& operator=(UnitAI const& right) = delete;
+
+ ThreatManager& GetThreatManager();
};
#endif
diff --git a/src/server/game/AI/CreatureAI.cpp b/src/server/game/AI/CreatureAI.cpp
index faac3ad6767..2dd54975ba6 100644
--- a/src/server/game/AI/CreatureAI.cpp
+++ b/src/server/game/AI/CreatureAI.cpp
@@ -17,16 +17,18 @@
*/
#include "CreatureAI.h"
-#include "CreatureAIImpl.h"
+#include "AreaBoundary.h"
#include "Creature.h"
-#include "World.h"
-#include "SpellMgr.h"
-#include "Vehicle.h"
+#include "CreatureAIImpl.h"
+#include "CreatureTextMgr.h"
+#include "Language.h"
#include "Log.h"
#include "MapReference.h"
#include "Player.h"
-#include "CreatureTextMgr.h"
-#include "Language.h"
+#include "SpellMgr.h"
+#include "TemporarySummon.h"
+#include "Vehicle.h"
+#include "World.h"
//Disable CreatureAI when charmed
void CreatureAI::OnCharmed(bool apply)
@@ -39,7 +41,7 @@ void CreatureAI::OnCharmed(bool apply)
}
AISpellInfoType* UnitAI::AISpellInfo;
-AISpellInfoType* GetAISpellInfo(uint32 i) { return &CreatureAI::AISpellInfo[i]; }
+AISpellInfoType* GetAISpellInfo(uint32 i) { return &UnitAI::AISpellInfo[i]; }
CreatureAI::CreatureAI(Creature* creature) : UnitAI(creature), me(creature), _boundary(nullptr), m_MoveInLineOfSight_locked(false)
{
@@ -364,8 +366,8 @@ bool CreatureAI::CheckBoundary(Position const* who) const
who = me;
if (_boundary)
- for (CreatureBoundary::const_iterator it = _boundary->begin(); it != _boundary->end(); ++it)
- if (!(*it)->IsWithinBoundary(who))
+ for (AreaBoundary const* boundary : *_boundary)
+ if (!boundary->IsWithinBoundary(who))
return false;
return true;
diff --git a/src/server/game/AI/CreatureAI.h b/src/server/game/AI/CreatureAI.h
index 0e7652569fb..63ecf516666 100644
--- a/src/server/game/AI/CreatureAI.h
+++ b/src/server/game/AI/CreatureAI.h
@@ -20,15 +20,19 @@
#define TRINITY_CREATUREAI_H
#include "UnitAI.h"
-#include "AreaBoundary.h"
#include "Common.h"
+#include "ObjectDefines.h"
-class WorldObject;
-class Unit;
+class AreaBoundary;
+class AreaTrigger;
class Creature;
-class Player;
+class DynamicObject;
+class GameObject;
class PlayerAI;
-class SpellInfo;
+class WorldObject;
+struct Position;
+
+typedef std::set<AreaBoundary const*> CreatureBoundary;
#define TIME_INTERVAL_LOOK 5000
#define VISIBILITY_RANGE 10000
@@ -64,7 +68,6 @@ enum SCEquip
EQUIP_UNEQUIP = 0
};
-typedef std::set<AreaBoundary const*> CreatureBoundary;
class TC_GAME_API CreatureAI : public UnitAI
{
protected:
diff --git a/src/server/game/AI/CreatureAIImpl.h b/src/server/game/AI/CreatureAIImpl.h
index e0346eac10a..39261718180 100644
--- a/src/server/game/AI/CreatureAIImpl.h
+++ b/src/server/game/AI/CreatureAIImpl.h
@@ -17,17 +17,13 @@
#ifndef CREATUREAIIMPL_H
#define CREATUREAIIMPL_H
-#include "Common.h"
-#include "Define.h"
-#include "TemporarySummon.h"
-#include "CreatureAI.h"
-#include "SpellMgr.h"
-
-#include <functional>
+#include "Random.h"
#include <type_traits>
+class WorldObject;
+
template<typename First, typename Second, typename... Rest>
-static inline First const& RAND(First const& first, Second const& second, Rest const&... rest)
+inline First const& RAND(First const& first, Second const& second, Rest const&... rest)
{
std::reference_wrapper<typename std::add_const<First>::type> const pack[] = { first, second, rest... };
return pack[urand(0, sizeof...(rest) + 1)].get();
@@ -65,5 +61,15 @@ struct AISpellInfoType
AISpellInfoType* GetAISpellInfo(uint32 i);
-#endif
+TC_GAME_API bool InstanceHasScript(WorldObject const* obj, char const* scriptName);
+
+template<class AI, class T>
+inline AI* GetInstanceAI(T* obj, char const* scriptName)
+{
+ if (InstanceHasScript(obj, scriptName))
+ return new AI(obj);
+
+ return nullptr;
+}
+#endif
diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
index 12220998df2..f9334bf9710 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
@@ -17,14 +17,15 @@
*/
#include "ScriptedCreature.h"
-#include "Spell.h"
-#include "GridNotifiers.h"
-#include "GridNotifiersImpl.h"
+#include "AreaBoundary.h"
#include "Cell.h"
#include "CellImpl.h"
+#include "GridNotifiers.h"
+#include "GridNotifiersImpl.h"
+#include "InstanceScript.h"
#include "Log.h"
#include "ObjectMgr.h"
-#include "AreaBoundary.h"
+#include "Spell.h"
// Spell summary for ScriptedAI::SelectSpell
struct TSpellSummary
@@ -33,6 +34,16 @@ struct TSpellSummary
uint8 Effects; // set of enum SelectEffect
} extern* SpellSummary;
+void SummonList::Summon(Creature const* summon)
+{
+ storage_.push_back(summon->GetGUID());
+}
+
+void SummonList::Despawn(Creature const* summon)
+{
+ storage_.remove(summon->GetGUID());
+}
+
void SummonList::DoZoneInCombat(uint32 entry, float maxRangeToNearestTarget)
{
for (StorageType::iterator i = storage_.begin(); i != storage_.end();)
@@ -190,6 +201,16 @@ Creature* ScriptedAI::DoSpawnCreature(uint32 entry, float offsetX, float offsetY
return me->SummonCreature(entry, me->GetPositionX() + offsetX, me->GetPositionY() + offsetY, me->GetPositionZ() + offsetZ, angle, TempSummonType(type), despawntime);
}
+bool ScriptedAI::HealthBelowPct(uint32 pct) const
+{
+ return me->HealthBelowPct(pct);
+}
+
+bool ScriptedAI::HealthAbovePct(uint32 pct) const
+{
+ return me->HealthAbovePct(pct);
+}
+
SpellInfo const* ScriptedAI::SelectSpell(Unit* target, uint32 school, uint32 mechanic, SelectTargetType targets, float rangeMin, float rangeMax, SelectEffect effect)
{
//No target so we can't cast
@@ -482,6 +503,11 @@ void BossAI::_JustDied()
instance->SetBossState(_bossId, DONE);
}
+void BossAI::_JustReachedHome()
+{
+ me->setActive(false);
+}
+
void BossAI::_EnterCombat()
{
if (instance)
@@ -545,6 +571,11 @@ void BossAI::UpdateAI(uint32 diff)
DoMeleeAttackIfReady();
}
+bool BossAI::CanAIAttack(Unit const* target) const
+{
+ return CheckBoundary(target);
+}
+
void BossAI::_DespawnAtEvade(uint32 delayToRespawn, Creature* who)
{
if (delayToRespawn < 2)
diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.h b/src/server/game/AI/ScriptedAI/ScriptedCreature.h
index e9c8168cf63..8b634579b48 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedCreature.h
+++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.h
@@ -19,10 +19,9 @@
#ifndef SCRIPTEDCREATURE_H_
#define SCRIPTEDCREATURE_H_
-#include "Creature.h"
#include "CreatureAI.h"
-#include "CreatureAIImpl.h"
-#include "InstanceScript.h"
+#include "Creature.h" // convenience include for scripts, all uses of ScriptedCreature also need Creature (except ScriptedCreature itself doesn't need Creature)
+#include "DBCEnums.h"
#include "TaskScheduler.h"
class InstanceScript;
@@ -84,8 +83,8 @@ public:
storage_.clear();
}
- void Summon(Creature const* summon) { storage_.push_back(summon->GetGUID()); }
- void Despawn(Creature const* summon) { storage_.remove(summon->GetGUID()); }
+ void Summon(Creature const* summon);
+ void Despawn(Creature const* summon);
void DespawnEntry(uint32 entry);
void DespawnAll();
@@ -236,8 +235,8 @@ struct TC_GAME_API ScriptedAI : public CreatureAI
//Spawns a creature relative to me
Creature* DoSpawnCreature(uint32 entry, float offsetX, float offsetY, float offsetZ, float angle, uint32 type, uint32 despawntime);
- bool HealthBelowPct(uint32 pct) const { return me->HealthBelowPct(pct); }
- bool HealthAbovePct(uint32 pct) const { return me->HealthAbovePct(pct); }
+ bool HealthBelowPct(uint32 pct) const;
+ bool HealthAbovePct(uint32 pct) const;
//Returns spells that meet the specified criteria from the creatures spell list
SpellInfo const* SelectSpell(Unit* target, uint32 school, uint32 mechanic, SelectTargetType targets, float rangeMin, float rangeMax, SelectEffect effect);
@@ -349,13 +348,13 @@ class TC_GAME_API BossAI : public ScriptedAI
void JustDied(Unit* /*killer*/) override { _JustDied(); }
void JustReachedHome() override { _JustReachedHome(); }
- bool CanAIAttack(Unit const* target) const override { return CheckBoundary(target); }
+ bool CanAIAttack(Unit const* target) const override;
protected:
void _Reset();
void _EnterCombat();
void _JustDied();
- void _JustReachedHome() { me->setActive(false); }
+ void _JustReachedHome();
void _DespawnAtEvade(uint32 delayToRespawn = 30, Creature* who = nullptr);
void _DespawnAtEvade(Seconds const& time, Creature* who = nullptr) { _DespawnAtEvade(uint32(time.count()), who); }
diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
index efa096196f3..e0de158831c 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
@@ -24,11 +24,11 @@ SDCategory: Npc
EndScriptData */
#include "ScriptedEscortAI.h"
+#include "Creature.h"
#include "Group.h"
#include "Log.h"
#include "ObjectAccessor.h"
#include "Player.h"
-#include "ScriptedCreature.h"
enum Points
{
diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp
index e6fa110ad7f..7a1bcb14680 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp
@@ -24,11 +24,11 @@ SDCategory: Npc
EndScriptData */
#include "ScriptedFollowerAI.h"
+#include "Creature.h"
#include "Log.h"
#include "Group.h"
#include "ObjectAccessor.h"
#include "Player.h"
-#include "ScriptedCreature.h"
const float MAX_PLAYER_DISTANCE = 100.0f;
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp
index afaffc5abb8..0280af9498e 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
@@ -22,18 +22,19 @@
#include "CreatureTextMgr.h"
#include "GameEventMgr.h"
#include "GameObject.h"
+#include "GossipDef.h"
#include "GridNotifiersImpl.h"
#include "InstanceScript.h"
#include "Language.h"
#include "Log.h"
#include "Map.h"
#include "ObjectAccessor.h"
+#include "ObjectMgr.h"
#include "Random.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
#include "SmartAI.h"
#include "SpellAuras.h"
#include "Vehicle.h"
+#include <G3D/Quat.h>
SmartScript::SmartScript()
{
@@ -1447,7 +1448,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
Position pos = (*itr)->GetPositionWithOffset(Position(e.target.x, e.target.y, e.target.z, e.target.o));
G3D::Quat rot = G3D::Matrix3::fromEulerAnglesZYX(pos.GetOrientation(), 0.f, 0.f);
- summoner->SummonGameObject(e.action.summonGO.entry, pos, rot, e.action.summonGO.despawnTime);
+ summoner->SummonGameObject(e.action.summonGO.entry, pos, QuaternionData(rot.x, rot.y, rot.z, rot.w), e.action.summonGO.despawnTime);
}
delete targets;
@@ -1457,7 +1458,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
break;
G3D::Quat rot = G3D::Matrix3::fromEulerAnglesZYX(e.target.o, 0.f, 0.f);
- summoner->SummonGameObject(e.action.summonGO.entry, Position(e.target.x, e.target.y, e.target.z, e.target.o), rot, e.action.summonGO.despawnTime);
+ summoner->SummonGameObject(e.action.summonGO.entry, Position(e.target.x, e.target.y, e.target.z, e.target.o), QuaternionData(rot.x, rot.y, rot.z, rot.w), e.action.summonGO.despawnTime);
break;
}
case SMART_ACTION_KILL_UNIT:
@@ -2294,9 +2295,9 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (e.action.sendGossipMenu.gossipMenuId)
player->PrepareGossipMenu(GetBaseObject(), e.action.sendGossipMenu.gossipMenuId, true);
else
- ClearGossipMenuFor(player);
+ player->PlayerTalkClass->ClearMenus();
- SendGossipMenuFor(player, e.action.sendGossipMenu.gossipNpcTextId, GetBaseObject()->GetGUID());
+ player->PlayerTalkClass->SendGossipMenu(e.action.sendGossipMenu.gossipNpcTextId, GetBaseObject()->GetGUID());
}
}
@@ -2971,13 +2972,13 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /*
}
case SMART_TARGET_CLOSEST_CREATURE:
{
- if (Creature* target = GetClosestCreatureWithEntry(baseObject, e.target.closest.entry, float(e.target.closest.dist ? e.target.closest.dist : 100), !e.target.closest.dead))
+ if (Creature* target = baseObject->FindNearestCreature(e.target.closest.entry, float(e.target.closest.dist ? e.target.closest.dist : 100), !e.target.closest.dead))
l->push_back(target);
break;
}
case SMART_TARGET_CLOSEST_GAMEOBJECT:
{
- if (GameObject* target = GetClosestGameObjectWithEntry(baseObject, e.target.closest.entry, float(e.target.closest.dist ? e.target.closest.dist : 100)))
+ if (GameObject* target = baseObject->FindNearestGameObject(e.target.closest.entry, float(e.target.closest.dist ? e.target.closest.dist : 100)))
l->push_back(target);
break;
}
diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp
index 2e243dd851d..f8538ab0a43 100644
--- a/src/server/game/Battlefield/Battlefield.cpp
+++ b/src/server/game/Battlefield/Battlefield.cpp
@@ -822,7 +822,7 @@ Creature* Battlefield::SpawnCreature(uint32 entry, Position const& pos)
}
// Method for spawning gameobject on map
-GameObject* Battlefield::SpawnGameObject(uint32 entry, Position const& pos, G3D::Quat const& rot)
+GameObject* Battlefield::SpawnGameObject(uint32 entry, Position const& pos, QuaternionData const& rot)
{
// Get map object
Map* map = sMapMgr->CreateBaseMap(m_MapId);
diff --git a/src/server/game/Battlefield/Battlefield.h b/src/server/game/Battlefield/Battlefield.h
index 71b48f81de1..6cfe1158d08 100644
--- a/src/server/game/Battlefield/Battlefield.h
+++ b/src/server/game/Battlefield/Battlefield.h
@@ -76,8 +76,8 @@ class Map;
class Player;
class Unit;
class WorldPacket;
-
struct Position;
+struct QuaternionData;
struct WorldSafeLocsEntry;
namespace WorldPackets
@@ -88,11 +88,6 @@ namespace WorldPackets
}
}
-namespace G3D
-{
- class Quat;
-}
-
typedef std::vector<BfGraveyard*> GraveyardVect;
typedef std::map<ObjectGuid, time_t> PlayerTimerMap;
@@ -313,7 +308,7 @@ class TC_GAME_API Battlefield : public ZoneScript
// Misc methods
Creature* SpawnCreature(uint32 entry, Position const& pos);
- GameObject* SpawnGameObject(uint32 entry, Position const& pos, G3D::Quat const& rot);
+ GameObject* SpawnGameObject(uint32 entry, Position const& pos, QuaternionData const& rot);
Creature* GetCreature(ObjectGuid guid);
GameObject* GetGameObject(ObjectGuid guid);
diff --git a/src/server/game/Battlefield/Zones/BattlefieldTB.cpp b/src/server/game/Battlefield/Zones/BattlefieldTB.cpp
index b4f9ff8cfca..60948cec1ab 100644
--- a/src/server/game/Battlefield/Zones/BattlefieldTB.cpp
+++ b/src/server/game/Battlefield/Zones/BattlefieldTB.cpp
@@ -97,7 +97,7 @@ bool BattlefieldTB::SetupBattlefield()
TolBaradCapturePoint* capturePoint = new TolBaradCapturePoint(this, GetDefenderTeam());
//Spawn flag pole
- if (GameObject* go = SpawnGameObject(TBCapturePoints[i].entryFlagPole[GetDefenderTeam()], TBCapturePoints[i].pos, G3D::Quat()))
+ if (GameObject* go = SpawnGameObject(TBCapturePoints[i].entryFlagPole[GetDefenderTeam()], TBCapturePoints[i].pos, QuaternionData()))
{
go->SetGoArtKit(GetDefenderTeam() == TEAM_ALLIANCE ? TB_GO_ARTKIT_FLAG_ALLIANCE : TB_GO_ARTKIT_FLAG_HORDE);
capturePoint->SetCapturePointData(go);
@@ -107,7 +107,7 @@ bool BattlefieldTB::SetupBattlefield()
// Spawn towers
for (uint8 i = 0; i < TB_TOWERS_COUNT; i++)
- if (GameObject* go = SpawnGameObject(TBTowers[i].entry, TBTowers[i].pos, G3D::Quat()))
+ if (GameObject* go = SpawnGameObject(TBTowers[i].entry, TBTowers[i].pos, QuaternionData()))
Towers.insert(go->GetGUID());
// Init Graveyards
@@ -511,7 +511,7 @@ void BattlefieldTB::UpdateNPCsAndGameObjects()
TolBaradCapturePoint* capturePoint = new TolBaradCapturePoint(this, GetDefenderTeam());
//Spawn flag pole
- if (GameObject* go = SpawnGameObject(TBCapturePoints[i].entryFlagPole[GetDefenderTeam()], TBCapturePoints[i].pos, G3D::Quat()))
+ if (GameObject* go = SpawnGameObject(TBCapturePoints[i].entryFlagPole[GetDefenderTeam()], TBCapturePoints[i].pos, QuaternionData()))
{
go->SetGoArtKit(GetDefenderTeam() == TEAM_ALLIANCE ? TB_GO_ARTKIT_FLAG_ALLIANCE : TB_GO_ARTKIT_FLAG_HORDE);
capturePoint->SetCapturePointData(go);
@@ -548,7 +548,7 @@ void BattlefieldTB::UpdateNPCsAndGameObjects()
// Spawn portals
for (uint8 i = 0; i < TB_PORTAL_MAX; i++)
- if (GameObject* go = SpawnGameObject(TBPortalEntry[GetDefenderTeam()], TBPortals[i], G3D::Quat()))
+ if (GameObject* go = SpawnGameObject(TBPortalEntry[GetDefenderTeam()], TBPortals[i], QuaternionData()))
TemporaryGOs.insert(go->GetGUID());
// Update towers
@@ -574,7 +574,7 @@ void BattlefieldTB::UpdateNPCsAndGameObjects()
// Spawn banners
for (uint8 i = 0; i < TB_BANNER_MAX; i++)
- if (GameObject* go = SpawnGameObject(TBBannerEntry[GetDefenderTeam()], TBBanners[i], G3D::Quat()))
+ if (GameObject* go = SpawnGameObject(TBBannerEntry[GetDefenderTeam()], TBBanners[i], QuaternionData()))
TemporaryGOs.insert(go->GetGUID());
// Set graveyard controls
diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp
index 7e3cea34858..180cfe4c3f4 100644
--- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp
+++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp
@@ -59,7 +59,7 @@ uint32 const WintergraspFaction[] = { 1732, 1735, 35 };
Position const WintergraspStalkerPos = { 4948.985f, 2937.789f, 550.5172f, 1.815142f };
Position const WintergraspRelicPos = { 5440.379f, 2840.493f, 430.2816f, -1.832595f };
-G3D::Quat const WintergraspRelicRot = { 0.f, 0.f, -0.7933531f, 0.6087617f };
+QuaternionData const WintergraspRelicRot = { 0.f, 0.f, -0.7933531f, 0.6087617f };
uint8 const WG_MAX_OBJ = 32;
uint8 const WG_MAX_TURRET = 15;
@@ -79,7 +79,7 @@ struct WintergraspBuildingSpawnData
uint32 entry;
uint32 WorldState;
Position pos;
- G3D::Quat rot;
+ QuaternionData rot;
WintergraspGameObjectBuildingType type;
};
@@ -252,7 +252,7 @@ WintergraspObjectPositionData const WGOutsideNPC[WG_MAX_OUTSIDE_NPC] =
struct WintergraspGameObjectData
{
Position Pos;
- G3D::Quat Rot;
+ QuaternionData Rot;
uint32 HordeEntry;
uint32 AllianceEntry;
};
diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp
index 8aba555031b..533577e7c22 100644
--- a/src/server/game/Battlegrounds/Battleground.cpp
+++ b/src/server/game/Battlegrounds/Battleground.cpp
@@ -41,6 +41,7 @@
#include "Util.h"
#include "WorldPacket.h"
#include "WorldStatePackets.h"
+#include <G3D/Quat.h>
namespace Trinity
{
@@ -1464,14 +1465,18 @@ bool Battleground::AddObject(uint32 type, uint32 entry, float x, float y, float
if (!map)
return false;
- G3D::Quat rot(rotation0, rotation1, rotation2, rotation3);
+ QuaternionData rot(rotation0, rotation1, rotation2, rotation3);
// Temporally add safety check for bad spawns and send log (object rotations need to be rechecked in sniff)
if (!rotation0 && !rotation1 && !rotation2 && !rotation3)
{
TC_LOG_DEBUG("bg.battleground", "Battleground::AddObject: gameoobject [entry: %u, object type: %u] for BG (map: %u) has zeroed rotation fields, "
"orientation used temporally, but please fix the spawn", entry, type, m_MapId);
- rot = G3D::Matrix3::fromEulerAnglesZYX(o, 0.f, 0.f);
+ G3D::Quat fallbackRot = G3D::Matrix3::fromEulerAnglesZYX(o, 0.f, 0.f);
+ rot.x = fallbackRot.x;
+ rot.y = fallbackRot.y;
+ rot.z = fallbackRot.z;
+ rot.w = fallbackRot.w;
}
// Must be created this way, adding to godatamap would add it to the base map of the instance
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
index 774fca9c7de..7c0f08378c0 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
@@ -154,8 +154,8 @@ bool BattlegroundSA::ResetObjs()
}
// MAD props for Kiper for discovering those values - 4 hours of his work.
- GetBGObject(BG_SA_BOAT_ONE)->SetParentRotation(G3D::Quat(0.f, 0.f, 1.0f, 0.0002f));
- GetBGObject(BG_SA_BOAT_TWO)->SetParentRotation(G3D::Quat(0.f, 0.f, 1.0f, 0.00001f));
+ GetBGObject(BG_SA_BOAT_ONE)->SetParentRotation(QuaternionData(0.f, 0.f, 1.0f, 0.0002f));
+ GetBGObject(BG_SA_BOAT_TWO)->SetParentRotation(QuaternionData(0.f, 0.f, 1.0f, 0.00001f));
SpawnBGObject(BG_SA_BOAT_ONE, RESPAWN_IMMEDIATELY);
SpawnBGObject(BG_SA_BOAT_TWO, RESPAWN_IMMEDIATELY);
diff --git a/src/server/game/DungeonFinding/LFGMgr.h b/src/server/game/DungeonFinding/LFGMgr.h
index e7b18c816cd..9c0d5c91960 100644
--- a/src/server/game/DungeonFinding/LFGMgr.h
+++ b/src/server/game/DungeonFinding/LFGMgr.h
@@ -19,7 +19,7 @@
#define _LFGMGR_H
#include "Common.h"
-#include "Field.h"
+#include "DatabaseEnvFwd.h"
#include "LFG.h"
#include "LFGQueue.h"
#include "LFGGroupData.h"
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp
index c1fb6620fa5..4bb4901823a 100644
--- a/src/server/game/Entities/GameObject/GameObject.cpp
+++ b/src/server/game/Entities/GameObject/GameObject.cpp
@@ -39,6 +39,7 @@
#include "Transport.h"
#include "UpdateFieldFlags.h"
#include "World.h"
+#include <G3D/Quat.h>
GameObject::GameObject() : WorldObject(false), MapObject(),
m_model(nullptr), m_goValue(), m_AI(nullptr), _animKitId(0)
@@ -183,7 +184,7 @@ void GameObject::RemoveFromWorld()
}
}
-bool GameObject::Create(uint32 name_id, Map* map, uint32 /*phaseMask*/, Position const& pos, G3D::Quat const& rotation, uint32 animprogress, GOState go_state, uint32 artKit /*= 0*/)
+bool GameObject::Create(uint32 name_id, Map* map, uint32 /*phaseMask*/, Position const& pos, QuaternionData const& rotation, uint32 animprogress, GOState go_state, uint32 artKit /*= 0*/)
{
ASSERT(map);
SetMap(map);
@@ -237,11 +238,11 @@ bool GameObject::Create(uint32 name_id, Map* map, uint32 /*phaseMask*/, Position
return false;
}
- SetWorldRotation(rotation);
+ SetWorldRotation(rotation.x, rotation.y, rotation.z, rotation.w);
GameObjectAddon const* gameObjectAddon = sObjectMgr->GetGameObjectAddon(GetSpawnId());
// For most of gameobjects is (0, 0, 0, 1) quaternion, there are only some transports with not standard rotation
- G3D::Quat parentRotation;
+ QuaternionData parentRotation;
if (gameObjectAddon)
parentRotation = gameObjectAddon->ParentRotation;
@@ -2027,13 +2028,18 @@ void GameObject::UpdatePackedRotation()
m_packedRotation = z | (y << 21) | (x << 42);
}
-void GameObject::SetWorldRotation(G3D::Quat const& rot)
+void GameObject::SetWorldRotation(float qx, float qy, float qz, float qw)
{
- m_worldRotation = rot.toUnit();
+ G3D::Quat rotation(qx, qy, qz, qw);
+ rotation.unitize();
+ m_worldRotation.x = rotation.x;
+ m_worldRotation.y = rotation.y;
+ m_worldRotation.z = rotation.z;
+ m_worldRotation.w = rotation.w;
UpdatePackedRotation();
}
-void GameObject::SetParentRotation(G3D::Quat const& rotation)
+void GameObject::SetParentRotation(QuaternionData const& rotation)
{
SetFloatValue(GAMEOBJECT_PARENTROTATION + 0, rotation.x);
SetFloatValue(GAMEOBJECT_PARENTROTATION + 1, rotation.y);
@@ -2043,7 +2049,8 @@ void GameObject::SetParentRotation(G3D::Quat const& rotation)
void GameObject::SetWorldRotationAngles(float z_rot, float y_rot, float x_rot)
{
- SetWorldRotation(G3D::Quat(G3D::Matrix3::fromEulerAnglesZYX(z_rot, y_rot, x_rot)));
+ G3D::Quat quat(G3D::Matrix3::fromEulerAnglesZYX(z_rot, y_rot, x_rot));
+ SetWorldRotation(quat.x, quat.y, quat.z, quat.w);
}
void GameObject::ModifyHealth(int32 change, Unit* attackerOrHealer /*= nullptr*/, uint32 spellId /*= 0*/)
diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h
index 64c0ed1711c..0e225bf5faa 100644
--- a/src/server/game/Entities/GameObject/GameObject.h
+++ b/src/server/game/Entities/GameObject/GameObject.h
@@ -25,7 +25,6 @@
#include "Loot.h"
#include "DatabaseEnvFwd.h"
#include "MapObject.h"
-#include <G3D/Quat.h>
class GameObjectAI;
class Group;
@@ -871,10 +870,20 @@ struct GameObjectLocale
std::vector<std::string> Unk1;
};
+struct QuaternionData
+{
+ float x, y, z, w;
+
+ QuaternionData() : x(0.0f), y(0.0f), z(0.0f), w(1.0f) {}
+ QuaternionData(float X, float Y, float Z, float W) : x(X), y(Y), z(Z), w(W) {}
+
+ bool isUnit() const { return fabs(x * x + y * y + z * z + w * w - 1.0f) < 1e-5; }
+};
+
// `gameobject_addon` table
struct GameObjectAddon
{
- G3D::Quat ParentRotation;
+ QuaternionData ParentRotation;
InvisibilityType invisibilityType;
uint32 InvisibilityValue;
};
@@ -893,7 +902,7 @@ struct GameObjectData
float posY;
float posZ;
float orientation;
- G3D::Quat rotation;
+ QuaternionData rotation;
int32 spawntimesecs;
uint32 animprogress;
GOState go_state;
@@ -938,7 +947,7 @@ class TC_GAME_API GameObject : public WorldObject, public GridObject<GameObject>
void RemoveFromWorld() override;
void CleanupsBeforeDelete(bool finalCleanup = true) override;
- bool Create(uint32 name_id, Map* map, uint32 phaseMask, Position const& pos, G3D::Quat const& rotation, uint32 animprogress, GOState go_state, uint32 artKit = 0);
+ bool Create(uint32 name_id, Map* map, uint32 phaseMask, Position const& pos, QuaternionData const& rotation, uint32 animprogress, GOState go_state, uint32 artKit = 0);
void Update(uint32 p_time) override;
GameObjectTemplate const* GetGOInfo() const { return m_goInfo; }
GameObjectTemplateAddon const* GetTemplateAddon() const { return m_goTemplateAddon; }
@@ -953,9 +962,8 @@ class TC_GAME_API GameObject : public WorldObject, public GridObject<GameObject>
// z_rot, y_rot, x_rot - rotation angles around z, y and x axes
void SetWorldRotationAngles(float z_rot, float y_rot, float x_rot);
- void SetWorldRotation(G3D::Quat const& rot);
- G3D::Quat const& GetWorldRotation() const { return m_worldRotation; }
- void SetParentRotation(G3D::Quat const& rotation); // transforms(rotates) transport's path
+ void SetWorldRotation(float qx, float qy, float qz, float qw);
+ void SetParentRotation(QuaternionData const& rotation); // transforms(rotates) transport's path
int64 GetPackedWorldRotation() const { return m_packedRotation; }
// overwrite WorldObject function for proper name localization
@@ -1166,7 +1174,7 @@ class TC_GAME_API GameObject : public WorldObject, public GridObject<GameObject>
GameObjectValue m_goValue;
int64 m_packedRotation;
- G3D::Quat m_worldRotation;
+ QuaternionData m_worldRotation;
Position m_stationaryPosition;
ObjectGuid m_lootRecipient;
diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp
index a97451b1c05..61baafd3c97 100644
--- a/src/server/game/Entities/Object/Object.cpp
+++ b/src/server/game/Entities/Object/Object.cpp
@@ -2494,7 +2494,7 @@ TempSummon* WorldObject::SummonCreature(uint32 id, float x, float y, float z, fl
return SummonCreature(id, pos, spwtype, despwtime, 0);
}
-GameObject* WorldObject::SummonGameObject(uint32 entry, Position const& pos, G3D::Quat const& rot, uint32 respawnTime)
+GameObject* WorldObject::SummonGameObject(uint32 entry, Position const& pos, QuaternionData const& rot, uint32 respawnTime)
{
if (!IsInWorld())
return nullptr;
@@ -2526,7 +2526,7 @@ GameObject* WorldObject::SummonGameObject(uint32 entry, Position const& pos, G3D
return go;
}
-GameObject* WorldObject::SummonGameObject(uint32 entry, float x, float y, float z, float ang, G3D::Quat const& rot, uint32 respawnTime)
+GameObject* WorldObject::SummonGameObject(uint32 entry, float x, float y, float z, float ang, QuaternionData const& rot, uint32 respawnTime)
{
if (!x && !y && !z)
{
diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h
index c5a34ab4a55..d01c4f6cd9e 100644
--- a/src/server/game/Entities/Object/Object.h
+++ b/src/server/game/Entities/Object/Object.h
@@ -51,11 +51,7 @@ class UpdateData;
class WorldObject;
class WorldPacket;
class ZoneScript;
-
-namespace G3D
-{
- class Quat;
-}
+struct QuaternionData;
typedef std::unordered_map<Player*, UpdateData> UpdateDataMapType;
@@ -510,8 +506,8 @@ class TC_GAME_API WorldObject : public Object, public WorldLocation
TempSummon* SummonCreature(uint32 id, Position const& pos, TempSummonType spwtype = TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime = 0, uint32 vehId = 0) const;
TempSummon* SummonCreature(uint32 id, float x, float y, float z, float ang = 0, TempSummonType spwtype = TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime = 0) const;
- GameObject* SummonGameObject(uint32 entry, Position const& pos, G3D::Quat const& rot, uint32 respawnTime /* s */);
- GameObject* SummonGameObject(uint32 entry, float x, float y, float z, float ang, G3D::Quat const& rot, uint32 respawnTime /* s */);
+ GameObject* SummonGameObject(uint32 entry, Position const& pos, QuaternionData const& rot, uint32 respawnTime /* s */);
+ GameObject* SummonGameObject(uint32 entry, float x, float y, float z, float ang, QuaternionData const& rot, uint32 respawnTime /* s */);
Creature* SummonTrigger(float x, float y, float z, float ang, uint32 dur, CreatureAI* (*GetAI)(Creature*) = NULL);
void SummonCreatureGroup(uint8 group, std::list<TempSummon*>* list = NULL);
diff --git a/src/server/game/Entities/Player/KillRewarder.cpp b/src/server/game/Entities/Player/KillRewarder.cpp
index a45ed4e64bd..f7a62a2ae5d 100644
--- a/src/server/game/Entities/Player/KillRewarder.cpp
+++ b/src/server/game/Entities/Player/KillRewarder.cpp
@@ -276,7 +276,7 @@ void KillRewarder::Reward()
{
if (victim->IsDungeonBoss())
if (InstanceScript* instance = _victim->GetInstanceScript())
- instance->UpdateEncounterState(ENCOUNTER_CREDIT_KILL_CREATURE, _victim->GetEntry(), _victim);
+ instance->UpdateEncounterStateForKilledCreature(_victim->GetEntry(), _victim);
if (ObjectGuid::LowType guildId = victim->GetMap()->GetOwnerGuildId())
if (Guild* guild = sGuildMgr->GetGuildById(guildId))
diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp
index 672903f8dea..7b9ab021d5b 100644
--- a/src/server/game/Entities/Transport/Transport.cpp
+++ b/src/server/game/Entities/Transport/Transport.cpp
@@ -99,8 +99,8 @@ bool Transport::Create(ObjectGuid::LowType guidlow, uint32 entry, uint32 mapid,
SetGoType(GAMEOBJECT_TYPE_MAP_OBJ_TRANSPORT);
SetGoAnimProgress(animprogress);
SetName(goinfo->name);
- SetWorldRotation(G3D::Quat());
- SetParentRotation(G3D::Quat());
+ SetWorldRotation(0.0f, 0.0f, 0.0f, 1.0f);
+ SetParentRotation(QuaternionData());
m_model = CreateModel();
return true;
diff --git a/src/server/game/Garrison/Garrison.cpp b/src/server/game/Garrison/Garrison.cpp
index b0fb39d3a94..15eb4880c1d 100644
--- a/src/server/game/Garrison/Garrison.cpp
+++ b/src/server/game/Garrison/Garrison.cpp
@@ -732,7 +732,7 @@ GameObject* Garrison::Plot::CreateGameObject(Map* map, GarrisonFactionIndex fact
}
GameObject* building = new GameObject();
- if (!building->Create(entry, map, 0, PacketInfo.PlotPos.Pos, G3D::Quat(), 255, GO_STATE_READY))
+ if (!building->Create(entry, map, 0, PacketInfo.PlotPos.Pos, QuaternionData(), 255, GO_STATE_READY))
{
delete building;
return nullptr;
@@ -744,7 +744,7 @@ GameObject* Garrison::Plot::CreateGameObject(Map* map, GarrisonFactionIndex fact
{
Position const& pos2 = finalizeInfo->FactionInfo[faction].Pos;
GameObject* finalizer = new GameObject();
- if (finalizer->Create(finalizeInfo->FactionInfo[faction].GameObjectId, map, 0, pos2, G3D::Quat(), 255, GO_STATE_READY))
+ if (finalizer->Create(finalizeInfo->FactionInfo[faction].GameObjectId, map, 0, pos2, QuaternionData(), 255, GO_STATE_READY))
{
// set some spell id to make the object delete itself after use
finalizer->SetSpellId(finalizer->GetGOInfo()->goober.spell);
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index dfa88d4faaa..e01f73abde6 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -1205,7 +1205,7 @@ void ObjectMgr::LoadGameObjectAddons()
}
GameObjectAddon& gameObjectAddon = _gameObjectAddonStore[guid];
- gameObjectAddon.ParentRotation = G3D::Quat(fields[1].GetFloat(), fields[2].GetFloat(), fields[3].GetFloat(), fields[4].GetFloat());
+ gameObjectAddon.ParentRotation = QuaternionData(fields[1].GetFloat(), fields[2].GetFloat(), fields[3].GetFloat(), fields[4].GetFloat());
gameObjectAddon.invisibilityType = InvisibilityType(fields[5].GetUInt8());
gameObjectAddon.InvisibilityValue = fields[6].GetUInt32();
@@ -1225,7 +1225,7 @@ void ObjectMgr::LoadGameObjectAddons()
if (!gameObjectAddon.ParentRotation.isUnit())
{
TC_LOG_ERROR("sql.sql", "GameObject (GUID: " UI64FMTD ") has invalid parent rotation in `gameobject_addon`, set to default", guid);
- gameObjectAddon.ParentRotation = G3D::Quat();
+ gameObjectAddon.ParentRotation = QuaternionData();
}
++count;
diff --git a/src/server/game/Instances/InstanceScript.cpp b/src/server/game/Instances/InstanceScript.cpp
index 7b0cd9305da..2abee1258ab 100644
--- a/src/server/game/Instances/InstanceScript.cpp
+++ b/src/server/game/Instances/InstanceScript.cpp
@@ -17,8 +17,10 @@
*/
#include "InstanceScript.h"
+#include "AreaBoundary.h"
#include "Creature.h"
#include "CreatureAI.h"
+#include "CreatureAIImpl.h"
#include "DatabaseEnv.h"
#include "GameObject.h"
#include "Group.h"
@@ -27,12 +29,14 @@
#include "LFGMgr.h"
#include "Log.h"
#include "Map.h"
+#include "ObjectMgr.h"
#include "Opcodes.h"
#include "Pet.h"
#include "Player.h"
#include "RBAC.h"
#include "ScriptMgr.h"
#include "ScriptReloadMgr.h"
+#include "World.h"
#include "WorldSession.h"
#include <sstream>
@@ -118,6 +122,16 @@ ObjectGuid InstanceScript::GetGuidData(uint32 type) const
return GetObjectGuid(type);
}
+Creature* InstanceScript::GetCreature(uint32 type)
+{
+ return instance->GetCreature(GetObjectGuid(type));
+}
+
+GameObject* InstanceScript::GetGameObject(uint32 type)
+{
+ return instance->GetGameObject(GetObjectGuid(type));
+}
+
void InstanceScript::SetHeaders(std::string const& dataHeaders)
{
for (char header : dataHeaders)
@@ -606,6 +620,11 @@ void InstanceScript::DoCastSpellOnPlayers(uint32 spell)
player->CastSpell(player, spell, true);
}
+bool InstanceScript::ServerAllowsTwoSideGroups()
+{
+ return sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP);
+}
+
bool InstanceScript::CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* /*source*/, Unit const* /*target*/ /*= NULL*/, uint32 /*miscvalue1*/ /*= 0*/)
{
TC_LOG_ERROR("misc", "Achievement system call InstanceScript::CheckAchievementCriteriaMeet but instance script for map %u not have implementation for achievement criteria %u",
@@ -726,6 +745,16 @@ void InstanceScript::UpdateEncounterState(EncounterCreditType type, uint32 credi
}
}
+void InstanceScript::UpdateEncounterStateForKilledCreature(uint32 creatureId, Unit* source)
+{
+ UpdateEncounterState(ENCOUNTER_CREDIT_KILL_CREATURE, creatureId, source);
+}
+
+void InstanceScript::UpdateEncounterStateForSpellCast(uint32 spellId, Unit* source)
+{
+ UpdateEncounterState(ENCOUNTER_CREDIT_CAST_SPELL, spellId, source);
+}
+
void InstanceScript::UpdatePhasing()
{
Map::PlayerList const& players = instance->GetPlayers();
@@ -813,3 +842,11 @@ uint32 InstanceScript::GetCombatResurrectionChargeInterval() const
return interval;
}
+
+bool InstanceHasScript(WorldObject const* obj, char const* scriptName)
+{
+ if (InstanceMap* instance = obj->GetMap()->ToInstanceMap())
+ return instance->GetScriptName() == scriptName;
+
+ return false;
+}
diff --git a/src/server/game/Instances/InstanceScript.h b/src/server/game/Instances/InstanceScript.h
index d4ff288baa5..29db8d031ed 100644
--- a/src/server/game/Instances/InstanceScript.h
+++ b/src/server/game/Instances/InstanceScript.h
@@ -19,12 +19,11 @@
#ifndef TRINITY_INSTANCE_DATA_H
#define TRINITY_INSTANCE_DATA_H
-#include <set>
#include "ZoneScript.h"
-#include "World.h"
-#include "ObjectMgr.h"
-#include "CreatureAI.h"
-#include "Packets/WorldStatePackets.h"
+#include "Common.h"
+#include <map>
+#include <memory>
+#include <set>
#define OUT_SAVE_INST_DATA TC_LOG_DEBUG("scripts", "Saving Instance Data for Instance %s (Map %d, Instance Id %d)", instance->GetMapName(), instance->GetId(), instance->GetInstanceId())
#define OUT_SAVE_INST_DATA_COMPLETE TC_LOG_DEBUG("scripts", "Saving Instance Data for Instance %s (Map %d, Instance Id %d) completed.", instance->GetMapName(), instance->GetId(), instance->GetInstanceId())
@@ -32,12 +31,23 @@
#define OUT_LOAD_INST_DATA_COMPLETE TC_LOG_DEBUG("scripts", "Instance Data Load for Instance %s (Map %d, Instance Id: %d) is complete.", instance->GetMapName(), instance->GetId(), instance->GetInstanceId())
#define OUT_LOAD_INST_DATA_FAIL TC_LOG_ERROR("scripts", "Unable to load Instance Data for Instance %s (Map %d, Instance Id: %d).", instance->GetMapName(), instance->GetId(), instance->GetInstanceId())
-class Map;
-class Unit;
-class Player;
-class GameObject;
+class AreaBoundary;
class Creature;
+class GameObject;
+class Map;
class ModuleReference;
+class Player;
+class Unit;
+enum CriteriaTypes : uint8;
+enum CriteriaTimedTypes : uint8;
+enum EncounterCreditType : uint8;
+namespace WorldPackets
+{
+ namespace WorldState
+ {
+ class InitWorldStates;
+ }
+}
enum EncounterFrameType
{
@@ -109,6 +119,8 @@ struct ObjectData
uint32 type;
};
+typedef std::set<AreaBoundary const*> CreatureBoundary;
+
struct BossInfo
{
BossInfo() : state(TO_BE_DECIDED) { }
@@ -179,14 +191,8 @@ class TC_GAME_API InstanceScript : public ZoneScript
ObjectGuid GetObjectGuid(uint32 type) const;
virtual ObjectGuid GetGuidData(uint32 type) const override;
- inline Creature* GetCreature(uint32 type)
- {
- return instance->GetCreature(GetObjectGuid(type));
- }
- inline GameObject* GetGameObject(uint32 type)
- {
- return instance->GetGameObject(GetObjectGuid(type));
- }
+ Creature* GetCreature(uint32 type);
+ GameObject* GetGameObject(uint32 type);
// Called when a player successfully enters the instance.
virtual void OnPlayerEnter(Player* /*player*/) { }
@@ -223,7 +229,7 @@ class TC_GAME_API InstanceScript : public ZoneScript
void DoCastSpellOnPlayers(uint32 spell);
// Return wether server allow two side groups or not
- bool ServerAllowsTwoSideGroups() { return sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP); }
+ bool ServerAllowsTwoSideGroups();
virtual bool SetBossState(uint32 id, EncounterState state);
EncounterState GetBossState(uint32 id) const { return id < bosses.size() ? bosses[id].state : TO_BE_DECIDED; }
@@ -238,7 +244,8 @@ class TC_GAME_API InstanceScript : public ZoneScript
virtual bool CheckRequiredBosses(uint32 /*bossId*/, Player const* /*player*/ = nullptr) const { return true; }
// Checks encounter state at kill/spellcast
- void UpdateEncounterState(EncounterCreditType type, uint32 creditEntry, Unit* source);
+ void UpdateEncounterStateForKilledCreature(uint32 creatureId, Unit* source);
+ void UpdateEncounterStateForSpellCast(uint32 spellId, Unit* source);
// Used only during loading
void SetCompletedEncountersMask(uint32 newMask) { completedEncounters = newMask; }
@@ -309,6 +316,7 @@ class TC_GAME_API InstanceScript : public ZoneScript
private:
static void LoadObjectData(ObjectData const* creatureData, ObjectInfoMap& objectInfo);
+ void UpdateEncounterState(EncounterCreditType type, uint32 creditEntry, Unit* source);
std::vector<char> headers;
std::vector<BossInfo> bosses;
@@ -330,25 +338,4 @@ class TC_GAME_API InstanceScript : public ZoneScript
#endif // #ifndef TRINITY_API_USE_DYNAMIC_LINKING
};
-template<class AI, class T>
-AI* GetInstanceAI(T* obj, char const* scriptName)
-{
- if (InstanceMap* instance = obj->GetMap()->ToInstanceMap())
- if (instance->GetInstanceScript())
- if (instance->GetScriptId() == sObjectMgr->GetScriptId(scriptName))
- return new AI(obj);
-
- return NULL;
-}
-
-template<class AI, class T>
-AI* GetInstanceAI(T* obj)
-{
- if (InstanceMap* instance = obj->GetMap()->ToInstanceMap())
- if (instance->GetInstanceScript())
- return new AI(obj);
-
- return NULL;
-}
-
#endif // TRINITY_INSTANCE_DATA_H
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp
index 7c29dd65373..5fe949dec57 100644
--- a/src/server/game/Maps/Map.cpp
+++ b/src/server/game/Maps/Map.cpp
@@ -3512,6 +3512,11 @@ bool InstanceMap::Reset(uint8 method)
return m_mapRefManager.isEmpty();
}
+std::string const& InstanceMap::GetScriptName() const
+{
+ return sObjectMgr->GetScriptName(i_script_id);
+}
+
void InstanceMap::PermBindAllPlayers()
{
if (!IsDungeon())
diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h
index 1c9ae67cbcb..f58859316ff 100644
--- a/src/server/game/Maps/Map.h
+++ b/src/server/game/Maps/Map.h
@@ -771,6 +771,7 @@ class TC_GAME_API InstanceMap : public Map
void CreateInstanceData(bool load);
bool Reset(uint8 method);
uint32 GetScriptId() const { return i_script_id; }
+ std::string const& GetScriptName() const;
InstanceScript* GetInstanceScript() { return i_data; }
InstanceScript const* GetInstanceScript() const { return i_data; }
InstanceScenario* GetInstanceScenario() { return i_scenario; }
diff --git a/src/server/game/Server/Packets/CombatLogPackets.h b/src/server/game/Server/Packets/CombatLogPackets.h
index 33ef377323c..5f30b5c65e1 100644
--- a/src/server/game/Server/Packets/CombatLogPackets.h
+++ b/src/server/game/Server/Packets/CombatLogPackets.h
@@ -190,7 +190,7 @@ namespace WorldPackets
int32 OverEnergize = 0;
};
- class SpellInstakillLog final : public ServerPacket
+ class TC_GAME_API SpellInstakillLog final : public ServerPacket
{
public:
SpellInstakillLog() : ServerPacket(SMSG_SPELL_INSTAKILL_LOG, 16 + 16 + 4) { }
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index a5d97bc8843..25cf8d8d897 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -3159,7 +3159,7 @@ void Spell::EffectSummonObjectWild(SpellEffIndex effIndex)
Map* map = target->GetMap();
G3D::Quat rot = G3D::Matrix3::fromEulerAnglesZYX(target->GetOrientation(), 0.f, 0.f);
- if (!pGameObj->Create(gameobject_id, map, m_caster->GetPhaseMask(), Position(x, y, z, target->GetOrientation()), rot, 255, GO_STATE_READY))
+ if (!pGameObj->Create(gameobject_id, map, m_caster->GetPhaseMask(), Position(x, y, z, target->GetOrientation()), QuaternionData(rot.x, rot.y, rot.z, rot.w), 255, GO_STATE_READY))
{
delete pGameObj;
return;
@@ -3185,7 +3185,7 @@ void Spell::EffectSummonObjectWild(SpellEffIndex effIndex)
if (uint32 linkedEntry = pGameObj->GetGOInfo()->GetLinkedGameObjectEntry())
{
GameObject* linkedGO = new GameObject();
- if (linkedGO->Create(linkedEntry, map, m_caster->GetPhaseMask(), Position(x, y, z, target->GetOrientation()), rot, 255, GO_STATE_READY))
+ if (linkedGO->Create(linkedEntry, map, m_caster->GetPhaseMask(), Position(x, y, z, target->GetOrientation()), QuaternionData(rot.x, rot.y, rot.z, rot.w), 255, GO_STATE_READY))
{
linkedGO->CopyPhaseFrom(m_caster);
@@ -3735,7 +3735,7 @@ void Spell::EffectDuel(SpellEffIndex effIndex)
Map* map = m_caster->GetMap();
G3D::Quat rot = G3D::Matrix3::fromEulerAnglesZYX(pos.GetOrientation(), 0.f, 0.f);
- if (!pGameObj->Create(gameobject_id, map, m_caster->GetPhaseMask(), pos, rot, 0, GO_STATE_READY))
+ if (!pGameObj->Create(gameobject_id, map, m_caster->GetPhaseMask(), pos, QuaternionData(rot.x, rot.y, rot.z, rot.w), 0, GO_STATE_READY))
{
delete pGameObj;
return;
@@ -4071,7 +4071,7 @@ void Spell::EffectSummonObject(SpellEffIndex effIndex)
Map* map = m_caster->GetMap();
G3D::Quat rot = G3D::Matrix3::fromEulerAnglesZYX(m_caster->GetOrientation(), 0.f, 0.f);
- if (!go->Create(go_id, map, m_caster->GetPhaseMask(), Position(x, y, z, m_caster->GetOrientation()), rot, 255, GO_STATE_READY))
+ if (!go->Create(go_id, map, m_caster->GetPhaseMask(), Position(x, y, z, m_caster->GetOrientation()), QuaternionData(rot.x, rot.y, rot.z, rot.w), 255, GO_STATE_READY))
{
delete go;
return;
@@ -4755,7 +4755,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex)
Position pos = { fx, fy, fz, m_caster->GetOrientation() };
G3D::Quat rot = G3D::Matrix3::fromEulerAnglesZYX(m_caster->GetOrientation(), 0.f, 0.f);
- if (!pGameObj->Create(name_id, cMap, m_caster->GetPhaseMask(), pos, rot, 255, GO_STATE_READY))
+ if (!pGameObj->Create(name_id, cMap, m_caster->GetPhaseMask(), pos, QuaternionData(rot.x, rot.y, rot.z, rot.w), 255, GO_STATE_READY))
{
delete pGameObj;
return;
@@ -4822,7 +4822,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex)
if (uint32 linkedEntry = pGameObj->GetGOInfo()->GetLinkedGameObjectEntry())
{
GameObject* linkedGO = new GameObject;
- if (linkedGO->Create(linkedEntry, cMap, m_caster->GetPhaseMask(), pos, rot, 255, GO_STATE_READY))
+ if (linkedGO->Create(linkedEntry, cMap, m_caster->GetPhaseMask(), pos, QuaternionData(rot.x, rot.y, rot.z, rot.w), 255, GO_STATE_READY))
{
linkedGO->CopyPhaseFrom(m_caster);
diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp
index a450751df2d..c96086f89ce 100644
--- a/src/server/game/Spells/SpellScript.cpp
+++ b/src/server/game/Spells/SpellScript.cpp
@@ -34,15 +34,19 @@ bool _SpellScript::_Validate(SpellInfo const* entry)
return true;
}
-bool _SpellScript::ValidateSpellInfo(std::vector<uint32> spellIds)
+bool _SpellScript::_ValidateSpellInfo(uint32 const* begin, uint32 const* end)
{
- for (uint32 spellId : spellIds)
- if (!sSpellMgr->GetSpellInfo(spellId))
+ bool allValid = true;
+ while (begin != end)
+ {
+ if (!sSpellMgr->GetSpellInfo(*begin))
{
- TC_LOG_ERROR("scripts.spells", "_SpellScript::ValidateSpellInfo: Spell %u does not exist.", spellId);
- return false;
+ TC_LOG_ERROR("scripts.spells", "_SpellScript::ValidateSpellInfo: Spell %u does not exist.", *begin);
+ allValid = false;
}
- return true;
+ ++begin;
+ }
+ return allValid;
}
void _SpellScript::_Register()
diff --git a/src/server/game/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h
index 17b512ed052..ee1a058f543 100644
--- a/src/server/game/Spells/SpellScript.h
+++ b/src/server/game/Spells/SpellScript.h
@@ -141,7 +141,19 @@ class TC_GAME_API _SpellScript
// use for: deallocating memory allocated by script
virtual void Unload() { }
// Helpers
- static bool ValidateSpellInfo(std::vector<uint32> spellIds);
+ static bool ValidateSpellInfo(std::initializer_list<uint32> spellIds)
+ {
+ return _ValidateSpellInfo(spellIds.begin(), spellIds.end());
+ }
+
+ template<class T>
+ static bool ValidateSpellInfo(T const& spellIds)
+ {
+ return _ValidateSpellInfo(std::begin(spellIds), std::end(spellIds));
+ }
+
+private:
+ static bool _ValidateSpellInfo(uint32 const* begin, uint32 const* end);
};
// SpellScript interface - enum used for runtime checks of script function calls
diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp
index 859fad4eae0..4ece2a87e94 100644
--- a/src/server/scripts/Commands/cs_gobject.cpp
+++ b/src/server/scripts/Commands/cs_gobject.cpp
@@ -34,6 +34,7 @@ EndScriptData */
#include "Player.h"
#include "PoolMgr.h"
#include "RBAC.h"
+#include <G3D/Quat.h>
class gobject_commandscript : public CommandScript
{
@@ -141,7 +142,7 @@ public:
GameObject* object = new GameObject();
G3D::Quat rot = G3D::Matrix3::fromEulerAnglesZYX(player->GetOrientation(), 0.f, 0.f);
- if (!object->Create(objectInfo->entry, map, 0, *player, rot, 255, GO_STATE_READY))
+ if (!object->Create(objectInfo->entry, map, 0, *player, QuaternionData(rot.x, rot.y, rot.z, rot.w), 255, GO_STATE_READY))
{
delete object;
return false;
@@ -206,7 +207,7 @@ public:
return false;
}
- player->SummonGameObject(objectId, *player, rotation, spawntm);
+ player->SummonGameObject(objectId, *player, QuaternionData(rotation.x, rotation.y, rotation.z, rotation.w), spawntm);
return true;
}
diff --git a/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp b/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp
index 2f45e1f2c6c..fc37ab80b42 100644
--- a/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp
+++ b/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp
@@ -16,6 +16,7 @@
*/
#include "ScriptMgr.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
enum Spells
diff --git a/src/server/scripts/EasternKingdoms/BaradinHold/baradin_hold.h b/src/server/scripts/EasternKingdoms/BaradinHold/baradin_hold.h
index ef409622c3f..28bc4a27398 100644
--- a/src/server/scripts/EasternKingdoms/BaradinHold/baradin_hold.h
+++ b/src/server/scripts/EasternKingdoms/BaradinHold/baradin_hold.h
@@ -18,9 +18,7 @@
#ifndef DEF_BARADIN_HOLD_H_
#define DEF_BARADIN_HOLD_H_
-#include "Map.h"
-#include "Creature.h"
-#include "ObjectMgr.h"
+#include "CreatureAIImpl.h"
#define DataHeader "BH"
#define BHScriptName "instance_baradin_hold"
@@ -52,14 +50,10 @@ enum BHGameObjectIds
GO_ALIZABAL_DOOR = 209849
};
-template<class AI>
+template<typename AI>
CreatureAI* GetBaradinHoldAI(Creature* creature)
{
- if (InstanceMap* instance = creature->GetMap()->ToInstanceMap())
- if (instance->GetInstanceScript())
- if (instance->GetScriptId() == sObjectMgr->GetScriptId(BHScriptName))
- return new AI(creature);
- return NULL;
+ return GetInstanceAI<AI>(creature, BHScriptName);
}
#endif
diff --git a/src/server/scripts/EasternKingdoms/BaradinHold/boss_alizabal.cpp b/src/server/scripts/EasternKingdoms/BaradinHold/boss_alizabal.cpp
index 8d468b8d5f0..b7226214694 100644
--- a/src/server/scripts/EasternKingdoms/BaradinHold/boss_alizabal.cpp
+++ b/src/server/scripts/EasternKingdoms/BaradinHold/boss_alizabal.cpp
@@ -16,10 +16,11 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "Player.h"
-#include "ObjectAccessor.h"
#include "baradin_hold.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
+#include "ScriptedCreature.h"
enum Texts
{
@@ -47,7 +48,7 @@ enum Actions
ACTION_INTRO = 1
};
- enum Points
+enum Points
{
POINT_STORM = 1
};
diff --git a/src/server/scripts/EasternKingdoms/BaradinHold/boss_occuthar.cpp b/src/server/scripts/EasternKingdoms/BaradinHold/boss_occuthar.cpp
index 2ae18b7ae61..3092a442c92 100644
--- a/src/server/scripts/EasternKingdoms/BaradinHold/boss_occuthar.cpp
+++ b/src/server/scripts/EasternKingdoms/BaradinHold/boss_occuthar.cpp
@@ -16,11 +16,14 @@
*/
#include "ScriptMgr.h"
+#include "baradin_hold.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
-#include "Vehicle.h"
-#include "SpellScript.h"
#include "SpellAuraEffects.h"
-#include "baradin_hold.h"
+#include "SpellScript.h"
+#include "TemporarySummon.h"
+#include "Vehicle.h"
enum Spells
{
@@ -267,9 +270,7 @@ class spell_occuthar_eyes_of_occuthar : public SpellScriptLoader
bool Validate(SpellInfo const* spellInfo) override
{
- if (!sSpellMgr->GetSpellInfo(spellInfo->GetEffect(EFFECT_0)->CalcValue()))
- return false;
- return true;
+ return ValidateSpellInfo({ uint32(spellInfo->GetEffect(EFFECT_0)->CalcValue()) });
}
bool Load() override
@@ -317,7 +318,7 @@ class spell_occuthar_eyes_of_occuthar_vehicle : public SpellScriptLoader
bool Load() override
{
- return GetCaster()->GetInstanceScript() != NULL;
+ return InstanceHasScript(GetCaster(), BHScriptName);
}
void HandleScript()
diff --git a/src/server/scripts/EasternKingdoms/BaradinHold/boss_pit_lord_argaloth.cpp b/src/server/scripts/EasternKingdoms/BaradinHold/boss_pit_lord_argaloth.cpp
index cc6f2a3c88c..899e1417369 100644
--- a/src/server/scripts/EasternKingdoms/BaradinHold/boss_pit_lord_argaloth.cpp
+++ b/src/server/scripts/EasternKingdoms/BaradinHold/boss_pit_lord_argaloth.cpp
@@ -16,9 +16,11 @@
*/
#include "ScriptMgr.h"
+#include "baradin_hold.h"
+#include "InstanceScript.h"
+#include "Map.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
-#include "baradin_hold.h"
/* TODO:
- Fel Firestorm need completion
diff --git a/src/server/scripts/EasternKingdoms/BaradinHold/instance_baradin_hold.cpp b/src/server/scripts/EasternKingdoms/BaradinHold/instance_baradin_hold.cpp
index 178f60ab773..c241f7a31f8 100644
--- a/src/server/scripts/EasternKingdoms/BaradinHold/instance_baradin_hold.cpp
+++ b/src/server/scripts/EasternKingdoms/BaradinHold/instance_baradin_hold.cpp
@@ -16,8 +16,11 @@
*/
#include "ScriptMgr.h"
-#include "InstanceScript.h"
#include "baradin_hold.h"
+#include "Creature.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "Map.h"
DoorData const doorData[] =
{
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/blackrock_caverns.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/blackrock_caverns.cpp
index 986a18d019d..f1c6ab5573e 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/blackrock_caverns.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/blackrock_caverns.cpp
@@ -16,13 +16,12 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "TemporarySummon.h"
#include "blackrock_caverns.h"
+#include "ScriptedCreature.h"
#include "Spell.h"
-#include "SpellScript.h"
#include "SpellAuras.h"
-#include "Player.h"
+#include "SpellScript.h"
+#include "TemporarySummon.h"
/*#####
# npc_fire_cyclone
@@ -723,15 +722,13 @@ class spell_chains_of_woe_1 : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_CHAINS_OF_WOE_1))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_CHAINS_OF_WOE_1 });
}
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
{
- if (Player* playerTarget = GetHitPlayer())
- playerTarget->CastSpell(GetCaster(), SPELL_CHAINS_OF_WOE_3, true);
+ if (GetHitUnit()->GetTypeId() == TYPEID_PLAYER)
+ GetHitUnit()->CastSpell(GetCaster(), SPELL_CHAINS_OF_WOE_3, true);
}
void Register() override
@@ -760,15 +757,13 @@ class spell_chains_of_woe_4 : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_CHAINS_OF_WOE_4))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_CHAINS_OF_WOE_4 });
}
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
{
- if (Player* playerTarget = GetHitPlayer())
- playerTarget->CastSpell(playerTarget, SPELL_CHAINS_OF_WOE_5, true);
+ if (GetHitUnit()->GetTypeId() == TYPEID_PLAYER)
+ GetHitUnit()->CastSpell(GetHitUnit(), SPELL_CHAINS_OF_WOE_5, true);
}
void Register() override
@@ -805,11 +800,12 @@ class spell_nether_dragon_essence_1 : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_NETHER_DRAGON_ESSENCE_2)
- || !sSpellMgr->GetSpellInfo(SPELL_NETHER_DRAGON_ESSENCE_3)
- || !sSpellMgr->GetSpellInfo(SPELL_NETHER_DRAGON_ESSENCE_4))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_NETHER_DRAGON_ESSENCE_2,
+ SPELL_NETHER_DRAGON_ESSENCE_3,
+ SPELL_NETHER_DRAGON_ESSENCE_4
+ });
}
void HandleTriggerSpell(AuraEffect const* /*aurEff*/)
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/blackrock_caverns.h b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/blackrock_caverns.h
index 38d442a0228..646737c78cf 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/blackrock_caverns.h
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/blackrock_caverns.h
@@ -18,6 +18,8 @@
#ifndef BLACKROCKCAVERNS_H_
#define BLACKROCKCAVERNS_H_
+#include "CreatureAIImpl.h"
+
#define BCScriptName "instance_blackrock_caverns"
#define DataHeader "BRC"
@@ -43,7 +45,7 @@ enum BRCCreatureIds
NPC_ROMOGG_BONECRUSHER = 39665
};
-template<class AI>
+template<typename AI>
inline AI* GetBlackrockCavernsAI(Creature* creature)
{
return GetInstanceAI<AI>(creature, BCScriptName);
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/boss_romogg_bonecrusher.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/boss_romogg_bonecrusher.cpp
index 0250e6fac24..f7e279495cb 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/boss_romogg_bonecrusher.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/boss_romogg_bonecrusher.cpp
@@ -16,8 +16,9 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "blackrock_caverns.h"
+#include "InstanceScript.h"
+#include "ScriptedCreature.h"
enum Romogg
{
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/instance_blackrock_caverns.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/instance_blackrock_caverns.cpp
index 42a15cbcd6a..cff0000c9f5 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/instance_blackrock_caverns.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/instance_blackrock_caverns.cpp
@@ -16,8 +16,9 @@
*/
#include "ScriptMgr.h"
-#include "InstanceScript.h"
#include "blackrock_caverns.h"
+#include "InstanceScript.h"
+#include "Map.h"
ObjectData const creatureData[] =
{
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp
index 4e3d446fd73..965908e99d0 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp
@@ -16,12 +16,16 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedEscortAI.h"
-#include "ScriptedGossip.h"
#include "blackrock_depths.h"
-#include "Player.h"
+#include "CreatureAIImpl.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
#include "Log.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
+#include "ScriptedEscortAI.h"
+#include "ScriptedGossip.h"
+#include "TemporarySummon.h"
#include "WorldSession.h"
//go_shadowforge_brazier
@@ -118,7 +122,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_grimstoneAI>(creature);
+ return GetBlackrockDepthsAI<npc_grimstoneAI>(creature);
}
struct npc_grimstoneAI : public npc_escortAI
@@ -214,7 +218,7 @@ public:
Event_Timer = 5000;
break;
case 5:
- instance->UpdateEncounterState(ENCOUNTER_CREDIT_KILL_CREATURE, NPC_GRIMSTONE, me);
+ instance->UpdateEncounterStateForKilledCreature(NPC_GRIMSTONE, me);
instance->SetData(TYPE_RING_OF_LAW, DONE);
TC_LOG_DEBUG("scripts", "npc_grimstone: event reached end and set complete.");
break;
@@ -516,7 +520,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_rocknotAI>(creature);
+ return GetBlackrockDepthsAI<npc_rocknotAI>(creature);
}
struct npc_rocknotAI : public npc_escortAI
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.h b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.h
index 594bde59bae..d0a473fe3fc 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.h
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.h
@@ -19,7 +19,10 @@
#ifndef DEF_BRD_H
#define DEF_BRD_H
+#include "CreatureAIImpl.h"
+
#define DataHeader "BRD"
+#define BRDScriptName "instance_blackrock_depths"
enum BRDFactionIds
{
@@ -63,4 +66,10 @@ enum BRDDataTypes
DATA_MOIRA = 27,
};
+template<typename AI>
+inline AI* GetBlackrockDepthsAI(Creature* creature)
+{
+ return GetInstanceAI<AI>(creature, BRDScriptName);
+}
+
#endif
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp
index 73511b5d0e4..43b01d2f564 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp
@@ -16,8 +16,10 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "blackrock_depths.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
enum Yells
{
@@ -112,7 +114,7 @@ class boss_emperor_dagran_thaurissan : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_draganthaurissanAI>(creature);
+ return GetBlackrockDepthsAI<boss_draganthaurissanAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_magmus.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_magmus.cpp
index fe432438811..8aaf31c3c1e 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_magmus.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_magmus.cpp
@@ -16,8 +16,9 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "blackrock_depths.h"
+#include "InstanceScript.h"
+#include "ScriptedCreature.h"
enum Spells
{
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_tomb_of_seven.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_tomb_of_seven.cpp
index 989a2b06fcb..ec2c861a4cf 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_tomb_of_seven.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_tomb_of_seven.cpp
@@ -17,10 +17,11 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
#include "blackrock_depths.h"
+#include "InstanceScript.h"
#include "Player.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
enum Spells
{
@@ -254,7 +255,7 @@ class boss_doomrel : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_doomrelAI>(creature);
+ return GetBlackrockDepthsAI<boss_doomrelAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp
index e6e5bf78608..76f2fd1639c 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp
@@ -17,10 +17,12 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "blackrock_depths.h"
+#include "GameObject.h"
#include "InstanceScript.h"
#include "Log.h"
-#include "blackrock_depths.h"
+#include "Map.h"
+#include "ScriptedCreature.h"
#define TIMER_TOMBOFTHESEVEN 15000
#define MAX_ENCOUNTER 6
@@ -68,7 +70,7 @@ enum GameObjects
class instance_blackrock_depths : public InstanceMapScript
{
public:
- instance_blackrock_depths() : InstanceMapScript("instance_blackrock_depths", 230) { }
+ instance_blackrock_depths() : InstanceMapScript(BRDScriptName, 230) { }
InstanceScript* GetInstanceScript(InstanceMap* map) const override
{
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/blackrock_spire.h b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/blackrock_spire.h
index 4d660b89907..b4bda52ccf4 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/blackrock_spire.h
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/blackrock_spire.h
@@ -18,6 +18,8 @@
#ifndef DEF_BLACKROCK_SPIRE_H
#define DEF_BLACKROCK_SPIRE_H
+#include "CreatureAIImpl.h"
+
uint32 const EncounterCount = 23;
#define BRSScriptName "instance_blackrock_spire"
@@ -118,4 +120,10 @@ enum BRSGameObjectsIds
GO_PORTCULLIS_TOBOSSROOMS = 175186
};
+template<typename AI>
+inline AI* GetBlackrockSpireAI(Creature* creature)
+{
+ return GetInstanceAI<AI>(creature, BRSScriptName);
+}
+
#endif
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_drakkisath.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_drakkisath.cpp
index 56f5580daa0..ebb908bafbc 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_drakkisath.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_drakkisath.cpp
@@ -17,8 +17,8 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "blackrock_spire.h"
+#include "ScriptedCreature.h"
enum Spells
{
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_gizrul_the_slavener.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_gizrul_the_slavener.cpp
index 5e76a4e020b..12f81a0d557 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_gizrul_the_slavener.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_gizrul_the_slavener.cpp
@@ -16,8 +16,8 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "blackrock_spire.h"
+#include "ScriptedCreature.h"
#include "TemporarySummon.h"
enum Spells
@@ -105,7 +105,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_gizrul_the_slavenerAI(creature);
+ return GetBlackrockSpireAI<boss_gizrul_the_slavenerAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_gyth.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_gyth.cpp
index 34eae895bae..d3d86ad629f 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_gyth.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_gyth.cpp
@@ -16,8 +16,10 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "blackrock_spire.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "ScriptedCreature.h"
enum Spells
{
@@ -176,7 +178,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_gythAI>(creature);
+ return GetBlackrockSpireAI<boss_gythAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_halycon.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_halycon.cpp
index 7626afd3fff..591cb75ecc7 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_halycon.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_halycon.cpp
@@ -16,8 +16,8 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "blackrock_spire.h"
+#include "ScriptedCreature.h"
enum Spells
{
@@ -112,7 +112,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_halyconAI(creature);
+ return GetBlackrockSpireAI<boss_halyconAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_highlord_omokk.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_highlord_omokk.cpp
index a8766ac625b..39742ea6a3f 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_highlord_omokk.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_highlord_omokk.cpp
@@ -17,8 +17,8 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "blackrock_spire.h"
+#include "ScriptedCreature.h"
enum Spells
{
@@ -39,7 +39,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_highlordomokkAI(creature);
+ return GetBlackrockSpireAI<boss_highlordomokkAI>(creature);
}
struct boss_highlordomokkAI : public BossAI
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_lord_valthalak.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_lord_valthalak.cpp
index 17ae664c816..576b9e5e3eb 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_lord_valthalak.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_lord_valthalak.cpp
@@ -16,8 +16,9 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "blackrock_spire.h"
+#include "InstanceScript.h"
+#include "ScriptedCreature.h"
enum Spells
{
@@ -138,7 +139,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_lord_valthalakAI>(creature);
+ return GetBlackrockSpireAI<boss_lord_valthalakAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_mother_smolderweb.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_mother_smolderweb.cpp
index aaf86640eb7..92df2fa0d74 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_mother_smolderweb.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_mother_smolderweb.cpp
@@ -17,8 +17,8 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "blackrock_spire.h"
+#include "ScriptedCreature.h"
enum Spells
{
@@ -40,7 +40,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_mothersmolderwebAI(creature);
+ return GetBlackrockSpireAI<boss_mothersmolderwebAI>(creature);
}
struct boss_mothersmolderwebAI : public BossAI
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_overlord_wyrmthalak.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_overlord_wyrmthalak.cpp
index 18689249237..eb77fa7bf5e 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_overlord_wyrmthalak.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_overlord_wyrmthalak.cpp
@@ -17,8 +17,9 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "blackrock_spire.h"
+#include "ScriptedCreature.h"
+#include "TemporarySummon.h"
enum Spells
{
@@ -52,7 +53,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_overlordwyrmthalakAI(creature);
+ return GetBlackrockSpireAI<boss_overlordwyrmthalakAI>(creature);
}
struct boss_overlordwyrmthalakAI : public BossAI
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_pyroguard_emberseer.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_pyroguard_emberseer.cpp
index b70e7a00ec7..a9292b05c92 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_pyroguard_emberseer.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_pyroguard_emberseer.cpp
@@ -313,7 +313,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_pyroguard_emberseerAI>(creature);
+ return GetBlackrockSpireAI<boss_pyroguard_emberseerAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_quartermaster_zigris.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_quartermaster_zigris.cpp
index aff9775b795..9ca38215d2d 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_quartermaster_zigris.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_quartermaster_zigris.cpp
@@ -16,8 +16,8 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "blackrock_spire.h"
+#include "ScriptedCreature.h"
enum Spells
{
@@ -92,7 +92,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_quatermasterzigrisAI(creature);
+ return GetBlackrockSpireAI<boss_quatermasterzigrisAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_rend_blackhand.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_rend_blackhand.cpp
index 1e99e07f9e0..bdf11bc06b4 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_rend_blackhand.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_rend_blackhand.cpp
@@ -17,9 +17,11 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "Player.h"
#include "blackrock_spire.h"
+#include "GameObject.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
+#include "ScriptedCreature.h"
enum Spells
{
@@ -452,7 +454,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_rend_blackhandAI>(creature);
+ return GetBlackrockSpireAI<boss_rend_blackhandAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_shadow_hunter_voshgajin.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_shadow_hunter_voshgajin.cpp
index 79d556fc51d..3b3dd5c1892 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_shadow_hunter_voshgajin.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_shadow_hunter_voshgajin.cpp
@@ -17,8 +17,8 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "blackrock_spire.h"
+#include "ScriptedCreature.h"
enum Spells
{
@@ -41,7 +41,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_shadowvoshAI(creature);
+ return GetBlackrockSpireAI<boss_shadowvoshAI>(creature);
}
struct boss_shadowvoshAI : public BossAI
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_the_beast.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_the_beast.cpp
index 5cd6e60a186..6b1c72cb715 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_the_beast.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_the_beast.cpp
@@ -17,8 +17,8 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "blackrock_spire.h"
+#include "ScriptedCreature.h"
enum Spells
{
@@ -41,7 +41,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_thebeastAI(creature);
+ return GetBlackrockSpireAI<boss_thebeastAI>(creature);
}
struct boss_thebeastAI : public BossAI
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_urok_doomhowl.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_urok_doomhowl.cpp
index 0b4e238a8b1..fb0fc3e20d8 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_urok_doomhowl.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_urok_doomhowl.cpp
@@ -16,8 +16,8 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "blackrock_spire.h"
+#include "ScriptedCreature.h"
enum Spells
{
@@ -101,7 +101,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_urok_doomhowlAI(creature);
+ return GetBlackrockSpireAI<boss_urok_doomhowlAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_warmaster_voone.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_warmaster_voone.cpp
index b1db789dcb3..6b627e97a8d 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_warmaster_voone.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_warmaster_voone.cpp
@@ -17,8 +17,8 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "blackrock_spire.h"
+#include "ScriptedCreature.h"
enum Spells
{
@@ -119,7 +119,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_warmastervooneAI(creature);
+ return GetBlackrockSpireAI<boss_warmastervooneAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/instance_blackrock_spire.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/instance_blackrock_spire.cpp
index 29698befde8..599423ea7d8 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/instance_blackrock_spire.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/instance_blackrock_spire.cpp
@@ -15,15 +15,13 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "Cell.h"
+#include "ScriptMgr.h"
+#include "blackrock_spire.h"
#include "CellImpl.h"
-#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "InstanceScript.h"
#include "Player.h"
#include "ScriptedCreature.h"
-#include "ScriptMgr.h"
-#include "blackrock_spire.h"
//uint32 const DragonspireRunes[7] = { GO_HALL_RUNE_1, GO_HALL_RUNE_2, GO_HALL_RUNE_3, GO_HALL_RUNE_4, GO_HALL_RUNE_5, GO_HALL_RUNE_6, GO_HALL_RUNE_7 };
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/blackwing_lair.h b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/blackwing_lair.h
index 79f47eeb412..16ea7124c48 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/blackwing_lair.h
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/blackwing_lair.h
@@ -18,9 +18,11 @@
#ifndef DEF_BLACKWING_LAIR_H
#define DEF_BLACKWING_LAIR_H
+#include "CreatureAIImpl.h"
+
uint32 const EncounterCount = 8;
-#define BRLScriptName "instance_blackwing_lair"
+#define BWLScriptName "instance_blackwing_lair"
#define DataHeader "BWL"
enum BWLEncounter
@@ -80,4 +82,10 @@ enum BWLMisc
DATA_EGG_EVENT
};
+template<typename AI>
+inline AI* GetBlackwingLairAI(Creature* creature)
+{
+ return GetInstanceAI<AI>(creature, BWLScriptName);
+}
+
#endif
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_broodlord_lashlayer.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_broodlord_lashlayer.cpp
index 2973622d842..01f2ded730c 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_broodlord_lashlayer.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_broodlord_lashlayer.cpp
@@ -110,7 +110,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_broodlordAI>(creature);
+ return GetBlackwingLairAI<boss_broodlordAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_chromaggus.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_chromaggus.cpp
index 7198bd276e6..2b9bf7b3db5 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_chromaggus.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_chromaggus.cpp
@@ -290,7 +290,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_chromaggusAI>(creature);
+ return GetBlackwingLairAI<boss_chromaggusAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_ebonroc.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_ebonroc.cpp
index 44332ac7663..4c6a67af370 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_ebonroc.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_ebonroc.cpp
@@ -90,7 +90,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_ebonrocAI>(creature);
+ return GetBlackwingLairAI<boss_ebonrocAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_firemaw.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_firemaw.cpp
index 958ff2ef3fa..d80ffed0c9b 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_firemaw.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_firemaw.cpp
@@ -92,7 +92,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_firemawAI>(creature);
+ return GetBlackwingLairAI<boss_firemawAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_flamegor.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_flamegor.cpp
index 9161c6bb4ca..25eed2e746e 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_flamegor.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_flamegor.cpp
@@ -98,7 +98,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_flamegorAI>(creature);
+ return GetBlackwingLairAI<boss_flamegorAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp
index 8beabee541b..12a4f888c0b 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp
@@ -17,10 +17,13 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedGossip.h"
-#include "ScriptedCreature.h"
#include "blackwing_lair.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
#include "Player.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
+#include "TemporarySummon.h"
enum Events
{
@@ -386,7 +389,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_victor_nefariusAI>(creature);
+ return GetBlackwingLairAI<boss_victor_nefariusAI>(creature);
}
};
@@ -592,7 +595,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_nefarianAI>(creature);
+ return GetBlackwingLairAI<boss_nefarianAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_razorgore.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_razorgore.cpp
index 56b6731da84..e58ef6402a2 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_razorgore.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_razorgore.cpp
@@ -17,10 +17,12 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "SpellScript.h"
#include "blackwing_lair.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
#include "Player.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
enum Say
{
@@ -168,7 +170,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_razorgoreAI>(creature);
+ return GetBlackwingLairAI<boss_razorgoreAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp
index 52ea86882d8..64940bddaac 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp
@@ -17,10 +17,11 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "blackwing_lair.h"
-#include "ScriptedGossip.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
enum Says
{
@@ -240,7 +241,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_vaelAI(creature);
+ return GetBlackwingLairAI<boss_vaelAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/instance_blackwing_lair.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/instance_blackwing_lair.cpp
index 05054bcacb7..c0ef0dd23e4 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/instance_blackwing_lair.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/instance_blackwing_lair.cpp
@@ -15,10 +15,13 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "Player.h"
-#include "ScriptedCreature.h"
#include "ScriptMgr.h"
#include "blackwing_lair.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "Player.h"
+#include "ScriptedCreature.h"
+#include "TemporarySummon.h"
DoorData const doorData[] =
{
@@ -63,7 +66,7 @@ uint32 const Entry[5] = {12422, 12458, 12416, 12420, 12459};
class instance_blackwing_lair : public InstanceMapScript
{
public:
- instance_blackwing_lair() : InstanceMapScript(BRLScriptName, 469) { }
+ instance_blackwing_lair() : InstanceMapScript(BWLScriptName, 469) { }
struct instance_blackwing_lair_InstanceMapScript : public InstanceScript
{
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_baron_geddon.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_baron_geddon.cpp
index 7f473c00f53..5f58cdd8c7a 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_baron_geddon.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_baron_geddon.cpp
@@ -121,7 +121,7 @@ class boss_baron_geddon : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_baron_geddonAI(creature);
+ return GetMoltenCoreAI<boss_baron_geddonAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_garr.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_garr.cpp
index 64e59f480bf..13493ca5298 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_garr.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_garr.cpp
@@ -100,7 +100,7 @@ class boss_garr : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_garrAI(creature);
+ return GetMoltenCoreAI<boss_garrAI>(creature);
}
};
@@ -160,7 +160,7 @@ class npc_firesworn : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_fireswornAI(creature);
+ return GetMoltenCoreAI<npc_fireswornAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_gehennas.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_gehennas.cpp
index b55c939bfec..7fbe39ef8be 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_gehennas.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_gehennas.cpp
@@ -103,7 +103,7 @@ class boss_gehennas : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_gehennasAI(creature);
+ return GetMoltenCoreAI<boss_gehennasAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_golemagg.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_golemagg.cpp
index 1fa97bdecdb..0a17cb1b9e5 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_golemagg.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_golemagg.cpp
@@ -23,10 +23,12 @@ SDComment: Timers need to be confirmed, Golemagg's Trust need to be checked
SDCategory: Molten Core
EndScriptData */
-#include "ObjectMgr.h"
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "InstanceScript.h"
#include "molten_core.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
+#include "TemporarySummon.h"
enum Texts
{
@@ -121,7 +123,7 @@ class boss_golemagg : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_golemaggAI(creature);
+ return GetMoltenCoreAI<boss_golemaggAI>(creature);
}
};
@@ -188,7 +190,7 @@ class npc_core_rager : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_core_ragerAI>(creature);
+ return GetMoltenCoreAI<npc_core_ragerAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_lucifron.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_lucifron.cpp
index 190aa91aa6d..88773afa597 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_lucifron.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_lucifron.cpp
@@ -101,7 +101,7 @@ class boss_lucifron : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_lucifronAI(creature);
+ return GetMoltenCoreAI<boss_lucifronAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_magmadar.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_magmadar.cpp
index 6ed123d465b..f09daf46f4b 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_magmadar.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_magmadar.cpp
@@ -23,10 +23,9 @@ SDComment: Conflag on ground nyi
SDCategory: Molten Core
EndScriptData */
-#include "ObjectMgr.h"
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "molten_core.h"
+#include "ScriptedCreature.h"
enum Texts
{
@@ -115,7 +114,7 @@ class boss_magmadar : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_magmadarAI(creature);
+ return GetMoltenCoreAI<boss_magmadarAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_majordomo_executus.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_majordomo_executus.cpp
index a1ea9f7012a..c6db56b07b0 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_majordomo_executus.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_majordomo_executus.cpp
@@ -23,12 +23,12 @@ SDComment: Correct spawning and Event NYI
SDCategory: Molten Core
EndScriptData */
-#include "ObjectMgr.h"
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
+#include "InstanceScript.h"
#include "molten_core.h"
#include "Player.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
enum Texts
{
@@ -109,7 +109,7 @@ class boss_majordomo : public CreatureScript
if (!me->FindNearestCreature(NPC_FLAMEWAKER_HEALER, 100.0f) && !me->FindNearestCreature(NPC_FLAMEWAKER_ELITE, 100.0f))
{
- instance->UpdateEncounterState(ENCOUNTER_CREDIT_KILL_CREATURE, me->GetEntry(), me);
+ instance->UpdateEncounterStateForKilledCreature(me->GetEntry(), me);
me->setFaction(FACTION_FRIENDLY);
EnterEvadeMode();
Talk(SAY_DEFEAT);
@@ -208,7 +208,7 @@ class boss_majordomo : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_majordomoAI>(creature);
+ return GetMoltenCoreAI<boss_majordomoAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp
index c06a00907eb..75e22e781dc 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp
@@ -24,8 +24,11 @@ SDCategory: Molten Core
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "InstanceScript.h"
#include "molten_core.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
+#include "TemporarySummon.h"
enum Texts
{
@@ -309,7 +312,7 @@ class boss_ragnaros : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_ragnarosAI>(creature);
+ return GetMoltenCoreAI<boss_ragnarosAI>(creature);
}
};
@@ -344,7 +347,7 @@ class npc_son_of_flame : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_son_of_flameAI>(creature);
+ return GetMoltenCoreAI<npc_son_of_flameAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_shazzrah.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_shazzrah.cpp
index 1ea9a069588..bf7e1d8a213 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_shazzrah.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_shazzrah.cpp
@@ -16,9 +16,9 @@
*/
#include "ScriptMgr.h"
+#include "molten_core.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
-#include "molten_core.h"
enum Spells
{
@@ -115,7 +115,7 @@ class boss_shazzrah : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_shazzrahAI(creature);
+ return GetMoltenCoreAI<boss_shazzrahAI>(creature);
}
};
@@ -131,9 +131,7 @@ class spell_shazzrah_gate_dummy : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SHAZZRAH_GATE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SHAZZRAH_GATE });
}
void FilterTargets(std::list<WorldObject*>& targets)
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_sulfuron_harbinger.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_sulfuron_harbinger.cpp
index 6f1cfa94114..7bfa5341414 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_sulfuron_harbinger.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_sulfuron_harbinger.cpp
@@ -132,7 +132,7 @@ class boss_sulfuron : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_sulfuronAI(creature);
+ return GetMoltenCoreAI<boss_sulfuronAI>(creature);
}
};
@@ -211,7 +211,7 @@ class npc_flamewaker_priest : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_flamewaker_priestAI(creature);
+ return GetMoltenCoreAI<npc_flamewaker_priestAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/instance_molten_core.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/instance_molten_core.cpp
index 8ed15629ccd..c1c80b7a7aa 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/instance_molten_core.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/instance_molten_core.cpp
@@ -15,10 +15,13 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "InstanceScript.h"
-#include "ScriptedCreature.h"
#include "ScriptMgr.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "Map.h"
#include "molten_core.h"
+#include "ScriptedCreature.h"
+#include "TemporarySummon.h"
Position const SummonPositions[10] =
{
@@ -34,10 +37,13 @@ Position const SummonPositions[10] =
{838.510f, -829.840f, -232.000f, 2.00000f},
};
+Position const RagnarosTelePos = {829.159f, -815.773f, -228.972f, 5.30500f};
+Position const RagnarosSummonPos = {838.510f, -829.840f, -232.000f, 2.00000f};
+
class instance_molten_core : public InstanceMapScript
{
public:
- instance_molten_core() : InstanceMapScript("instance_molten_core", 409) { }
+ instance_molten_core() : InstanceMapScript(MCScriptName, 409) { }
struct instance_molten_core_InstanceMapScript : public InstanceScript
{
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/molten_core.h b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/molten_core.h
index 45037170b7e..85ac5028d53 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/molten_core.h
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/molten_core.h
@@ -19,6 +19,11 @@
#ifndef DEF_MOLTEN_CORE_H
#define DEF_MOLTEN_CORE_H
+#include "CreatureAIImpl.h"
+
+struct Position;
+
+#define MCScriptName "instance_molten_core"
#define DataHeader "MC"
enum MCEncounters
@@ -42,8 +47,8 @@ enum MCActions
ACTION_START_RAGNAROS_ALT = 1,
};
-Position const RagnarosTelePos = {829.159f, -815.773f, -228.972f, 5.30500f};
-Position const RagnarosSummonPos = {838.510f, -829.840f, -232.000f, 2.00000f};
+extern Position const RagnarosTelePos;
+extern Position const RagnarosSummonPos;
enum MCCreatures
{
@@ -71,4 +76,10 @@ enum MCData
DATA_RAGNAROS_ADDS = 0,
};
+template<typename AI>
+inline AI* GetMoltenCoreAI(Creature* creature)
+{
+ return GetInstanceAI<AI>(creature, MCScriptName);
+}
+
#endif
diff --git a/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp b/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp
index 63b635892fa..1dd2ca3e1d9 100644
--- a/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp
+++ b/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp
@@ -22,8 +22,11 @@ SDComment: Timers and say taken from acid script
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "deadmines.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
enum Spels
{
@@ -45,7 +48,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_mr_smiteAI>(creature);
+ return GetDeadminesAI<boss_mr_smiteAI>(creature);
}
struct boss_mr_smiteAI : public ScriptedAI
diff --git a/src/server/scripts/EasternKingdoms/Deadmines/deadmines.h b/src/server/scripts/EasternKingdoms/Deadmines/deadmines.h
index e4e3e5b036b..1738f9cbe6c 100644
--- a/src/server/scripts/EasternKingdoms/Deadmines/deadmines.h
+++ b/src/server/scripts/EasternKingdoms/Deadmines/deadmines.h
@@ -18,6 +18,9 @@
#ifndef DEF_DEADMINES_H
#define DEF_DEADMINES_H
+#include "CreatureAIImpl.h"
+
+#define DMScriptName "instance_deadmines"
#define DataHeader "DM"
enum DMCannonState
@@ -49,4 +52,10 @@ enum DMGameObjects
GO_MR_SMITE_CHEST = 144111
};
+template<typename AI>
+inline AI* GetDeadminesAI(Creature* creature)
+{
+ return GetInstanceAI<AI>(creature, DMScriptName);
+}
+
#endif
diff --git a/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp b/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp
index 45b99c3c563..be1aee0a75c 100644
--- a/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp
+++ b/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp
@@ -24,10 +24,11 @@ SDCategory: Deadmines
EndScriptData */
#include "ScriptMgr.h"
-#include "InstanceScript.h"
#include "deadmines.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "Map.h"
#include "TemporarySummon.h"
-#include "WorldPacket.h"
enum Sounds
{
@@ -49,8 +50,7 @@ enum Misc
class instance_deadmines : public InstanceMapScript
{
public:
- instance_deadmines()
- : InstanceMapScript("instance_deadmines", 36)
+ instance_deadmines() : InstanceMapScript(DMScriptName, 36)
{
}
diff --git a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp
index bf1fa7b3dde..24fba345b11 100644
--- a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp
+++ b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp
@@ -23,11 +23,14 @@ SDComment: Some visual effects are not implemented.
Script Data End */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "GameObject.h"
+#include "gnomeregan.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptedEscortAI.h"
#include "ScriptedGossip.h"
-#include "Player.h"
-#include "gnomeregan.h"
+#include "TemporarySummon.h"
enum BlastmasterEmi
{
@@ -86,7 +89,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_blastmaster_emi_shortfuseAI>(creature);
+ return GetGnomereganAI<npc_blastmaster_emi_shortfuseAI>(creature);
}
struct npc_blastmaster_emi_shortfuseAI : public npc_escortAI
@@ -305,7 +308,7 @@ public:
me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[9], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
break;
case 2:
- if (GameObject* go = me->SummonGameObject(183410, -533.140f, -105.322f, -156.016f, 0.f, G3D::Quat(), 1))
+ if (GameObject* go = me->SummonGameObject(183410, -533.140f, -105.322f, -156.016f, 0.f, QuaternionData(), 1))
{
GoSummonList.push_back(go->GetGUID());
go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); //We can't use it!
@@ -320,7 +323,7 @@ public:
Talk(SAY_BLASTMASTER_7);
break;
case 4:
- if (GameObject* go = me->SummonGameObject(183410, -542.199f, -96.854f, -155.790f, 0.f, G3D::Quat(), 1))
+ if (GameObject* go = me->SummonGameObject(183410, -542.199f, -96.854f, -155.790f, 0.f, QuaternionData(), 1))
{
GoSummonList.push_back(go->GetGUID());
go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
@@ -334,7 +337,7 @@ public:
me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[14], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
break;
case 6:
- if (GameObject* go = me->SummonGameObject(183410, -507.820f, -103.333f, -151.353f, 0.f, G3D::Quat(), 1))
+ if (GameObject* go = me->SummonGameObject(183410, -507.820f, -103.333f, -151.353f, 0.f, QuaternionData(), 1))
{
GoSummonList.push_back(go->GetGUID());
go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); //We can't use it!
@@ -342,7 +345,7 @@ public:
}
break;
case 7:
- if (GameObject* go = me->SummonGameObject(183410, -511.829f, -86.249f, -151.431f, 0.f, G3D::Quat(), 1))
+ if (GameObject* go = me->SummonGameObject(183410, -511.829f, -86.249f, -151.431f, 0.f, QuaternionData(), 1))
{
GoSummonList.push_back(go->GetGUID());
go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); //We can't use it!
@@ -354,9 +357,9 @@ public:
me->SummonCreature(NPC_CHOMPER, SpawnPosition[16], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
break;
case 9:
- me->SummonGameObject(GO_RED_ROCKET, SpawnPosition[17], G3D::Quat(), 7200);
- me->SummonGameObject(GO_RED_ROCKET, SpawnPosition[18], G3D::Quat(), 7200);
- me->SummonGameObject(GO_RED_ROCKET, SpawnPosition[19], G3D::Quat(), 7200);
+ me->SummonGameObject(GO_RED_ROCKET, SpawnPosition[17], QuaternionData(), 7200);
+ me->SummonGameObject(GO_RED_ROCKET, SpawnPosition[18], QuaternionData(), 7200);
+ me->SummonGameObject(GO_RED_ROCKET, SpawnPosition[19], QuaternionData(), 7200);
break;
}
}
@@ -504,7 +507,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_grubbisAI(creature);
+ return GetGnomereganAI<boss_grubbisAI>(creature);
}
struct boss_grubbisAI : public ScriptedAI
diff --git a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.h b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.h
index 4cf4fcd0a1d..2ba1b334f41 100644
--- a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.h
+++ b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.h
@@ -18,6 +18,9 @@
#ifndef DEF_GNOMEREGAN_H
#define DEF_GNOMEREGAN_H
+#include "CreatureAIImpl.h"
+
+#define GNOScriptName "instance_gnomeregan"
#define DataHeader "GNO"
enum GNOGameObjectIds
@@ -47,4 +50,10 @@ enum GNOData64
DATA_NPC_BASTMASTER_EMI_SHORTFUSE
};
+template<typename AI>
+inline AI* GetGnomereganAI(Creature* creature)
+{
+ return GetInstanceAI<AI>(creature, GNOScriptName);
+}
+
#endif
diff --git a/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp b/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp
index 5e88f66e1d0..c5d98e6da18 100644
--- a/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp
+++ b/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp
@@ -16,8 +16,10 @@
*/
#include "ScriptMgr.h"
-#include "InstanceScript.h"
+#include "Creature.h"
+#include "GameObject.h"
#include "gnomeregan.h"
+#include "InstanceScript.h"
#include "Log.h"
#include "Player.h"
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp
index 83063732518..c8ea2c7966f 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp
@@ -24,6 +24,7 @@ SDCategory: Karazhan
EndScriptData */
#include "ScriptMgr.h"
+#include "karazhan.h"
#include "ScriptedCreature.h"
enum Curator
@@ -45,9 +46,6 @@ enum Curator
SPELL_BERSERK = 26662,
};
-
-
-
class boss_curator : public CreatureScript
{
public:
@@ -55,7 +53,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_curatorAI(creature);
+ return GetKarazhanAI<boss_curatorAI>(creature);
}
struct boss_curatorAI : public ScriptedAI
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp
index af1a00a6181..595933f099c 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp
@@ -16,8 +16,8 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "karazhan.h"
+#include "ScriptedCreature.h"
enum Spells
{
@@ -128,7 +128,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_maiden_of_virtueAI(creature);
+ return GetKarazhanAI<boss_maiden_of_virtueAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp
index 55b089842e0..02ace4c82ec 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp
@@ -24,9 +24,10 @@ SDCategory: Karazhan
EndScriptData */
#include "ScriptMgr.h"
+#include "karazhan.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
#include "SpellInfo.h"
-#include "karazhan.h"
enum Texts
{
@@ -275,7 +276,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_attumenAI(creature);
+ return GetKarazhanAI<boss_attumenAI>(creature);
}
};
@@ -377,7 +378,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_midnightAI(creature);
+ return GetKarazhanAI<boss_midnightAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp
index dd64f3dcf9e..858ab9fde54 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp
@@ -24,8 +24,11 @@ SDCategory: Karazhan
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "InstanceScript.h"
#include "karazhan.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
+#include "TemporarySummon.h"
enum Yells
{
@@ -98,7 +101,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_moroesAI>(creature);
+ return GetKarazhanAI<boss_moroesAI>(creature);
}
struct boss_moroesAI : public ScriptedAI
@@ -386,7 +389,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_baroness_dorothea_millstipeAI>(creature);
+ return GetKarazhanAI<boss_baroness_dorothea_millstipeAI>(creature);
}
struct boss_baroness_dorothea_millstipeAI : public boss_moroes_guestAI
@@ -457,7 +460,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_baron_rafe_dreugerAI>(creature);
+ return GetKarazhanAI<boss_baron_rafe_dreugerAI>(creature);
}
struct boss_baron_rafe_dreugerAI : public boss_moroes_guestAI
@@ -522,7 +525,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_lady_catriona_von_indiAI>(creature);
+ return GetKarazhanAI<boss_lady_catriona_von_indiAI>(creature);
}
struct boss_lady_catriona_von_indiAI : public boss_moroes_guestAI
@@ -600,7 +603,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_lady_keira_berrybuckAI>(creature);
+ return GetKarazhanAI<boss_lady_keira_berrybuckAI>(creature);
}
struct boss_lady_keira_berrybuckAI : public boss_moroes_guestAI
@@ -682,7 +685,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_lord_robin_darisAI>(creature);
+ return GetKarazhanAI<boss_lord_robin_darisAI>(creature);
}
struct boss_lord_robin_darisAI : public boss_moroes_guestAI
@@ -746,7 +749,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_lord_crispin_ferenceAI>(creature);
+ return GetKarazhanAI<boss_lord_crispin_ferenceAI>(creature);
}
struct boss_lord_crispin_ferenceAI : public boss_moroes_guestAI
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp
index d026182fcb5..6f246bc071a 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp
@@ -24,9 +24,13 @@ SDCategory: Karazhan
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
#include "karazhan.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "ScriptedCreature.h"
+#include "TemporarySummon.h"
enum Netherspite
{
@@ -71,7 +75,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_netherspiteAI>(creature);
+ return GetKarazhanAI<boss_netherspiteAI>(creature);
}
struct boss_netherspiteAI : public ScriptedAI
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp
index 12813e110a1..78b2949d390 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp
@@ -24,8 +24,9 @@ SDCategory: Karazhan
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "InstanceScript.h"
#include "karazhan.h"
+#include "ScriptedCreature.h"
enum Spells
{
@@ -71,7 +72,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_nightbaneAI>(creature);
+ return GetKarazhanAI<boss_nightbaneAI>(creature);
}
struct boss_nightbaneAI : public ScriptedAI
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp
index 9f5c929539e..8d09374c148 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp
@@ -24,9 +24,13 @@ SDCategory: Karazhan
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "InstanceScript.h"
#include "karazhan.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
#include "SpellInfo.h"
+#include "SpellMgr.h"
+#include "TemporarySummon.h"
// 18 Coordinates for Infernal spawns
struct InfernalPoint
@@ -104,7 +108,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new netherspite_infernalAI(creature);
+ return GetKarazhanAI<netherspite_infernalAI>(creature);
}
struct netherspite_infernalAI : public ScriptedAI
@@ -179,7 +183,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_malchezaarAI>(creature);
+ return GetKarazhanAI<boss_malchezaarAI>(creature);
}
struct boss_malchezaarAI : public ScriptedAI
@@ -308,11 +312,11 @@ public:
void EnfeebleHealthEffect()
{
- const SpellInfo* info = sSpellMgr->GetSpellInfo(SPELL_ENFEEBLE_EFFECT);
+ SpellInfo const* info = sSpellMgr->GetSpellInfo(SPELL_ENFEEBLE_EFFECT);
if (!info)
return;
- ThreatContainer::StorageType const &t_list = me->getThreatManager().getThreatList();
+ ThreatContainer::StorageType const& t_list = me->getThreatManager().getThreatList();
std::vector<Unit*> targets;
if (t_list.empty())
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp
index d57484fe518..8daedae224d 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp
@@ -24,11 +24,14 @@ SDCategory: Karazhan
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "karazhan.h"
#include "GameObject.h"
-#include "SpellInfo.h"
+#include "InstanceScript.h"
+#include "karazhan.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "ScriptedCreature.h"
+#include "SpellInfo.h"
+#include "TemporarySummon.h"
enum ShadeOfAran
{
@@ -103,7 +106,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_aranAI>(creature);
+ return GetKarazhanAI<boss_aranAI>(creature);
}
struct boss_aranAI : public ScriptedAI
@@ -566,7 +569,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new water_elementalAI(creature);
+ return GetKarazhanAI<water_elementalAI>(creature);
}
struct water_elementalAI : public ScriptedAI
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp
index 05e0fc7ba20..5053617a6fa 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp
@@ -24,9 +24,12 @@ SDCategory: Karazhan
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "InstanceScript.h"
#include "karazhan.h"
+#include "ObjectAccessor.h"
#include "PassiveAI.h"
+#include "ScriptedCreature.h"
+#include "TemporarySummon.h"
enum TerestianIllhoof
{
@@ -70,7 +73,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_kilrekAI>(creature);
+ return GetKarazhanAI<npc_kilrekAI>(creature);
}
struct npc_kilrekAI : public ScriptedAI
@@ -130,7 +133,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_demon_chainAI(creature);
+ return GetKarazhanAI<npc_demon_chainAI>(creature);
}
struct npc_demon_chainAI : public ScriptedAI
@@ -176,7 +179,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_fiendish_portalAI(creature);
+ return GetKarazhanAI<npc_fiendish_portalAI>(creature);
}
struct npc_fiendish_portalAI : public PassiveAI
@@ -210,7 +213,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_fiendish_impAI(creature);
+ return GetKarazhanAI<npc_fiendish_impAI>(creature);
}
struct npc_fiendish_impAI : public ScriptedAI
@@ -260,7 +263,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_terestianAI>(creature);
+ return GetKarazhanAI<boss_terestianAI>(creature);
}
struct boss_terestianAI : public ScriptedAI
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp
index bf231e8cae5..43d60feeff8 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp
@@ -24,12 +24,15 @@ SDCategory: Karazhan
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
+#include "InstanceScript.h"
#include "karazhan.h"
+#include "Log.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "SpellInfo.h"
-#include "Log.h"
+#include "TemporarySummon.h"
/***********************************/
/*** OPERA WIZARD OF OZ EVENT *****/
@@ -119,7 +122,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_dorotheeAI>(creature);
+ return GetKarazhanAI<boss_dorotheeAI>(creature);
}
struct boss_dorotheeAI : public ScriptedAI
@@ -239,7 +242,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_titoAI(creature);
+ return GetKarazhanAI<npc_titoAI>(creature);
}
struct npc_titoAI : public ScriptedAI
@@ -313,7 +316,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_strawmanAI>(creature);
+ return GetKarazhanAI<boss_strawmanAI>(creature);
}
struct boss_strawmanAI : public ScriptedAI
@@ -433,7 +436,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_tinheadAI>(creature);
+ return GetKarazhanAI<boss_tinheadAI>(creature);
}
struct boss_tinheadAI : public ScriptedAI
@@ -548,7 +551,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_roarAI>(creature);
+ return GetKarazhanAI<boss_roarAI>(creature);
}
struct boss_roarAI : public ScriptedAI
@@ -662,7 +665,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_croneAI>(creature);
+ return GetKarazhanAI<boss_croneAI>(creature);
}
struct boss_croneAI : public ScriptedAI
@@ -746,7 +749,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_cycloneAI(creature);
+ return GetKarazhanAI<npc_cycloneAI>(creature);
}
struct npc_cycloneAI : public ScriptedAI
@@ -834,7 +837,7 @@ class npc_grandmother : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_grandmotherAI(creature);
+ return GetKarazhanAI<npc_grandmotherAI>(creature);
}
};
@@ -845,7 +848,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_bigbadwolfAI>(creature);
+ return GetKarazhanAI<boss_bigbadwolfAI>(creature);
}
struct boss_bigbadwolfAI : public ScriptedAI
@@ -1044,7 +1047,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_julianneAI>(creature);
+ return GetKarazhanAI<boss_julianneAI>(creature);
}
struct boss_julianneAI : public ScriptedAI
@@ -1165,7 +1168,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_romuloAI>(creature);
+ return GetKarazhanAI<boss_romuloAI>(creature);
}
struct boss_romuloAI : public ScriptedAI
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp b/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp
index eaf6c7043af..d6e78788e80 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp
@@ -24,8 +24,11 @@ SDCategory: Karazhan
EndScriptData */
#include "ScriptMgr.h"
+#include "Creature.h"
+#include "GameObject.h"
#include "InstanceScript.h"
#include "karazhan.h"
+#include "Map.h"
/*
0 - Attumen + Midnight (optional)
@@ -52,7 +55,7 @@ const Position OptionalSpawn[] =
class instance_karazhan : public InstanceMapScript
{
public:
- instance_karazhan() : InstanceMapScript("instance_karazhan", 532) { }
+ instance_karazhan() : InstanceMapScript(KZScriptName, 532) { }
InstanceScript* GetInstanceScript(InstanceMap* map) const override
{
@@ -156,7 +159,7 @@ public:
HandleGameObject(StageDoorRightGUID, true);
if (GameObject* sideEntrance = instance->GetGameObject(SideEntranceDoor))
sideEntrance->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED);
- UpdateEncounterState(ENCOUNTER_CREDIT_KILL_CREATURE, 16812, NULL);
+ UpdateEncounterStateForKilledCreature(16812, NULL);
}
break;
case DATA_CHESS:
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp
index 5b5001c5c8b..12e20b93e44 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp
@@ -29,12 +29,14 @@ npc_image_of_medivh
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
+#include "InstanceScript.h"
#include "karazhan.h"
-#include "ScriptedEscortAI.h"
-#include "Player.h"
#include "Log.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
+#include "ScriptedEscortAI.h"
+#include "ScriptedGossip.h"
+#include "TemporarySummon.h"
enum Spells
{
@@ -407,7 +409,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_barnesAI>(creature);
+ return GetKarazhanAI<npc_barnesAI>(creature);
}
};
@@ -436,7 +438,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_image_of_medivhAI>(creature);
+ return GetKarazhanAI<npc_image_of_medivhAI>(creature);
}
struct npc_image_of_medivhAI : public ScriptedAI
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.h b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.h
index 57eed289de5..2543349cc1c 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.h
+++ b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.h
@@ -19,6 +19,9 @@
#ifndef DEF_KARAZHAN_H
#define DEF_KARAZHAN_H
+#include "CreatureAIImpl.h"
+
+#define KZScriptName "instance_karazhan"
#define DataHeader "KZ"
uint32 const EncounterCount = 12;
@@ -107,4 +110,10 @@ enum KZMisc
OPTIONAL_BOSS_REQUIRED_DEATH_COUNT = 50
};
+template<typename AI>
+inline AI* GetKarazhanAI(Creature* creature)
+{
+ return GetInstanceAI<AI>(creature, KZScriptName);
+}
+
#endif
diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp
index d552d455cf8..10e2a6f6b29 100644
--- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp
+++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp
@@ -24,10 +24,12 @@ SDCategory: Magisters' Terrace
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
#include "magisters_terrace.h"
-#include "WorldPacket.h"
-#include "Opcodes.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
+#include "TemporarySummon.h"
enum Says
{
@@ -96,7 +98,7 @@ public:
CreatureAI* GetAI(Creature* c) const override
{
- return GetInstanceAI<boss_felblood_kaelthasAI>(c);
+ return GetMagistersTerraceAI<boss_felblood_kaelthasAI>(c);
}
struct boss_felblood_kaelthasAI : public ScriptedAI
@@ -251,11 +253,7 @@ public:
{
// Also needs an exception in spell system.
unit->CastSpell(unit, SPELL_GRAVITY_LAPSE_FLY, true, 0, 0, me->GetGUID());
- // Use packet hack
- WorldPacket data(SMSG_MOVE_SET_CAN_FLY, 12);
- data << unit->GetGUID();
- data << uint32(0);
- unit->SendMessageToSet(&data, true);
+ unit->SetCanFly(true);
}
}
}
@@ -271,11 +269,7 @@ public:
{
unit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_FLY);
unit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_DOT);
-
- WorldPacket data(SMSG_MOVE_UNSET_CAN_FLY, 12);
- data << unit->GetGUID();
- data << uint32(0);
- unit->SendMessageToSet(&data, true);
+ unit->SetCanFly(false);
}
}
}
@@ -438,7 +432,7 @@ public:
CreatureAI* GetAI(Creature* c) const override
{
- return new npc_felkael_flamestrikeAI(c);
+ return GetMagistersTerraceAI<npc_felkael_flamestrikeAI>(c);
}
struct npc_felkael_flamestrikeAI : public ScriptedAI
@@ -486,7 +480,7 @@ public:
CreatureAI* GetAI(Creature* c) const override
{
- return GetInstanceAI<npc_felkael_phoenixAI>(c);
+ return GetMagistersTerraceAI<npc_felkael_phoenixAI>(c);
}
struct npc_felkael_phoenixAI : public ScriptedAI
@@ -604,7 +598,7 @@ public:
CreatureAI* GetAI(Creature* c) const override
{
- return new npc_felkael_phoenix_eggAI(c);
+ return GetMagistersTerraceAI<npc_felkael_phoenix_eggAI>(c);
}
struct npc_felkael_phoenix_eggAI : public ScriptedAI
@@ -648,7 +642,7 @@ public:
CreatureAI* GetAI(Creature* c) const override
{
- return new npc_arcane_sphereAI(c);
+ return GetMagistersTerraceAI<npc_arcane_sphereAI>(c);
}
struct npc_arcane_sphereAI : public ScriptedAI
diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp
index 20793316a86..e0afe313965 100644
--- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp
+++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp
@@ -24,8 +24,11 @@ SDCategory: Magister's Terrace
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "InstanceScript.h"
#include "magisters_terrace.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
+#include "TemporarySummon.h"
struct Speech
{
@@ -110,7 +113,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_priestess_delrissaAI>(creature);
+ return GetMagistersTerraceAI<boss_priestess_delrissaAI>(creature);
}
struct boss_priestess_delrissaAI : public ScriptedAI
@@ -497,7 +500,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_kagani_nightstrikeAI>(creature);
+ return GetMagistersTerraceAI<boss_kagani_nightstrikeAI>(creature);
}
struct boss_kagani_nightstrikeAI : public boss_priestess_lackey_commonAI
@@ -609,7 +612,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_ellris_duskhallowAI>(creature);
+ return GetMagistersTerraceAI<boss_ellris_duskhallowAI>(creature);
}
struct boss_ellris_duskhallowAI : public boss_priestess_lackey_commonAI
@@ -708,7 +711,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_eramas_brightblazeAI>(creature);
+ return GetMagistersTerraceAI<boss_eramas_brightblazeAI>(creature);
}
struct boss_eramas_brightblazeAI : public boss_priestess_lackey_commonAI
@@ -777,7 +780,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_yazzaiAI>(creature);
+ return GetMagistersTerraceAI<boss_yazzaiAI>(creature);
}
struct boss_yazzaiAI : public boss_priestess_lackey_commonAI
@@ -915,7 +918,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_warlord_salarisAI>(creature);
+ return GetMagistersTerraceAI<boss_warlord_salarisAI>(creature);
}
struct boss_warlord_salarisAI : public boss_priestess_lackey_commonAI
@@ -1043,7 +1046,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_garaxxasAI>(creature);
+ return GetMagistersTerraceAI<boss_garaxxasAI>(creature);
}
struct boss_garaxxasAI : public boss_priestess_lackey_commonAI
@@ -1159,7 +1162,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_apokoAI>(creature);
+ return GetMagistersTerraceAI<boss_apokoAI>(creature);
}
struct boss_apokoAI : public boss_priestess_lackey_commonAI
@@ -1256,7 +1259,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_zelfanAI>(creature);
+ return GetMagistersTerraceAI<boss_zelfanAI>(creature);
}
struct boss_zelfanAI : public boss_priestess_lackey_commonAI
diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp
index 76f60754c67..b6f94c74c73 100644
--- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp
+++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp
@@ -16,8 +16,10 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "InstanceScript.h"
#include "magisters_terrace.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
enum Says
{
@@ -263,7 +265,7 @@ class boss_selin_fireheart : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_selin_fireheartAI>(creature);
+ return GetMagistersTerraceAI<boss_selin_fireheartAI>(creature);
};
};
@@ -289,7 +291,7 @@ class npc_fel_crystal : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_fel_crystalAI>(creature);
+ return GetMagistersTerraceAI<npc_fel_crystalAI>(creature);
};
};
diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp
index 421c5ac45af..02f57cd2622 100644
--- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp
+++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp
@@ -182,7 +182,7 @@ class boss_vexallus : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_vexallusAI>(creature);
+ return GetMagistersTerraceAI<boss_vexallusAI>(creature);
};
};
@@ -214,7 +214,7 @@ class npc_pure_energy : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_pure_energyAI(creature);
+ return GetMagistersTerraceAI<npc_pure_energyAI>(creature);
};
};
diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp
index d145944bf35..7ff8b3a5d98 100644
--- a/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp
+++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp
@@ -16,10 +16,13 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "EventMap.h"
+#include "GameObject.h"
#include "InstanceScript.h"
#include "magisters_terrace.h"
-#include "EventMap.h"
+#include "Map.h"
+#include "ScriptedCreature.h"
+#include "TemporarySummon.h"
/*
0 - Selin Fireheart
@@ -43,7 +46,7 @@ Position const KalecgosSpawnPos = { 164.3747f, -397.1197f, 2.151798f, 1.66219f }
class instance_magisters_terrace : public InstanceMapScript
{
public:
- instance_magisters_terrace() : InstanceMapScript("instance_magisters_terrace", 585) { }
+ instance_magisters_terrace() : InstanceMapScript(MGTScriptName, 585) { }
struct instance_magisters_terrace_InstanceMapScript : public InstanceScript
{
@@ -150,7 +153,7 @@ class instance_magisters_terrace : public InstanceMapScript
void ProcessEvent(WorldObject* obj, uint32 eventId) override
{
if (eventId == EVENT_SPAWN_KALECGOS)
- if (!ObjectAccessor::GetCreature(*obj, KalecgosGUID) && Events.Empty())
+ if (!instance->GetCreature(KalecgosGUID) && Events.Empty())
Events.ScheduleEvent(EVENT_SPAWN_KALECGOS, Minutes(1));
}
diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.h b/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.h
index cfdee423ef1..ff393c32ec5 100644
--- a/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.h
+++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.h
@@ -19,6 +19,9 @@
#ifndef DEF_MAGISTERS_TERRACE_H
#define DEF_MAGISTERS_TERRACE_H
+#include "CreatureAIImpl.h"
+
+#define MGTScriptName "instance_magisters_terrace"
#define DataHeader "MT"
uint32 const EncounterCount = 4;
@@ -74,4 +77,10 @@ enum MTMovementData
PATH_KALECGOS_FLIGHT = 248440
};
+template<typename AI>
+inline AI* GetMagistersTerraceAI(Creature* creature)
+{
+ return GetInstanceAI<AI>(creature, MGTScriptName);
+}
+
#endif
diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp
index 577d58d2ca8..94c8622ebee 100644
--- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp
@@ -16,10 +16,12 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
-#include "ScriptedEscortAI.h"
+#include "GameObject.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "ScriptedEscortAI.h"
+#include "ScriptedGossip.h"
+#include "TemporarySummon.h"
#define LESS_MOB // if you do not have a good server and do not want it to be laggy as hell
//Light of Dawn
@@ -1116,7 +1118,7 @@ public:
case 48: // Show the cleansing effect (dawn of light)
//if (GameObject* go = me->GetMap()->GetGameObject(uiDawnofLightGUID))
// go->SetPhaseMask(128, true);
- me->SummonGameObject(GO_LIGHT_OF_DAWN, 2283.896f, -5287.914f, 83.066f, 0.f, G3D::Quat(), 30);
+ me->SummonGameObject(GO_LIGHT_OF_DAWN, 2283.896f, -5287.914f, 83.066f, 0.f, QuaternionData(), 30);
if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID))
{
if (temp->HasAura(SPELL_REBIRTH_OF_THE_ASHBRINGER))
diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp
index f1904a50e04..1ff7823aa28 100644
--- a/src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp
@@ -16,9 +16,10 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "PassiveAI.h"
#include "Player.h"
+#include "ScriptedCreature.h"
+#include "TemporarySummon.h"
/*####
## npc_valkyr_battle_maiden
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp
index 08b2255ee8c..cf9ee7c8fae 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp
@@ -24,13 +24,17 @@ SDCategory: Scarlet Monastery
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "SpellMgr.h"
-#include "scarlet_monastery.h"
+#include "GameObject.h"
+#include "Group.h"
+#include "InstanceScript.h"
#include "LFGMgr.h"
+#include "Map.h"
+#include "ObjectAccessor.h"
#include "Player.h"
-#include "Group.h"
+#include "scarlet_monastery.h"
+#include "ScriptedCreature.h"
#include "SpellInfo.h"
+#include "TemporarySummon.h"
//this texts are already used by 3975 and 3976
enum Says
@@ -141,7 +145,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_wisp_invisAI(creature);
+ return GetScarletMonasteryAI<npc_wisp_invisAI>(creature);
}
struct npc_wisp_invisAI : public ScriptedAI
@@ -220,7 +224,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_headAI(creature);
+ return GetScarletMonasteryAI<npc_headAI>(creature);
}
struct npc_headAI : public ScriptedAI
@@ -373,7 +377,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_headless_horsemanAI>(creature);
+ return GetScarletMonasteryAI<boss_headless_horsemanAI>(creature);
}
struct boss_headless_horsemanAI : public ScriptedAI
@@ -783,7 +787,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_pulsing_pumpkinAI(creature);
+ return GetScarletMonasteryAI<npc_pulsing_pumpkinAI>(creature);
}
struct npc_pulsing_pumpkinAI : public ScriptedAI
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp
index 7d3f0dd941c..47dff142b8e 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp
@@ -146,7 +146,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_scarlet_traineeAI(creature);
+ return GetScarletMonasteryAI<npc_scarlet_traineeAI>(creature);
}
struct npc_scarlet_traineeAI : public npc_escortAI
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp
index 12e28747256..0df48fc2f1f 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp
@@ -24,8 +24,9 @@ SDCategory: Scarlet Monastery
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "InstanceScript.h"
#include "scarlet_monastery.h"
+#include "ScriptedCreature.h"
enum Spells
{
@@ -44,7 +45,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_high_inquisitor_fairbanksAI>(creature);
+ return GetScarletMonasteryAI<boss_high_inquisitor_fairbanksAI>(creature);
}
struct boss_high_inquisitor_fairbanksAI : public ScriptedAI
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp
index dd2443c12d7..2a2861a5991 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp
@@ -16,8 +16,10 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
#include "scarlet_monastery.h"
+#include "ScriptedCreature.h"
enum Says
{
@@ -115,7 +117,7 @@ class boss_interrogator_vishas : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_interrogator_vishasAI>(creature);
+ return GetScarletMonasteryAI<boss_interrogator_vishasAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp
index bc987d5328d..42f2514da79 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp
@@ -24,8 +24,10 @@ SDCategory: Scarlet Monastery
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
#include "scarlet_monastery.h"
+#include "ScriptedCreature.h"
#include "SpellInfo.h"
enum Says
@@ -65,7 +67,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_scarlet_commander_mograineAI>(creature);
+ return GetScarletMonasteryAI<boss_scarlet_commander_mograineAI>(creature);
}
struct boss_scarlet_commander_mograineAI : public ScriptedAI
@@ -227,7 +229,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_high_inquisitor_whitemaneAI>(creature);
+ return GetScarletMonasteryAI<boss_high_inquisitor_whitemaneAI>(creature);
}
struct boss_high_inquisitor_whitemaneAI : public ScriptedAI
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp
index cd07bedc628..80c118e6f91 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp
@@ -16,7 +16,10 @@
*/
#include "ScriptMgr.h"
+#include "Creature.h"
+#include "GameObject.h"
#include "InstanceScript.h"
+#include "Map.h"
#include "scarlet_monastery.h"
DoorData const doorData[] =
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/scarlet_monastery.h b/src/server/scripts/EasternKingdoms/ScarletMonastery/scarlet_monastery.h
index fede79df5d3..25f4496c819 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/scarlet_monastery.h
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/scarlet_monastery.h
@@ -18,6 +18,8 @@
#ifndef SCARLET_M_
#define SCARLET_M_
+#include "CreatureAIImpl.h"
+
#define SMScriptName "instance_scarlet_monastery"
#define DataHeader "SM"
@@ -60,7 +62,7 @@ enum SMGameObjectIds
GO_PUMPKIN_SHRINE = 186267
};
-template<class AI>
+template<typename AI>
inline AI* GetScarletMonasteryAI(Creature* creature)
{
return GetInstanceAI<AI>(creature, SMScriptName);
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp
index 1d9432103a5..7c280dc8a3b 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp
@@ -136,7 +136,7 @@ class boss_darkmaster_gandling : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_darkmaster_gandlingAI>(creature);
+ return GetScholomanceAI<boss_darkmaster_gandlingAI>(creature);
}
};
@@ -309,7 +309,7 @@ class spell_shadow_portal_rooms : public SpellScriptLoader
bool Load() override
{
_instance = GetCaster()->GetInstanceScript();
- return _instance != nullptr;
+ return InstanceHasScript(GetCaster(), ScholomanceScriptName);
}
void HandleSendEvent(SpellEffIndex effIndex)
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_death_knight_darkreaver.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_death_knight_darkreaver.cpp
index e1b491e7453..239c042d1d4 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_death_knight_darkreaver.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_death_knight_darkreaver.cpp
@@ -24,6 +24,7 @@ SDCategory: Scholomance
EndScriptData */
#include "ScriptMgr.h"
+#include "scholomance.h"
#include "ScriptedCreature.h"
class boss_death_knight_darkreaver : public CreatureScript
@@ -33,7 +34,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_death_knight_darkreaverAI(creature);
+ return GetScholomanceAI<boss_death_knight_darkreaverAI>(creature);
}
struct boss_death_knight_darkreaverAI : public ScriptedAI
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_doctor_theolen_krastinov.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_doctor_theolen_krastinov.cpp
index 03a2bf0f293..c9c5894ee44 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_doctor_theolen_krastinov.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_doctor_theolen_krastinov.cpp
@@ -102,7 +102,7 @@ class boss_doctor_theolen_krastinov : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_theolenkrastinovAI(creature);
+ return GetScholomanceAI<boss_theolenkrastinovAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_illucia_barov.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_illucia_barov.cpp
index cb569d2e238..2d969bb8a0a 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_illucia_barov.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_illucia_barov.cpp
@@ -103,7 +103,7 @@ class boss_illucia_barov : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_illuciabarovAI(creature);
+ return GetScholomanceAI<boss_illuciabarovAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp
index e7a3bf99b43..dbad6ba1dc5 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp
@@ -148,9 +148,8 @@ class boss_instructor_malicia : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_instructormaliciaAI(creature);
+ return GetScholomanceAI<boss_instructormaliciaAI>(creature);
}
-
};
void AddSC_boss_instructormalicia()
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_jandice_barov.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_jandice_barov.cpp
index a55ecfe6a84..e4d7140e6f1 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_jandice_barov.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_jandice_barov.cpp
@@ -16,6 +16,7 @@
*/
#include "ScriptMgr.h"
+#include "scholomance.h"
#include "ScriptedCreature.h"
enum Spells
@@ -116,7 +117,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_jandicebarovAI>(creature);
+ return GetScholomanceAI<boss_jandicebarovAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_kirtonos_the_herald.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_kirtonos_the_herald.cpp
index 3e3c6e59cf7..8cfcd4583f7 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_kirtonos_the_herald.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_kirtonos_the_herald.cpp
@@ -16,11 +16,13 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "scholomance.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
#include "MoveSplineInit.h"
-#include "GameObjectAI.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "scholomance.h"
+#include "ScriptedCreature.h"
enum Says
{
@@ -98,9 +100,9 @@ class boss_kirtonos_the_herald : public CreatureScript
void JustDied(Unit* /*killer*/) override
{
- if (GameObject* gate = me->GetMap()->GetGameObject(instance->GetGuidData(GO_GATE_KIRTONOS)))
+ if (GameObject* gate = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_GATE_KIRTONOS)))
gate->SetGoState(GO_STATE_ACTIVE);
- if (GameObject* brazier = me->GetMap()->GetGameObject(instance->GetGuidData(GO_BRAZIER_OF_THE_HERALD)))
+ if (GameObject* brazier = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_BRAZIER_OF_THE_HERALD)))
{
brazier->ResetDoorOrButton();
brazier->SetGoState(GO_STATE_READY);
@@ -110,9 +112,9 @@ class boss_kirtonos_the_herald : public CreatureScript
void EnterEvadeMode(EvadeReason /*why*/) override
{
- if (GameObject* gate = me->GetMap()->GetGameObject(instance->GetGuidData(GO_GATE_KIRTONOS)))
+ if (GameObject* gate = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_GATE_KIRTONOS)))
gate->SetGoState(GO_STATE_ACTIVE);
- if (GameObject* brazier = me->GetMap()->GetGameObject(instance->GetGuidData(GO_BRAZIER_OF_THE_HERALD)))
+ if (GameObject* brazier = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_BRAZIER_OF_THE_HERALD)))
{
brazier->ResetDoorOrButton();
brazier->SetGoState(GO_STATE_READY);
@@ -256,7 +258,7 @@ class boss_kirtonos_the_herald : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_kirtonos_the_heraldAI>(creature);
+ return GetScholomanceAI<boss_kirtonos_the_heraldAI>(creature);
}
};
@@ -292,5 +294,5 @@ class go_brazier_of_the_herald : public GameObjectScript
void AddSC_boss_kirtonos_the_herald()
{
new boss_kirtonos_the_herald();
- new go_brazier_of_the_herald;
+ new go_brazier_of_the_herald();
}
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_kormok.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_kormok.cpp
index 121d6b51b42..8ff5fa9ccd3 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_kormok.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_kormok.cpp
@@ -16,9 +16,9 @@
*/
#include "ScriptMgr.h"
+#include "scholomance.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
-#include "scholomance.h"
enum Spells
{
@@ -130,7 +130,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_kormokAI(creature);
+ return GetScholomanceAI<boss_kormokAI>(creature);
}
};
@@ -154,10 +154,7 @@ class spell_kormok_summon_bone_mages : SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- for (uint32 i = 0; i < 4; ++i)
- if (!sSpellMgr->GetSpellInfo(SummonMageSpells[i]))
- return false;
- return true;
+ return ValidateSpellInfo(SummonMageSpells);
}
void HandleScript(SpellEffIndex effIndex)
@@ -191,9 +188,7 @@ class spell_kormok_summon_bone_minions : SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_BONE_MINIONS))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SUMMON_BONE_MINIONS });
}
void HandleScript(SpellEffIndex effIndex)
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_lord_alexei_barov.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_lord_alexei_barov.cpp
index 82feeaf5dd9..54896ae61e7 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_lord_alexei_barov.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_lord_alexei_barov.cpp
@@ -98,7 +98,7 @@ class boss_lord_alexei_barov : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_lordalexeibarovAI(creature);
+ return GetScholomanceAI<boss_lordalexeibarovAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp
index c162de33a3b..2e8786961fb 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp
@@ -103,7 +103,7 @@ class boss_lorekeeper_polkelt : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_lorekeeperpolkeltAI(creature);
+ return GetScholomanceAI<boss_lorekeeperpolkeltAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp
index 77244dc7a93..654dfd9c565 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp
@@ -16,6 +16,7 @@
*/
#include "ScriptMgr.h"
+#include "scholomance.h"
#include "ScriptedCreature.h"
enum Spells
@@ -118,7 +119,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_rasfrostAI(creature);
+ return GetScholomanceAI<boss_rasfrostAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_the_ravenian.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_the_ravenian.cpp
index d2e54bf433c..afad501d675 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_the_ravenian.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_the_ravenian.cpp
@@ -103,7 +103,7 @@ class boss_the_ravenian : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_theravenianAI(creature);
+ return GetScholomanceAI<boss_theravenianAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_vectus.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_vectus.cpp
index d24648b6d81..0073d2c43c9 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_vectus.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_vectus.cpp
@@ -16,6 +16,7 @@
*/
#include "ScriptMgr.h"
+#include "scholomance.h"
#include "ScriptedCreature.h"
enum Emotes
@@ -112,7 +113,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_vectusAI(creature);
+ return GetScholomanceAI<boss_vectusAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp b/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp
index c6c3c6c4d10..984487f3d61 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp
@@ -16,7 +16,9 @@
*/
#include "ScriptMgr.h"
+#include "GameObject.h"
#include "InstanceScript.h"
+#include "Map.h"
#include "Player.h"
#include "scholomance.h"
@@ -25,7 +27,7 @@ Position const GandlingLoc = { 180.7712f, -5.428603f, 75.57024f, 1.291544f };
class instance_scholomance : public InstanceMapScript
{
public:
- instance_scholomance() : InstanceMapScript("instance_scholomance", 289) { }
+ instance_scholomance() : InstanceMapScript(ScholomanceScriptName, 289) { }
InstanceScript* GetInstanceScript(InstanceMap* map) const override
{
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/scholomance.h b/src/server/scripts/EasternKingdoms/Scholomance/scholomance.h
index abe6a7b415a..4c31081b3eb 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/scholomance.h
+++ b/src/server/scripts/EasternKingdoms/Scholomance/scholomance.h
@@ -18,6 +18,9 @@
#ifndef DEF_SCHOLOMANCE_H
#define DEF_SCHOLOMANCE_H
+#include "CreatureAIImpl.h"
+
+#define ScholomanceScriptName "instance_scholomance"
#define DataHeader "SC"
uint32 const EncounterCount = 8;
@@ -53,4 +56,10 @@ enum SCGameobjectIds
GO_BRAZIER_OF_THE_HERALD = 175564
};
+template<typename AI>
+inline AI* GetScholomanceAI(Creature* creature)
+{
+ return GetInstanceAI<AI>(creature, ScholomanceScriptName);
+}
+
#endif
diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp b/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp
index 386cdd53b88..3fa03dd77e6 100644
--- a/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp
+++ b/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp
@@ -23,12 +23,15 @@ SDComment:
SDCategory: Shadowfang Keep
EndScriptData */
-#include "ScriptedCreature.h"
#include "ScriptMgr.h"
+#include "Creature.h"
+#include "CreatureAI.h"
+#include "GameObject.h"
#include "InstanceScript.h"
+#include "Log.h"
+#include "Map.h"
#include "shadowfang_keep.h"
#include "TemporarySummon.h"
-#include "Log.h"
#define MAX_ENCOUNTER 4
@@ -70,7 +73,7 @@ const Position SpawnLocation[] =
class instance_shadowfang_keep : public InstanceMapScript
{
public:
- instance_shadowfang_keep() : InstanceMapScript("instance_shadowfang_keep", 33) { }
+ instance_shadowfang_keep() : InstanceMapScript(SFKScriptName, 33) { }
InstanceScript* GetInstanceScript(InstanceMap* map) const override
{
diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp b/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp
index 948c7afd0b1..b923f6072ee 100644
--- a/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp
+++ b/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp
@@ -28,13 +28,13 @@ npc_shadowfang_prisoner
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
-#include "SpellScript.h"
-#include "SpellAuraEffects.h"
+#include "InstanceScript.h"
+#include "Player.h"
#include "ScriptedEscortAI.h"
+#include "ScriptedGossip.h"
#include "shadowfang_keep.h"
-#include "Player.h"
+#include "SpellAuraEffects.h"
+#include "SpellScript.h"
/*######
## npc_shadowfang_prisoner
@@ -70,7 +70,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_shadowfang_prisonerAI>(creature);
+ return GetShadowfangKeepAI<npc_shadowfang_prisonerAI>(creature);
}
bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) override
@@ -155,7 +155,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_arugal_voidwalkerAI>(creature);
+ return GetShadowfangKeepAI<npc_arugal_voidwalkerAI>(creature);
}
struct npc_arugal_voidwalkerAI : public ScriptedAI
diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.h b/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.h
index b06cbb353eb..5ef756f44fa 100644
--- a/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.h
+++ b/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.h
@@ -19,6 +19,9 @@
#ifndef DEF_SHADOWFANG_H
#define DEF_SHADOWFANG_H
+#include "CreatureAIImpl.h"
+
+#define SFKScriptName "instance_shadowfang_keep"
#define DataHeader "SK"
enum SKDataTypes
@@ -29,5 +32,11 @@ enum SKDataTypes
TYPE_NANDOS = 4
};
+template<typename AI>
+inline AI* GetShadowfangKeepAI(Creature* creature)
+{
+ return GetInstanceAI<AI>(creature, SFKScriptName);
+}
+
#endif
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp
index ed8b2cfc853..2110b2b1d77 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp
@@ -24,6 +24,7 @@ SDCategory: Stratholme
EndScriptData */
#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "ScriptedCreature.h"
#include "stratholme.h"
@@ -68,7 +69,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_baron_rivendareAI>(creature);
+ return GetStratholmeAI<boss_baron_rivendareAI>(creature);
}
struct boss_baron_rivendareAI : public ScriptedAI
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp
index f44a914121e..241f576260a 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp
@@ -24,6 +24,7 @@ SDCategory: Stratholme
EndScriptData */
#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "ScriptedCreature.h"
#include "stratholme.h"
@@ -42,7 +43,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_baroness_anastariAI>(creature);
+ return GetStratholmeAI<boss_baroness_anastariAI>(creature);
}
struct boss_baroness_anastariAI : public ScriptedAI
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_cannon_master_willey.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_cannon_master_willey.cpp
index 23111e1d0fc..463c6de61bc 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/boss_cannon_master_willey.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_cannon_master_willey.cpp
@@ -25,6 +25,7 @@ EndScriptData */
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
+#include "stratholme.h"
//front, left
#define ADD_1X 3553.851807f
@@ -87,7 +88,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_cannon_master_willeyAI(creature);
+ return GetStratholmeAI<boss_cannon_master_willeyAI>(creature);
}
struct boss_cannon_master_willeyAI : public ScriptedAI
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_dathrohan_balnazzar.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_dathrohan_balnazzar.cpp
index 7fcb5e0ec0b..d1c9532ec85 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/boss_dathrohan_balnazzar.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_dathrohan_balnazzar.cpp
@@ -25,6 +25,7 @@ EndScriptData */
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
+#include "stratholme.h"
enum Spells
{
@@ -76,7 +77,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_dathrohan_balnazzarAI(creature);
+ return GetStratholmeAI<boss_dathrohan_balnazzarAI>(creature);
}
struct boss_dathrohan_balnazzarAI : public ScriptedAI
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_magistrate_barthilas.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_magistrate_barthilas.cpp
index 389aa1b497d..9c7c39718b8 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/boss_magistrate_barthilas.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_magistrate_barthilas.cpp
@@ -48,7 +48,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_magistrate_barthilasAI(creature);
+ return GetStratholmeAI<boss_magistrate_barthilasAI>(creature);
}
struct boss_magistrate_barthilasAI : public ScriptedAI
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp
index 768c414a01c..10c2b1327bb 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp
@@ -24,6 +24,7 @@ SDCategory: Stratholme
EndScriptData */
#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "ScriptedCreature.h"
#include "stratholme.h"
@@ -117,7 +118,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_maleki_the_pallidAI>(creature);
+ return GetStratholmeAI<boss_maleki_the_pallidAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_nerubenkan.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_nerubenkan.cpp
index c38ba7aad1d..ecf0bf7fe00 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/boss_nerubenkan.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_nerubenkan.cpp
@@ -24,6 +24,7 @@ SDCategory: Stratholme
EndScriptData */
#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "ScriptedCreature.h"
#include "stratholme.h"
@@ -42,7 +43,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_nerubenkanAI>(creature);
+ return GetStratholmeAI<boss_nerubenkanAI>(creature);
}
struct boss_nerubenkanAI : public ScriptedAI
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp
index f1052bc16dc..108e230d82c 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp
@@ -24,9 +24,10 @@ SDCategory: Stratholme
EndScriptData */
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "Player.h"
#include "ScriptedCreature.h"
#include "stratholme.h"
-#include "Player.h"
/*#####
# Additional:
@@ -58,7 +59,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_silver_hand_bossesAI>(creature);
+ return GetStratholmeAI<boss_silver_hand_bossesAI>(creature);
}
struct boss_silver_hand_bossesAI : public ScriptedAI
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_postmaster_malown.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_postmaster_malown.cpp
index 23b2e55c928..373ca3a1bda 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/boss_postmaster_malown.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_postmaster_malown.cpp
@@ -131,7 +131,7 @@ class boss_postmaster_malown : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_postmaster_malownAI>(creature);
+ return GetStratholmeAI<boss_postmaster_malownAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_ramstein_the_gorger.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_ramstein_the_gorger.cpp
index 51725964ac5..cd7aa959c9e 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/boss_ramstein_the_gorger.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_ramstein_the_gorger.cpp
@@ -24,8 +24,10 @@ SDCategory: Stratholme
EndScriptData */
#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "ScriptedCreature.h"
#include "stratholme.h"
+#include "TemporarySummon.h"
enum Spells
{
@@ -45,7 +47,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_ramstein_the_gorgerAI>(creature);
+ return GetStratholmeAI<boss_ramstein_the_gorgerAI>(creature);
}
struct boss_ramstein_the_gorgerAI : public ScriptedAI
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_timmy_the_cruel.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_timmy_the_cruel.cpp
index 6508c527cc0..473fc9b9048 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/boss_timmy_the_cruel.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_timmy_the_cruel.cpp
@@ -25,6 +25,7 @@ EndScriptData */
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
+#include "stratholme.h"
enum Says
{
@@ -43,7 +44,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_timmy_the_cruelAI(creature);
+ return GetStratholmeAI<boss_timmy_the_cruelAI>(creature);
}
struct boss_timmy_the_cruelAI : public ScriptedAI
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp b/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp
index 2fa3e298109..dcae67e7d84 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp
@@ -24,11 +24,14 @@ SDCategory: Stratholme
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "Creature.h"
+#include "EventMap.h"
+#include "GameObject.h"
#include "InstanceScript.h"
-#include "stratholme.h"
-#include "Player.h"
#include "Log.h"
+#include "Map.h"
+#include "Player.h"
+#include "stratholme.h"
enum Misc
{
@@ -44,7 +47,7 @@ enum InstanceEvents
class instance_stratholme : public InstanceMapScript
{
public:
- instance_stratholme() : InstanceMapScript("instance_stratholme", 329) { }
+ instance_stratholme() : InstanceMapScript(StratholmeScriptName, 329) { }
struct instance_stratholme_InstanceMapScript : public InstanceScript
{
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp
index 03dd3986a4a..f999f4d46c9 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp
@@ -31,11 +31,14 @@ npc_spectral_ghostly_citizen
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "stratholme.h"
+#include "GameObject.h"
#include "Group.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "ScriptedCreature.h"
#include "SpellInfo.h"
+#include "stratholme.h"
/*######
## go_gauntlet_gate (this is the _first_ of the gauntlet gates, two exist)
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.h b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.h
index 5e2c589dc76..51e723227fe 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.h
+++ b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.h
@@ -19,6 +19,9 @@
#ifndef DEF_STRATHOLME_H
#define DEF_STRATHOLME_H
+#include "CreatureAIImpl.h"
+
+#define StratholmeScriptName "instance_stratholme"
#define DataHeader "STR"
enum STRDataTypes
@@ -81,5 +84,11 @@ enum STRSpellIds
SPELL_BARON_ULTIMATUM = 27861
};
+template<typename AI>
+inline AI* GetStratholmeAI(Creature* creature)
+{
+ return GetInstanceAI<AI>(creature, StratholmeScriptName);
+}
+
#endif
diff --git a/src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp b/src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp
index e1fee0d5f98..4776cf6a02b 100644
--- a/src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp
+++ b/src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp
@@ -24,7 +24,9 @@ SDCategory: Sunken Temple
EndScriptData */
#include "ScriptMgr.h"
+#include "GameObject.h"
#include "InstanceScript.h"
+#include "Map.h"
#include "sunken_temple.h"
enum Gameobject
@@ -165,7 +167,7 @@ public:
void UseStatue(GameObject* go)
{
- go->SummonGameObject(GO_ATALAI_LIGHT1, *go, G3D::Quat(), 0);
+ go->SummonGameObject(GO_ATALAI_LIGHT1, *go, QuaternionData(), 0);
go->SetUInt32Value(GAMEOBJECT_FLAGS, 4);
}
diff --git a/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.cpp b/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.cpp
index 410e9e50dfb..a8d12619afb 100644
--- a/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.cpp
+++ b/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.cpp
@@ -28,9 +28,11 @@ at_malfurion_Stormrage_trigger
EndContentData */
#include "ScriptMgr.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "Player.h"
#include "ScriptedCreature.h"
#include "sunken_temple.h"
-#include "Player.h"
/*#####
# at_malfurion_Stormrage_trigger
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp
index 7dc575526c9..0e6a3d44e3d 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp
@@ -22,8 +22,10 @@ SD%Complete: 80
SDComment: Find a way to start the intro, best code for the intro
EndScriptData */
-#include "Log.h"
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "Log.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
#include "sunwell_plateau.h"
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp
index b27e204e696..24e42c2af68 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp
@@ -16,9 +16,11 @@
*/
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
-#include "sunwell_plateau.h"
#include "SpellInfo.h"
+#include "sunwell_plateau.h"
enum Quotes
{
@@ -644,7 +646,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_shadow_imageAI(creature);
+ return GetSunwellPlateauAI<npc_shadow_imageAI>(creature);
};
struct npc_shadow_imageAI : public ScriptedAI
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp
index 6eaecffa2bb..a87997a03bd 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp
@@ -22,12 +22,13 @@ SDComment:
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "GridNotifiers.h"
-#include "GridNotifiersImpl.h"
-#include "Cell.h"
#include "CellImpl.h"
+#include "GridNotifiersImpl.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
#include "sunwell_plateau.h"
+#include "TemporarySummon.h"
enum Yells
{
@@ -517,7 +518,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_felmyst_vaporAI(creature);
+ return GetSunwellPlateauAI<npc_felmyst_vaporAI>(creature);
}
struct npc_felmyst_vaporAI : public ScriptedAI
@@ -551,7 +552,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_felmyst_trailAI(creature);
+ return GetSunwellPlateauAI<npc_felmyst_trailAI>(creature);
}
struct npc_felmyst_trailAI : public ScriptedAI
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp
index 9e495c1086c..c54e98dd8c4 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp
@@ -23,12 +23,14 @@ SDComment:
SDCategory: Sunwell_Plateau
EndScriptData */
-#include "Log.h"
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "Log.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptedCreature.h"
#include "sunwell_plateau.h"
-#include "Player.h"
-#include "WorldSession.h"
+#include "TemporarySummon.h"
enum Yells
{
@@ -435,7 +437,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_kalecAI>(creature);
+ return GetSunwellPlateauAI<boss_kalecAI>(creature);
}
struct boss_kalecAI : public ScriptedAI
@@ -571,7 +573,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_sathrovarrAI>(creature);
+ return GetSunwellPlateauAI<boss_sathrovarrAI>(creature);
}
struct boss_sathrovarrAI : public ScriptedAI
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp
index e7bac5ec171..30e871d3ad9 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp
@@ -24,11 +24,15 @@ EndScriptData */
/// @todo rewrite Armageddon
-#include "Log.h"
#include "ScriptMgr.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "Log.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptedCreature.h"
#include "sunwell_plateau.h"
-#include "Player.h"
+#include "TemporarySummon.h"
#include <cmath>
/*** Speech and sounds***/
@@ -233,7 +237,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_kalecgos_kjAI>(creature);
+ return GetSunwellPlateauAI<boss_kalecgos_kjAI>(creature);
}
struct boss_kalecgos_kjAI : public ScriptedAI
@@ -389,7 +393,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_kiljaeden_controllerAI>(creature);
+ return GetSunwellPlateauAI<npc_kiljaeden_controllerAI>(creature);
}
struct npc_kiljaeden_controllerAI : public ScriptedAI
@@ -1005,7 +1009,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_felfire_portalAI(creature);
+ return GetSunwellPlateauAI<npc_felfire_portalAI>(creature);
}
struct npc_felfire_portalAI : public ScriptedAI
@@ -1058,7 +1062,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_volatile_felfire_fiendAI(creature);
+ return GetSunwellPlateauAI<npc_volatile_felfire_fiendAI>(creature);
}
struct npc_volatile_felfire_fiendAI : public ScriptedAI
@@ -1123,7 +1127,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_armageddonAI(creature);
+ return GetSunwellPlateauAI<npc_armageddonAI>(creature);
}
struct npc_armageddonAI : public ScriptedAI
@@ -1186,7 +1190,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_shield_orbAI>(creature);
+ return GetSunwellPlateauAI<npc_shield_orbAI>(creature);
}
struct npc_shield_orbAI : public ScriptedAI
@@ -1281,7 +1285,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_sinster_reflectionAI(creature);
+ return GetSunwellPlateauAI<npc_sinster_reflectionAI>(creature);
}
struct npc_sinster_reflectionAI : public ScriptedAI
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp
index ebe7fb2d8ab..6e4982d8b7f 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp
@@ -16,10 +16,12 @@
*/
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
-#include "sunwell_plateau.h"
-#include "SpellScript.h"
#include "SpellAuraEffects.h"
+#include "SpellScript.h"
+#include "sunwell_plateau.h"
enum Spells
{
@@ -581,10 +583,7 @@ class spell_summon_blood_elves_script : SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- for (uint8 i = 0; i < MAX_SUMMON_BLOOD_ELVES; ++i)
- if (!sSpellMgr->GetSpellInfo(SummonBloodElvesSpells[i]))
- return false;
- return true;
+ return ValidateSpellInfo(SummonBloodElvesSpells);
}
void HandleScript(SpellEffIndex /*effIndex*/)
@@ -616,10 +615,7 @@ class spell_muru_darkness : SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- for (uint8 i = 0; i < MAX_SUMMON_DARK_FIEND; ++i)
- if (!sSpellMgr->GetSpellInfo(SummonDarkFiendSpells[i]))
- return false;
- return true;
+ return ValidateSpellInfo(SummonDarkFiendSpells);
}
void HandleAfterCast()
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp
index 1a7e3045b3e..9d58eae4f81 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp
@@ -16,6 +16,8 @@
*/
#include "ScriptMgr.h"
+#include "Creature.h"
+#include "GameObject.h"
#include "InstanceScript.h"
#include "Log.h"
#include "Player.h"
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.h b/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.h
index eb99ba3ebae..b9f166d2f36 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.h
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.h
@@ -18,6 +18,8 @@
#ifndef SUNWELL_PLATEAU_H
#define SUNWELL_PLATEAU_H
+#include "CreatureAIImpl.h"
+
#define SunwellPlateauScriptName "instance_sunwell_plateau"
#define DataHeader "SWP"
@@ -112,8 +114,8 @@ enum SWPGameObjectIds
GO_MURUS_GATE_2 = 188118
};
-template<class AI>
-AI* GetSunwellPlateauAI(Creature* creature)
+template<typename AI>
+inline AI* GetSunwellPlateauAI(Creature* creature)
{
return GetInstanceAI<AI>(creature, SunwellPlateauScriptName);
}
diff --git a/src/server/scripts/EasternKingdoms/TheStockade/instance_the_stockade.cpp b/src/server/scripts/EasternKingdoms/TheStockade/instance_the_stockade.cpp
index 822737dad87..c222f395a50 100644
--- a/src/server/scripts/EasternKingdoms/TheStockade/instance_the_stockade.cpp
+++ b/src/server/scripts/EasternKingdoms/TheStockade/instance_the_stockade.cpp
@@ -24,6 +24,7 @@ gets instead the deserter debuff.
#include "ScriptMgr.h"
#include "InstanceScript.h"
+#include "Map.h"
class instance_the_stockade : public InstanceMapScript
{
diff --git a/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp b/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp
index cbe1bdd7732..c4663fac354 100644
--- a/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp
+++ b/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp
@@ -27,9 +27,12 @@ On his death the vault door opens.
EndScriptData */
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptedCreature.h"
+#include "SpellMgr.h"
#include "uldaman.h"
-#include "Player.h"
enum Says
{
@@ -211,7 +214,7 @@ class boss_archaedas : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_archaedasAI>(creature);
+ return GetUldamanAI<boss_archaedasAI>(creature);
}
};
@@ -317,7 +320,7 @@ class npc_archaedas_minions : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_archaedas_minionsAI>(creature);
+ return GetUldamanAI<npc_archaedas_minionsAI>(creature);
}
};
@@ -380,7 +383,7 @@ class npc_stonekeepers : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_stonekeepersAI>(creature);
+ return GetUldamanAI<npc_stonekeepersAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp b/src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp
index 98b94e09c70..5a17339b4de 100644
--- a/src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp
+++ b/src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp
@@ -25,6 +25,7 @@ EndScriptData */
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
+#include "uldaman.h"
enum Ironaya
{
@@ -110,7 +111,7 @@ class boss_ironaya : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_ironayaAI(creature);
+ return GetUldamanAI<boss_ironayaAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp b/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp
index b21235b4293..aa2fa9acfd7 100644
--- a/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp
+++ b/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp
@@ -24,10 +24,14 @@ SDCategory: Uldaman
EndScriptData */
#include "ScriptMgr.h"
-#include "InstanceScript.h"
-#include "uldaman.h"
+#include "Creature.h"
#include "CreatureAI.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
#include "Log.h"
+#include "Map.h"
+#include "ObjectAccessor.h"
+#include "uldaman.h"
enum Spells
{
@@ -52,7 +56,7 @@ const Position IronayaPoint = { -231.228f, 246.6135f, -49.01617f, 0.0f };
class instance_uldaman : public InstanceMapScript
{
public:
- instance_uldaman() : InstanceMapScript("instance_uldaman", 70) { }
+ instance_uldaman() : InstanceMapScript(UldamanScriptName, 70) { }
struct instance_uldaman_InstanceMapScript : public InstanceScript
{
diff --git a/src/server/scripts/EasternKingdoms/Uldaman/uldaman.cpp b/src/server/scripts/EasternKingdoms/Uldaman/uldaman.cpp
index 81a8aa3db41..fcc0064ba70 100644
--- a/src/server/scripts/EasternKingdoms/Uldaman/uldaman.cpp
+++ b/src/server/scripts/EasternKingdoms/Uldaman/uldaman.cpp
@@ -30,9 +30,11 @@ at_map_chamber
EndContentData */
#include "ScriptMgr.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "Player.h"
#include "ScriptedCreature.h"
#include "uldaman.h"
-#include "Player.h"
/*######
## npc_jadespine_basilisk
diff --git a/src/server/scripts/EasternKingdoms/Uldaman/uldaman.h b/src/server/scripts/EasternKingdoms/Uldaman/uldaman.h
index 0578da35895..b277612a967 100644
--- a/src/server/scripts/EasternKingdoms/Uldaman/uldaman.h
+++ b/src/server/scripts/EasternKingdoms/Uldaman/uldaman.h
@@ -19,6 +19,9 @@
#ifndef DEF_ULDAMAN_H
#define DEF_ULDAMAN_H
+#include "CreatureAIImpl.h"
+
+#define UldamanScriptName "instance_uldaman"
#define DataHeader "UD"
#define MAX_ENCOUNTER 3
@@ -42,4 +45,10 @@ enum UDGameObjectIds
GO_KEYSTONE = 124371,
};
+template<typename AI>
+inline AI* GetUldamanAI(Creature* creature)
+{
+ return GetInstanceAI<AI>(creature, UldamanScriptName);
+}
+
#endif
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp
index 20c8e79e58a..6f7c3662d65 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp
@@ -88,7 +88,7 @@ class boss_akilzon : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_akilzonAI>(creature);
+ return GetZulAmanAI<boss_akilzonAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp
index 01cc505f91a..a4d60edfabf 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp
@@ -17,8 +17,8 @@
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
-#include "SpellScript.h"
#include "SpellAuraEffects.h"
+#include "SpellScript.h"
#include "zulaman.h"
enum Says
@@ -100,7 +100,7 @@ class boss_hexlord_malacrass : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_hex_lord_malacrassAI>(creature);
+ return GetZulAmanAI<boss_hex_lord_malacrassAI>(creature);
}
};
@@ -115,9 +115,7 @@ class spell_hexlord_unstable_affliction : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_WL_UNSTABLE_AFFL_DISPEL))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_WL_UNSTABLE_AFFL_DISPEL });
}
void HandleDispel(DispelInfo* dispelInfo)
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp
index ba60c3d3f95..74d1254b803 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp
@@ -97,7 +97,7 @@ class boss_janalai : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_janalaiAI>(creature);
+ return GetZulAmanAI<boss_janalaiAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp
index 7df9c1ae83e..3d6890dc6bc 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp
@@ -102,7 +102,7 @@ class boss_nalorakk : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_nalorakkAI>(creature);
+ return GetZulAmanAI<boss_nalorakkAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp b/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp
index dc815b25511..5eddff8bc38 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp
@@ -16,8 +16,12 @@
*/
#include "ScriptMgr.h"
+#include "Creature.h"
+#include "GameObject.h"
#include "InstanceScript.h"
+#include "Map.h"
#include "ScriptedCreature.h"
+#include "WorldStatePackets.h"
#include "zulaman.h"
class instance_zulaman : public InstanceMapScript
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp
index e1eb22fc2b2..1479daf73f7 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp
@@ -16,10 +16,12 @@
*/
#include "ScriptMgr.h"
+#include "CreatureTextMgr.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
-#include "Player.h"
-#include "CreatureTextMgr.h"
#include "SpellScript.h"
#include "zulaman.h"
@@ -214,7 +216,7 @@ class npc_voljin_zulaman : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_voljin_zulamanAI>(creature);
+ return GetZulAmanAI<npc_voljin_zulamanAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.h b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.h
index d71a0d9bbdb..94e84b88a1d 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.h
+++ b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.h
@@ -18,6 +18,8 @@
#ifndef DEF_ZULAMAN_H
#define DEF_ZULAMAN_H
+#include "CreatureAIImpl.h"
+
uint32 const EncounterCount = 6;
#define ZulAmanScriptName "instance_zulaman"
#define DataHeader "ZA"
@@ -78,14 +80,10 @@ enum ZAWorldStates
WORLD_STATE_ZULAMAN_TIMER = 3106,
};
-template<class AI>
+template<typename AI>
CreatureAI* GetZulAmanAI(Creature* creature)
{
- if (InstanceMap* instance = creature->GetMap()->ToInstanceMap())
- if (instance->GetInstanceScript())
- if (instance->GetScriptId() == sObjectMgr->GetScriptId(ZulAmanScriptName))
- return new AI(creature);
- return NULL;
+ return GetInstanceAI<AI>(creature, ZulAmanScriptName);
}
#endif
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_grilek.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_grilek.cpp
index b3e4ce5ec9a..76e4fc0d6cd 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_grilek.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_grilek.cpp
@@ -85,7 +85,7 @@ class boss_grilek : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_grilekAI(creature);
+ return GetZulGurubAI<boss_grilekAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_hazzarah.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hazzarah.cpp
index fdf42cf6921..e7a8b01cbd7 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_hazzarah.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hazzarah.cpp
@@ -85,7 +85,7 @@ class boss_hazzarah : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_hazzarahAI(creature);
+ return GetZulGurubAI<boss_hazzarahAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp
index 535095ec64f..d9cfa61a36a 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp
@@ -17,11 +17,13 @@
*/
#include "ScriptMgr.h"
+#include "GridNotifiers.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptedCreature.h"
-#include "SpellScript.h"
#include "SpellAuraEffects.h"
-#include "Player.h"
-#include "GridNotifiers.h"
+#include "SpellScript.h"
#include "zulgurub.h"
enum Yells
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp
index 8b577bbbe8b..a5c744af159 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp
@@ -82,7 +82,7 @@ class boss_renataki : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_renatakiAI(creature);
+ return GetZulGurubAI<boss_renatakiAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_wushoolay.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_wushoolay.cpp
index b8e6a975f6c..6178c1dedf8 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_wushoolay.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_wushoolay.cpp
@@ -85,7 +85,7 @@ class boss_wushoolay : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_wushoolayAI(creature);
+ return GetZulGurubAI<boss_wushoolayAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp
index 9126663ce86..a87a71484d7 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp
@@ -17,7 +17,10 @@
*/
#include "ScriptMgr.h"
+#include "Creature.h"
+#include "GameObject.h"
#include "InstanceScript.h"
+#include "Map.h"
#include "zulgurub.h"
DoorData const doorData[] =
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/zulgurub.h b/src/server/scripts/EasternKingdoms/ZulGurub/zulgurub.h
index e555226fcde..688fe680afa 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/zulgurub.h
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/zulgurub.h
@@ -19,6 +19,8 @@
#ifndef DEF_ZULGURUB_H
#define DEF_ZULGURUB_H
+#include "CreatureAIImpl.h"
+
#define DataHeader "ZG"
#define ZGScriptName "instance_zulgurub"
@@ -88,8 +90,8 @@ enum ZGGameObjectIds
GO_THE_CACHE_OF_MADNESS_DOOR = 208843
};
-template<class AI>
-AI* GetZulGurubAI(Creature* creature)
+template<typename AI>
+inline AI* GetZulGurubAI(Creature* creature)
{
return GetInstanceAI<AI>(creature, ZGScriptName);
}
diff --git a/src/server/scripts/EasternKingdoms/zone_blasted_lands.cpp b/src/server/scripts/EasternKingdoms/zone_blasted_lands.cpp
index 2e4fd37554d..90410e5798c 100644
--- a/src/server/scripts/EasternKingdoms/zone_blasted_lands.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_blasted_lands.cpp
@@ -48,9 +48,7 @@ class spell_razelikh_teleport_group : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_TELEPORT_SINGLE) && !sSpellMgr->GetSpellInfo(SPELL_TELEPORT_SINGLE_IN_GROUP))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_TELEPORT_SINGLE, SPELL_TELEPORT_SINGLE_IN_GROUP });
}
void HandleScriptEffect(SpellEffIndex /* effIndex */)
diff --git a/src/server/scripts/EasternKingdoms/zone_duskwood.cpp b/src/server/scripts/EasternKingdoms/zone_duskwood.cpp
index ac5b29fa2ea..a775aecf2eb 100644
--- a/src/server/scripts/EasternKingdoms/zone_duskwood.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_duskwood.cpp
@@ -26,6 +26,7 @@ EndScriptData */
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "Player.h"
+#include "TemporarySummon.h"
enum TwilightCorrupter
{
diff --git a/src/server/scripts/EasternKingdoms/zone_ghostlands.cpp b/src/server/scripts/EasternKingdoms/zone_ghostlands.cpp
index 1be668e6cb6..4482a8a49ed 100644
--- a/src/server/scripts/EasternKingdoms/zone_ghostlands.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_ghostlands.cpp
@@ -28,10 +28,11 @@ npc_ranger_lilatha
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
-#include "ScriptedEscortAI.h"
+#include "GameObject.h"
#include "Player.h"
+#include "ScriptedEscortAI.h"
+#include "ScriptedGossip.h"
+#include "TemporarySummon.h"
#include "WorldSession.h"
/*######
@@ -89,8 +90,8 @@ public:
case 18:
{
Talk(SAY_PROGRESS3, player);
- Creature* Summ1 = me->SummonCreature(NPC_MUMMIFIED_HEADHUNTER, 7627.083984f, -7532.538086f, 152.128616f, 1.082733f, TEMPSUMMON_DEAD_DESPAWN, 0);
- Creature* Summ2 = me->SummonCreature(NPC_SHADOWPINE_ORACLE, 7620.432129f, -7532.550293f, 152.454865f, 0.827478f, TEMPSUMMON_DEAD_DESPAWN, 0);
+ TempSummon* Summ1 = me->SummonCreature(NPC_MUMMIFIED_HEADHUNTER, 7627.083984f, -7532.538086f, 152.128616f, 1.082733f, TEMPSUMMON_DEAD_DESPAWN, 0);
+ TempSummon* Summ2 = me->SummonCreature(NPC_SHADOWPINE_ORACLE, 7620.432129f, -7532.550293f, 152.454865f, 0.827478f, TEMPSUMMON_DEAD_DESPAWN, 0);
if (Summ1 && Summ2)
{
Summ1->Attack(me, true);
diff --git a/src/server/scripts/EasternKingdoms/zone_isle_of_queldanas.cpp b/src/server/scripts/EasternKingdoms/zone_isle_of_queldanas.cpp
index 3109ec7c92e..bbbfb797058 100644
--- a/src/server/scripts/EasternKingdoms/zone_isle_of_queldanas.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_isle_of_queldanas.cpp
@@ -28,8 +28,8 @@ npc_greengill_slave
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "Player.h"
+#include "ScriptedCreature.h"
#include "SpellInfo.h"
/*######
diff --git a/src/server/scripts/EasternKingdoms/zone_silverpine_forest.cpp b/src/server/scripts/EasternKingdoms/zone_silverpine_forest.cpp
index e05ad0541ac..9d22442de80 100644
--- a/src/server/scripts/EasternKingdoms/zone_silverpine_forest.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_silverpine_forest.cpp
@@ -28,9 +28,8 @@ npc_deathstalker_erland
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedEscortAI.h"
#include "Player.h"
+#include "ScriptedEscortAI.h"
/*######
## npc_deathstalker_erland
diff --git a/src/server/scripts/EasternKingdoms/zone_stranglethorn_vale.cpp b/src/server/scripts/EasternKingdoms/zone_stranglethorn_vale.cpp
index 9540499cd73..3000c30c8e7 100644
--- a/src/server/scripts/EasternKingdoms/zone_stranglethorn_vale.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_stranglethorn_vale.cpp
@@ -28,8 +28,8 @@ npc_yenniku
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "Player.h"
+#include "ScriptedCreature.h"
#include "SpellInfo.h"
/*######
diff --git a/src/server/scripts/EasternKingdoms/zone_tol_barad.cpp b/src/server/scripts/EasternKingdoms/zone_tol_barad.cpp
index 04cc5c5badf..ee02b75839b 100644
--- a/src/server/scripts/EasternKingdoms/zone_tol_barad.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_tol_barad.cpp
@@ -15,13 +15,13 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "ScriptMgr.h"
#include "Battlefield.h"
#include "BattlefieldMgr.h"
#include "BattlefieldTB.h"
#include "Player.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
-#include "ScriptMgr.h"
#include "ScriptSystem.h"
#include "SpellScript.h"
#include "WorldSession.h"
diff --git a/src/server/scripts/EasternKingdoms/zone_undercity.cpp b/src/server/scripts/EasternKingdoms/zone_undercity.cpp
index 3dcfa6de68c..8cab122911b 100644
--- a/src/server/scripts/EasternKingdoms/zone_undercity.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_undercity.cpp
@@ -29,9 +29,10 @@ npc_highborne_lamenter
EndContentData */
#include "ScriptMgr.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
-#include "Player.h"
/*######
## npc_lady_sylvanas_windrunner
diff --git a/src/server/scripts/Events/childrens_week.cpp b/src/server/scripts/Events/childrens_week.cpp
index ea4382d93e9..6b666d749eb 100644
--- a/src/server/scripts/Events/childrens_week.cpp
+++ b/src/server/scripts/Events/childrens_week.cpp
@@ -16,9 +16,10 @@
*/
#include "ScriptMgr.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptedCreature.h"
#include "SpellAuras.h"
-#include "Player.h"
enum Orphans
{
diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp
index bccaf0e5246..0300eccc116 100644
--- a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp
+++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp
@@ -16,11 +16,12 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
#include "blackfathom_deeps.h"
-#include "ScriptedEscortAI.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
#include "Player.h"
+#include "ScriptedEscortAI.h"
+#include "ScriptedGossip.h"
#include "SpellScript.h"
enum Spells
@@ -74,7 +75,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_blackfathom_deeps_eventAI>(creature);
+ return GetBlackfathomDeepsAI<npc_blackfathom_deeps_eventAI>(creature);
}
struct npc_blackfathom_deeps_eventAI : public ScriptedAI
diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.h b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.h
index 98daa49ebb5..41884b0143c 100644
--- a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.h
+++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.h
@@ -19,6 +19,9 @@
#ifndef BFD_H_
#define BFD_H_
+#include "CreatureAIImpl.h"
+
+#define BFDScriptName "instance_blackfathom_deeps"
#define DataHeader "BFD"
uint32 const EncounterCount = 3;
@@ -68,4 +71,10 @@ enum BFDGameObjectIds
GO_ALTAR_OF_THE_DEEPS = 103016
};
+template<typename AI>
+inline AI* GetBlackfathomDeepsAI(Creature* creature)
+{
+ return GetInstanceAI<AI>(creature, BFDScriptName);
+}
+
#endif // BFD_H_
diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_aku_mai.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_aku_mai.cpp
index cee400603e1..56b0f9e2624 100644
--- a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_aku_mai.cpp
+++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_aku_mai.cpp
@@ -16,8 +16,8 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "blackfathom_deeps.h"
+#include "ScriptedCreature.h"
enum Spells
{
@@ -88,7 +88,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_aku_maiAI>(creature);
+ return GetBlackfathomDeepsAI<boss_aku_maiAI>(creature);
}
};
diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_gelihast.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_gelihast.cpp
index a287751e3cd..e9f6943a9a7 100644
--- a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_gelihast.cpp
+++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_gelihast.cpp
@@ -16,8 +16,8 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "blackfathom_deeps.h"
+#include "ScriptedCreature.h"
enum Spells
{
@@ -66,7 +66,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_gelihastAI>(creature);
+ return GetBlackfathomDeepsAI<boss_gelihastAI>(creature);
}
};
diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp
index 68d898fb611..2868965f12f 100644
--- a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp
+++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp
@@ -16,8 +16,8 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "blackfathom_deeps.h"
+#include "ScriptedCreature.h"
enum Spells
{
@@ -101,7 +101,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_kelrisAI>(creature);
+ return GetBlackfathomDeepsAI<boss_kelrisAI>(creature);
}
};
diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp
index eca757c6177..96b55fdc8e6 100644
--- a/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp
+++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp
@@ -24,8 +24,11 @@ SDCategory: Blackfathom Deeps
EndScriptData */
#include "ScriptMgr.h"
-#include "InstanceScript.h"
#include "blackfathom_deeps.h"
+#include "Creature.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "Map.h"
const Position LorgusPosition[4] =
{
@@ -47,7 +50,7 @@ const Position SpawnsLocation[] =
class instance_blackfathom_deeps : public InstanceMapScript
{
public:
- instance_blackfathom_deeps() : InstanceMapScript("instance_blackfathom_deeps", 48) { }
+ instance_blackfathom_deeps() : InstanceMapScript(BFDScriptName, 48) { }
InstanceScript* GetInstanceScript(InstanceMap* map) const override
{
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp
index 1f41c7a25e6..91c3744a7e4 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp
@@ -16,10 +16,11 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "SpellScript.h"
#include "hyjal.h"
#include "hyjal_trash.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
+#include "SpellScript.h"
enum Spells
{
@@ -49,7 +50,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_anetheronAI>(creature);
+ return GetHyjalAI<boss_anetheronAI>(creature);
}
struct boss_anetheronAI : public hyjal_trashAI
@@ -186,7 +187,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_towering_infernalAI>(creature);
+ return GetHyjalAI<npc_towering_infernalAI>(creature);
}
struct npc_towering_infernalAI : public ScriptedAI
@@ -274,9 +275,7 @@ class spell_anetheron_vampiric_aura : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_VAMPIRIC_AURA_HEAL))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_VAMPIRIC_AURA_HEAL });
}
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp
index d36e7fda284..38fb4c8a68e 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp
@@ -24,10 +24,11 @@ SDCategory: Caverns of Time, Mount Hyjal
EndScriptData */
#include "ScriptMgr.h"
+#include "hyjal.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
-#include "Player.h"
-#include "hyjal.h"
enum Texts
{
@@ -99,7 +100,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_ancient_wispAI>(creature);
+ return GetHyjalAI<npc_ancient_wispAI>(creature);
}
struct npc_ancient_wispAI : public ScriptedAI
@@ -162,7 +163,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_doomfireAI(creature);
+ return GetHyjalAI<npc_doomfireAI>(creature);
}
struct npc_doomfireAI : public ScriptedAI
@@ -191,7 +192,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_doomfire_targettingAI(creature);
+ return GetHyjalAI<npc_doomfire_targettingAI>(creature);
}
struct npc_doomfire_targettingAI : public ScriptedAI
@@ -530,7 +531,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_archimondeAI>(creature);
+ return GetHyjalAI<boss_archimondeAI>(creature);
}
};
@@ -546,9 +547,7 @@ class spell_archimonde_drain_world_tree_dummy : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DRAIN_WORLD_TREE_TRIGGERED))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DRAIN_WORLD_TREE_TRIGGERED });
}
void HandleScript(SpellEffIndex /*effIndex*/)
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp
index e449f19681f..91218ae09c8 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp
@@ -16,9 +16,10 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "hyjal.h"
#include "hyjal_trash.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
enum Spells
{
@@ -48,7 +49,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_azgalorAI>(creature);
+ return GetHyjalAI<boss_azgalorAI>(creature);
}
struct boss_azgalorAI : public hyjal_trashAI
@@ -190,7 +191,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_lesser_doomguardAI>(creature);
+ return GetHyjalAI<npc_lesser_doomguardAI>(creature);
}
struct npc_lesser_doomguardAI : public hyjal_trashAI
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp
index 51b32c2f20f..15ecb603ddd 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp
@@ -16,11 +16,12 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "SpellAuraEffects.h"
-#include "SpellScript.h"
#include "hyjal.h"
#include "hyjal_trash.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
+#include "SpellAuraEffects.h"
+#include "SpellScript.h"
enum Spells
{
@@ -49,7 +50,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_kazrogalAI>(creature);
+ return GetHyjalAI<boss_kazrogalAI>(creature);
}
struct boss_kazrogalAI : public hyjal_trashAI
@@ -206,9 +207,7 @@ class spell_mark_of_kazrogal : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_MARK_DAMAGE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_MARK_DAMAGE });
}
void OnPeriodic(AuraEffect const* aurEff)
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp
index b6891597076..42916c45218 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp
@@ -16,9 +16,10 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "hyjal.h"
#include "hyjal_trash.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
enum Spells
{
@@ -44,7 +45,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_rage_winterchillAI>(creature);
+ return GetHyjalAI<boss_rage_winterchillAI>(creature);
}
struct boss_rage_winterchillAI : public hyjal_trashAI
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp
index 6c22a3c716e..40f5b3673e9 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp
@@ -30,11 +30,11 @@ npc_tyrande_whisperwind
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
#include "hyjalAI.h"
-#include "Player.h"
+#include "InstanceScript.h"
#include "Log.h"
+#include "Player.h"
+#include "ScriptedGossip.h"
#define GOSSIP_ITEM_BEGIN_ALLY "My companions and I are with you, Lady Proudmoore."
#define GOSSIP_ITEM_ANETHERON "We are ready for whatever Archimonde might send our way, Lady Proudmoore."
@@ -103,27 +103,27 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- if (!creature->GetInstanceScript())
- return NULL;
-
- hyjalAI* ai = new hyjalAI(creature);
+ if (hyjalAI* ai = GetHyjalAI<hyjalAI>(creature))
+ {
+ ai->Reset();
+ ai->EnterEvadeMode();
- ai->Reset();
- ai->EnterEvadeMode();
+ ai->Spells[0].SpellId = SPELL_BLIZZARD;
+ ai->Spells[0].Cooldown = urand(15000, 35000);
+ ai->Spells[0].TargetType = TARGETTYPE_RANDOM;
- ai->Spells[0].SpellId = SPELL_BLIZZARD;
- ai->Spells[0].Cooldown = urand(15000, 35000);
- ai->Spells[0].TargetType = TARGETTYPE_RANDOM;
+ ai->Spells[1].SpellId = SPELL_PYROBLAST;
+ ai->Spells[1].Cooldown = urand(5500, 9500);
+ ai->Spells[1].TargetType = TARGETTYPE_RANDOM;
- ai->Spells[1].SpellId = SPELL_PYROBLAST;
- ai->Spells[1].Cooldown = urand(5500, 9500);
- ai->Spells[1].TargetType = TARGETTYPE_RANDOM;
+ ai->Spells[2].SpellId = SPELL_SUMMON_ELEMENTALS;
+ ai->Spells[2].Cooldown = urand(15000, 45000);
+ ai->Spells[2].TargetType = TARGETTYPE_SELF;
- ai->Spells[2].SpellId = SPELL_SUMMON_ELEMENTALS;
- ai->Spells[2].Cooldown = urand(15000, 45000);
- ai->Spells[2].TargetType = TARGETTYPE_SELF;
+ return ai;
+ }
- return ai;
+ return nullptr;
}
};
@@ -188,23 +188,23 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- if (!creature->GetInstanceScript())
- return NULL;
-
- hyjalAI* ai = new hyjalAI(creature);
+ if (hyjalAI* ai = GetHyjalAI<hyjalAI>(creature))
+ {
+ ai->Reset();
+ ai->EnterEvadeMode();
- ai->Reset();
- ai->EnterEvadeMode();
+ ai->Spells[0].SpellId = SPELL_CHAIN_LIGHTNING;
+ ai->Spells[0].Cooldown = urand(3000, 8000);
+ ai->Spells[0].TargetType = TARGETTYPE_VICTIM;
- ai->Spells[0].SpellId = SPELL_CHAIN_LIGHTNING;
- ai->Spells[0].Cooldown = urand(3000, 8000);
- ai->Spells[0].TargetType = TARGETTYPE_VICTIM;
+ ai->Spells[1].SpellId = SPELL_SUMMON_DIRE_WOLF;
+ ai->Spells[1].Cooldown = urand(6000, 41000);
+ ai->Spells[1].TargetType = TARGETTYPE_RANDOM;
- ai->Spells[1].SpellId = SPELL_SUMMON_DIRE_WOLF;
- ai->Spells[1].Cooldown = urand(6000, 41000);
- ai->Spells[1].TargetType = TARGETTYPE_RANDOM;
+ return ai;
+ }
- return ai;
+ return nullptr;
}
};
@@ -216,13 +216,14 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- if (!creature->GetInstanceScript())
- return NULL;
+ if (hyjalAI* ai = GetHyjalAI<hyjalAI>(creature))
+ {
+ ai->Reset();
+ ai->EnterEvadeMode();
+ return ai;
+ }
- hyjalAI* ai = new hyjalAI(creature);
- ai->Reset();
- ai->EnterEvadeMode();
- return ai;
+ return nullptr;
}
bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) override
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.h b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.h
index caf7d690097..5a12cc0f6e3 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.h
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.h
@@ -19,6 +19,9 @@
#ifndef DEF_HYJAL_H
#define DEF_HYJAL_H
+#include "CreatureAIImpl.h"
+
+#define HyjalScriptName "instance_hyjal"
#define DataHeader "HY"
uint32 const EncounterCount = 5;
@@ -93,4 +96,10 @@ enum HYGameobjectIds
#define MINRAIDDAMAGE 700000 // minimal damage before trash can drop loot and reputation, resets if faction leader dies
+template<typename AI>
+inline AI* GetHyjalAI(Creature* creature)
+{
+ return GetInstanceAI<AI>(creature, HyjalScriptName);
+}
+
#endif
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp
index 52db6e7d9ba..6479dd2cdfe 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp
@@ -24,15 +24,14 @@ SDCategory: Caverns of Time, Mount Hyjal
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedEscortAI.h"
-#include "GridNotifiers.h"
-#include "GridNotifiersImpl.h"
-#include "Cell.h"
#include "CellImpl.h"
-#include "Log.h"
-#include "hyjalAI.h"
+#include "GridNotifiersImpl.h"
#include "hyjal_trash.h"
+#include "hyjalAI.h"
+#include "InstanceScript.h"
+#include "Log.h"
+#include "ObjectAccessor.h"
+#include "TemporarySummon.h"
enum Spawns
{
@@ -651,7 +650,7 @@ void hyjalAI::SpawnVeins()
return;
for (uint8 i = 0; i < 7; ++i)
{
- GameObject* gem = me->SummonGameObject(GO_ANCIENT_VEIN, VeinPos[i][0], VeinPos[i][1], VeinPos[i][2], VeinPos[i][3], G3D::Quat(VeinPos[i][4], VeinPos[i][5], VeinPos[i][6], VeinPos[i][7]), 0);
+ GameObject* gem = me->SummonGameObject(GO_ANCIENT_VEIN, VeinPos[i][0], VeinPos[i][1], VeinPos[i][2], VeinPos[i][3], QuaternionData(VeinPos[i][4], VeinPos[i][5], VeinPos[i][6], VeinPos[i][7]), 0);
if (gem)
VeinGUID[i]=gem->GetGUID();
}
@@ -663,7 +662,7 @@ void hyjalAI::SpawnVeins()
return;
for (uint8 i = 7; i < 14; ++i)
{
- GameObject* gem = me->SummonGameObject(GO_ANCIENT_VEIN, VeinPos[i][0], VeinPos[i][1], VeinPos[i][2], VeinPos[i][3], G3D::Quat(VeinPos[i][4], VeinPos[i][5], VeinPos[i][6], VeinPos[i][7]), 0);
+ GameObject* gem = me->SummonGameObject(GO_ANCIENT_VEIN, VeinPos[i][0], VeinPos[i][1], VeinPos[i][2], VeinPos[i][3], QuaternionData(VeinPos[i][4], VeinPos[i][5], VeinPos[i][6], VeinPos[i][7]), 0);
if (gem)
VeinGUID[i] = gem->GetGUID();
}
@@ -726,7 +725,7 @@ void hyjalAI::UpdateAI(uint32 diff)
HideNearPos(me->GetPositionX(), me->GetPositionY());
HideNearPos(5037.76f, -1889.71f);
for (uint8 i = 0; i < 92; ++i)//summon fires
- me->SummonGameObject(GO_ROARING_FLAME, AllianceFirePos[i][0], AllianceFirePos[i][1], AllianceFirePos[i][2], AllianceFirePos[i][3], G3D::Quat(AllianceFirePos[i][4], AllianceFirePos[i][5], AllianceFirePos[i][6], AllianceFirePos[i][7]), 0);
+ me->SummonGameObject(GO_ROARING_FLAME, AllianceFirePos[i][0], AllianceFirePos[i][1], AllianceFirePos[i][2], AllianceFirePos[i][3], QuaternionData(AllianceFirePos[i][4], AllianceFirePos[i][5], AllianceFirePos[i][6], AllianceFirePos[i][7]), 0);
}
else me->SetVisible(true);
@@ -739,7 +738,7 @@ void hyjalAI::UpdateAI(uint32 diff)
HideNearPos(5563, -2763.19f);
HideNearPos(5542.2f, -2629.36f);
for (uint8 i = 0; i < 65; ++i)//summon fires
- me->SummonGameObject(GO_ROARING_FLAME, HordeFirePos[i][0], HordeFirePos[i][1], HordeFirePos[i][2], HordeFirePos[i][3], G3D::Quat(HordeFirePos[i][4], HordeFirePos[i][5], HordeFirePos[i][6], HordeFirePos[i][7]), 0);
+ me->SummonGameObject(GO_ROARING_FLAME, HordeFirePos[i][0], HordeFirePos[i][1], HordeFirePos[i][2], HordeFirePos[i][3], QuaternionData(HordeFirePos[i][4], HordeFirePos[i][5], HordeFirePos[i][6], HordeFirePos[i][7]), 0);
}
else me->SetVisible(true);
@@ -1016,7 +1015,7 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff)
{
case 0://alliance
for (uint8 i = 0; i < 92; ++i)//summon fires
- me->SummonGameObject(GO_ROARING_FLAME, AllianceFirePos[i][0], AllianceFirePos[i][1], AllianceFirePos[i][2], AllianceFirePos[i][3], G3D::Quat(AllianceFirePos[i][4], AllianceFirePos[i][5], AllianceFirePos[i][6], AllianceFirePos[i][7]), 0);
+ me->SummonGameObject(GO_ROARING_FLAME, AllianceFirePos[i][0], AllianceFirePos[i][1], AllianceFirePos[i][2], AllianceFirePos[i][3], QuaternionData(AllianceFirePos[i][4], AllianceFirePos[i][5], AllianceFirePos[i][6], AllianceFirePos[i][7]), 0);
for (uint8 i = 0; i < 25; ++i)//summon 25 ghouls
{
@@ -1057,7 +1056,7 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff)
break;
case 1://horde
for (uint8 i = 0; i < 65; ++i)//summon fires
- me->SummonGameObject(GO_ROARING_FLAME, HordeFirePos[i][0], HordeFirePos[i][1], HordeFirePos[i][2], HordeFirePos[i][3], G3D::Quat(HordeFirePos[i][4], HordeFirePos[i][5], HordeFirePos[i][6], HordeFirePos[i][7]), 0);
+ me->SummonGameObject(GO_ROARING_FLAME, HordeFirePos[i][0], HordeFirePos[i][1], HordeFirePos[i][2], HordeFirePos[i][3], QuaternionData(HordeFirePos[i][4], HordeFirePos[i][5], HordeFirePos[i][6], HordeFirePos[i][7]), 0);
for (uint8 i = 0; i < 26; ++i)//summon infernals
{
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp
index bc204ed6c53..32b90c6bfc9 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp
@@ -16,10 +16,12 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "hyjal.h"
#include "hyjal_trash.h"
#include "hyjalAI.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
+#include "TemporarySummon.h"
enum Spells
{
@@ -523,7 +525,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_giant_infernalAI>(creature);
+ return GetHyjalAI<npc_giant_infernalAI>(creature);
}
};
@@ -534,7 +536,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_abominationAI>(creature);
+ return GetHyjalAI<npc_abominationAI>(creature);
}
struct npc_abominationAI : public hyjal_trashAI
@@ -629,7 +631,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_ghoulAI>(creature);
+ return GetHyjalAI<npc_ghoulAI>(creature);
}
struct npc_ghoulAI : public hyjal_trashAI
@@ -728,7 +730,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_necromancerAI>(creature);
+ return GetHyjalAI<npc_necromancerAI>(creature);
}
struct npc_necromancerAI : public hyjal_trashAI
@@ -852,7 +854,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_bansheeAI>(creature);
+ return GetHyjalAI<npc_bansheeAI>(creature);
}
struct npc_bansheeAI : public hyjal_trashAI
@@ -952,7 +954,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_crypt_fiendAI>(creature);
+ return GetHyjalAI<npc_crypt_fiendAI>(creature);
}
struct npc_crypt_fiendAI : public hyjal_trashAI
@@ -1038,7 +1040,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_fel_stalkerAI>(creature);
+ return GetHyjalAI<npc_fel_stalkerAI>(creature);
}
struct npc_fel_stalkerAI : public hyjal_trashAI
@@ -1124,7 +1126,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_frost_wyrmAI>(creature);
+ return GetHyjalAI<npc_frost_wyrmAI>(creature);
}
struct npc_frost_wyrmAI : public hyjal_trashAI
@@ -1172,7 +1174,7 @@ public:
float x, y, z;
me->GetPosition(x, y, z);
- z = me->GetMap()->GetHeight(me->GetPhases(), x, y, z);
+ me->UpdateGroundPositionZ(x, y, z);
me->GetMotionMaster()->MovePoint(0, x, y, z);
me->SetPosition(x, y, z, 0);
}
@@ -1244,7 +1246,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_gargoyleAI>(creature);
+ return GetHyjalAI<npc_gargoyleAI>(creature);
}
struct npc_gargoyleAI : public hyjal_trashAI
@@ -1290,7 +1292,7 @@ public:
{
float x, y, z;
me->GetPosition(x, y, z);
- z = me->GetMap()->GetHeight(me->GetPhases(), x, y, z);
+ me->UpdateGroundPositionZ(x, y, z);
me->GetMotionMaster()->MovePoint(0, x, y, z);
me->SetPosition(x, y, z, 0);
hyjal_trashAI::JustDied(killer);
@@ -1382,7 +1384,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new alliance_riflemanAI(creature);
+ return GetHyjalAI<alliance_riflemanAI>(creature);
}
struct alliance_riflemanAI : public ScriptedAI
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp
index 39dfcabc6ea..8e7e0f4b246 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp
@@ -24,10 +24,13 @@ SDCategory: Caverns of Time, Mount Hyjal
EndScriptData */
#include "ScriptMgr.h"
-#include "InstanceScript.h"
-#include "ScriptedCreature.h"
+#include "Creature.h"
+#include "CreatureAI.h"
+#include "GameObject.h"
#include "hyjal.h"
+#include "InstanceScript.h"
#include "Log.h"
+#include "Map.h"
/* Battle of Mount Hyjal encounters:
0 - Rage Winterchill event
@@ -51,7 +54,7 @@ ObjectData const creatureData[] =
class instance_hyjal : public InstanceMapScript
{
public:
- instance_hyjal() : InstanceMapScript("instance_hyjal", 534) { }
+ instance_hyjal() : InstanceMapScript(HyjalScriptName, 534) { }
InstanceScript* GetInstanceScript(InstanceMap* map) const override
{
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_chrono_lord_epoch.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_chrono_lord_epoch.cpp
index 93fc93f348e..470d5f7f90c 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_chrono_lord_epoch.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_chrono_lord_epoch.cpp
@@ -24,8 +24,8 @@ SDCategory:
Script Data End */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "culling_of_stratholme.h"
+#include "ScriptedCreature.h"
enum Spells
{
@@ -114,7 +114,7 @@ class boss_epoch : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_epochAI>(creature);
+ return GetCullingOfStratholmeAI<boss_epochAI>(creature);
}
};
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_infinite_corruptor.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_infinite_corruptor.cpp
index 1a7452732f9..5ea544a3f1b 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_infinite_corruptor.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_infinite_corruptor.cpp
@@ -16,8 +16,8 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "culling_of_stratholme.h"
+#include "ScriptedCreature.h"
enum Spells
{
@@ -104,7 +104,7 @@ class boss_infinite_corruptor : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_infinite_corruptorAI>(creature);
+ return GetCullingOfStratholmeAI<boss_infinite_corruptorAI>(creature);
}
};
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp
index 1c05b82d06b..1e24c9780e6 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp
@@ -24,9 +24,11 @@ SDCategory:
Script Data End */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "culling_of_stratholme.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "ScriptedCreature.h"
enum Spells
{
@@ -64,7 +66,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_mal_ganisAI>(creature);
+ return GetCullingOfStratholmeAI<boss_mal_ganisAI>(creature);
}
struct boss_mal_ganisAI : public ScriptedAI
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp
index e4252ab7e7a..11de41f5c74 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp
@@ -16,8 +16,8 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "culling_of_stratholme.h"
+#include "ScriptedCreature.h"
enum Spells
{
@@ -99,7 +99,7 @@ class boss_meathook : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_meathookAI>(creature);
+ return GetCullingOfStratholmeAI<boss_meathookAI>(creature);
}
};
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm_the_fleshcrafter.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm_the_fleshcrafter.cpp
index cb512c02cf4..3030f50a74c 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm_the_fleshcrafter.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm_the_fleshcrafter.cpp
@@ -16,8 +16,8 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "culling_of_stratholme.h"
+#include "ScriptedCreature.h"
enum Spells
{
@@ -120,7 +120,7 @@ class boss_salramm : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_salrammAI>(creature);
+ return GetCullingOfStratholmeAI<boss_salrammAI>(creature);
}
};
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp
index 9de4194c733..f28c9e06e79 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp
@@ -16,13 +16,16 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
#include "culling_of_stratholme.h"
-#include "ScriptedEscortAI.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
#include "PassiveAI.h"
#include "Player.h"
+#include "ScriptedEscortAI.h"
+#include "ScriptedGossip.h"
#include "SpellInfo.h"
+#include "TemporarySummon.h"
enum Says
{
@@ -343,7 +346,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_arthasAI>(creature);
+ return GetCullingOfStratholmeAI<npc_arthasAI>(creature);
}
struct npc_arthasAI : public npc_escortAI
@@ -1256,7 +1259,7 @@ class npc_crate_helper : public CreatureScript
instance->SetData(DATA_CRATE_COUNT, instance->GetData(DATA_CRATE_COUNT) + 1);
if (GameObject* crate = me->FindNearestGameObject(GO_SUSPICIOUS_CRATE, 5.0f))
{
- crate->SummonGameObject(GO_PLAGUED_CRATE, *crate, G3D::Quat(), DAY);
+ crate->SummonGameObject(GO_PLAGUED_CRATE, *crate, QuaternionData(), DAY);
crate->Delete();
}
}
@@ -1268,7 +1271,7 @@ class npc_crate_helper : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_crate_helperAI(creature);
+ return GetCullingOfStratholmeAI<npc_crate_helperAI>(creature);
}
};
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.h b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.h
index 0cd1a7a6459..b6c93aa939e 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.h
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.h
@@ -18,8 +18,11 @@
#ifndef DEF_CULLING_OF_STRATHOLME_H
#define DEF_CULLING_OF_STRATHOLME_H
-#define DataHeader "CS"
+#include "CreatureAIImpl.h"
+
#define CoSScriptName "instance_culling_of_stratholme"
+#define DataHeader "CS"
+
uint32 const EncounterCount = 5;
enum CSDataTypes
@@ -100,4 +103,10 @@ enum CSInstanceEvents
EVENT_INFINITE_TIMER = 1
};
+template<typename AI>
+inline AI* GetCullingOfStratholmeAI(Creature* creature)
+{
+ return GetInstanceAI<AI>(creature, CoSScriptName);
+}
+
#endif
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp
index 116a04e4291..ef56283f024 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp
@@ -16,12 +16,15 @@
*/
#include "ScriptMgr.h"
-#include "InstanceScript.h"
-#include "CreatureTextMgr.h"
+#include "Creature.h"
+#include "CreatureAI.h"
#include "culling_of_stratholme.h"
-#include "Player.h"
+#include "EventMap.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "Map.h"
#include "TemporarySummon.h"
-#include "SpellInfo.h"
+#include "WorldStatePackets.h"
/* Culling of Stratholme encounters:
0 - Meathook
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp
index e23d81aab67..be1e8eefc73 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp
@@ -24,8 +24,9 @@ SDCategory: Caverns of Time, Old Hillsbrad Foothills
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "InstanceScript.h"
#include "old_hillsbrad.h"
+#include "ScriptedCreature.h"
/*######################
# boss_captain_skarloc #
@@ -54,7 +55,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_captain_skarlocAI>(creature);
+ return GetOldHillsbradAI<boss_captain_skarlocAI>(creature);
}
struct boss_captain_skarlocAI : public ScriptedAI
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp
index 2625434b09a..06b876a3f92 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp
@@ -24,8 +24,9 @@ SDCategory: Caverns of Time, Old Hillsbrad Foothills
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "InstanceScript.h"
#include "old_hillsbrad.h"
+#include "ScriptedCreature.h"
/*###################
# boss_epoch_hunter #
@@ -52,7 +53,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_epoch_hunterAI>(creature);
+ return GetOldHillsbradAI<boss_epoch_hunterAI>(creature);
}
struct boss_epoch_hunterAI : public ScriptedAI
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp
index f3b302497da..f5b2743b487 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp
@@ -24,7 +24,8 @@ SDCategory: Caverns of Time, Old Hillsbrad Foothills
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
#include "old_hillsbrad.h"
#include "ScriptedEscortAI.h"
@@ -101,7 +102,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_lieutenant_drakeAI(creature);
+ return GetOldHillsbradAI<boss_lieutenant_drakeAI>(creature);
}
struct boss_lieutenant_drakeAI : public ScriptedAI
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp
index ee798819ee6..01c3d39fbe0 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp
@@ -24,11 +24,12 @@ SDCategory: Caverns of Time, Old Hillsbrad Foothills
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "Creature.h"
#include "InstanceScript.h"
+#include "Log.h"
+#include "Map.h"
#include "old_hillsbrad.h"
#include "Player.h"
-#include "Log.h"
#define MAX_ENCOUNTER 6
@@ -44,7 +45,7 @@ EndScriptData */
class instance_old_hillsbrad : public InstanceMapScript
{
public:
- instance_old_hillsbrad() : InstanceMapScript("instance_old_hillsbrad", 560) { }
+ instance_old_hillsbrad() : InstanceMapScript(OHScriptName, 560) { }
InstanceScript* GetInstanceScript(InstanceMap* map) const override
{
@@ -74,14 +75,9 @@ public:
{
Map::PlayerList const& players = instance->GetPlayers();
- if (!players.isEmpty())
- {
- for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
- {
- if (Player* player = itr->GetSource())
- return player;
- }
- }
+ for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
+ if (Player* player = itr->GetSource())
+ return player;
TC_LOG_DEBUG("scripts", "Instance Old Hillsbrad: GetPlayerInMap, but PlayerList is empty!");
return NULL;
@@ -91,14 +87,9 @@ public:
{
Map::PlayerList const& players = instance->GetPlayers();
- if (!players.isEmpty())
- {
- for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
- {
- if (Player* player = itr->GetSource())
- player->KilledMonsterCredit(LODGE_QUEST_TRIGGER);
- }
- }
+ for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
+ if (Player* player = itr->GetSource())
+ player->KilledMonsterCredit(LODGE_QUEST_TRIGGER);
}
void OnCreatureCreate(Creature* creature) override
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp
index 898d780b8b0..c96aacef21b 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp
@@ -30,11 +30,12 @@ npc_taretha
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
-#include "ScriptedEscortAI.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
#include "old_hillsbrad.h"
#include "Player.h"
+#include "ScriptedEscortAI.h"
+#include "ScriptedGossip.h"
enum Erozion
{
@@ -187,7 +188,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_thrall_old_hillsbradAI>(creature);
+ return GetOldHillsbradAI<npc_thrall_old_hillsbradAI>(creature);
}
bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) override
@@ -565,7 +566,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_tarethaAI>(creature);
+ return GetOldHillsbradAI<npc_tarethaAI>(creature);
}
bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) override
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.h b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.h
index ac5abaf9fb8..b7f36987542 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.h
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.h
@@ -19,6 +19,9 @@
#ifndef DEF_OLD_HILLSBRAD_H
#define DEF_OLD_HILLSBRAD_H
+#include "CreatureAIImpl.h"
+
+#define OHScriptName "instance_old_hillsbrad"
#define DataHeader "OH"
enum OHDataTypes
@@ -41,5 +44,13 @@ enum OHWorldStateIds
WORLD_STATE_OH = 2436
};
+
+template<typename AI>
+inline AI* GetOldHillsbradAI(Creature* creature)
+{
+ return GetInstanceAI<AI>(creature, OHScriptName);
+}
+
+
#endif
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/boss_aeonus.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/boss_aeonus.cpp
index 17b51ddb22f..30e07fbbde5 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/boss_aeonus.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/boss_aeonus.cpp
@@ -24,6 +24,7 @@ Category: Caverns of Time, The Dark Portal
*/
#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "ScriptedCreature.h"
#include "the_black_morass.h"
@@ -141,7 +142,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_aeonusAI>(creature);
+ return GetBlackMorassAI<boss_aeonusAI>(creature);
}
};
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/boss_chrono_lord_deja.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/boss_chrono_lord_deja.cpp
index 55482fd37d6..f7fc518d2ef 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/boss_chrono_lord_deja.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/boss_chrono_lord_deja.cpp
@@ -24,6 +24,7 @@ Category: Caverns of Time, The Black Morass
*/
#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "ScriptedCreature.h"
#include "the_black_morass.h"
@@ -147,7 +148,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_chrono_lord_dejaAI>(creature);
+ return GetBlackMorassAI<boss_chrono_lord_dejaAI>(creature);
}
};
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/boss_temporus.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/boss_temporus.cpp
index 3ad05a79065..7006fcc4e50 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/boss_temporus.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/boss_temporus.cpp
@@ -24,6 +24,7 @@ Category: Caverns of Time, The Black Morass
*/
#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "ScriptedCreature.h"
#include "the_black_morass.h"
@@ -145,7 +146,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_temporusAI>(creature);
+ return GetBlackMorassAI<boss_temporusAI>(creature);
}
};
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/instance_the_black_morass.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/instance_the_black_morass.cpp
index 81990a81fb3..bc64a7bc959 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/instance_the_black_morass.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/instance_the_black_morass.cpp
@@ -24,13 +24,14 @@ Category: Caverns of Time, The Black Morass
*/
#include "ScriptMgr.h"
+#include "EventMap.h"
#include "InstanceScript.h"
-#include "the_black_morass.h"
+#include "Log.h"
+#include "Map.h"
#include "Player.h"
-#include "TemporarySummon.h"
#include "SpellInfo.h"
-#include "ScriptedCreature.h"
-#include "Log.h"
+#include "the_black_morass.h"
+#include "TemporarySummon.h"
enum Misc
{
@@ -72,7 +73,7 @@ enum EventIds
class instance_the_black_morass : public InstanceMapScript
{
public:
- instance_the_black_morass() : InstanceMapScript("instance_the_black_morass", 269) { }
+ instance_the_black_morass() : InstanceMapScript(TBMScriptName, 269) { }
InstanceScript* GetInstanceScript(InstanceMap* map) const override
{
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.cpp
index e164b6ca2fa..36ce378f575 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.cpp
@@ -30,12 +30,14 @@ npc_saat
EndContentData */
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "Log.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
-#include "the_black_morass.h"
-#include "Player.h"
#include "SpellInfo.h"
-#include "Log.h"
+#include "the_black_morass.h"
enum MedivhBm
{
@@ -71,7 +73,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_medivh_bmAI>(creature);
+ return GetBlackMorassAI<npc_medivh_bmAI>(creature);
}
struct npc_medivh_bmAI : public ScriptedAI
@@ -265,7 +267,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_time_riftAI>(creature);
+ return GetBlackMorassAI<npc_time_riftAI>(creature);
}
struct npc_time_riftAI : public ScriptedAI
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.h b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.h
index db477757f09..5423058685a 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.h
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.h
@@ -19,6 +19,9 @@
#ifndef DEF_THEBLACKMORASS_H
#define DEF_THEBLACKMORASS_H
+#include "CreatureAIImpl.h"
+
+#define TBMScriptName "instance_the_black_morass"
#define DataHeader "TBM"
uint32 const EncounterCount = 2;
@@ -65,5 +68,11 @@ enum TBMCreatureIds
NPC_INFINITE_VANQUISHER = 18995
};
+template<typename AI>
+inline AI* GetBlackMorassAI(Creature* creature)
+{
+ return GetInstanceAI<AI>(creature, TBMScriptName);
+}
+
#endif
diff --git a/src/server/scripts/Kalimdor/DireMaul/instance_dire_maul.cpp b/src/server/scripts/Kalimdor/DireMaul/instance_dire_maul.cpp
index 22ee9fb6bea..f997bcf7460 100644
--- a/src/server/scripts/Kalimdor/DireMaul/instance_dire_maul.cpp
+++ b/src/server/scripts/Kalimdor/DireMaul/instance_dire_maul.cpp
@@ -24,6 +24,7 @@ gets instead the deserter debuff.
#include "ScriptMgr.h"
#include "InstanceScript.h"
+#include "Map.h"
// Bosses (East)
// 0 - Pusillin
diff --git a/src/server/scripts/Kalimdor/Firelands/boss_alysrazor.cpp b/src/server/scripts/Kalimdor/Firelands/boss_alysrazor.cpp
index d6933f03032..508b010542e 100644
--- a/src/server/scripts/Kalimdor/Firelands/boss_alysrazor.cpp
+++ b/src/server/scripts/Kalimdor/Firelands/boss_alysrazor.cpp
@@ -15,17 +15,17 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ObjectMgr.h"
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "PassiveAI.h"
-#include "SpellScript.h"
-#include "MoveSplineInit.h"
-#include "Cell.h"
#include "CellImpl.h"
-#include "GridNotifiers.h"
-#include "GridNotifiersImpl.h"
+#include "DB2Stores.h"
#include "firelands.h"
+#include "GridNotifiersImpl.h"
+#include "ObjectAccessor.h"
+#include "PassiveAI.h"
+#include "ScriptedCreature.h"
+#include "SpellInfo.h"
+#include "SpellScript.h"
+#include "TemporarySummon.h"
enum Texts
{
@@ -245,7 +245,7 @@ class npc_harbinger_of_flame : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_harbinger_of_flameAI(creature);
+ return GetFirelandsAI<npc_harbinger_of_flameAI>(creature);
}
};
@@ -347,7 +347,7 @@ class npc_blazing_monstrosity : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_blazing_monstrosityAI(creature);
+ return GetFirelandsAI<npc_blazing_monstrosityAI>(creature);
}
};
@@ -387,7 +387,7 @@ class npc_molten_barrage : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_molten_barrageAI(creature);
+ return GetFirelandsAI<npc_molten_barrageAI>(creature);
}
};
@@ -490,7 +490,7 @@ class npc_egg_pile : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_egg_pileAI(creature);
+ return GetFirelandsAI<npc_egg_pileAI>(creature);
}
};
@@ -541,17 +541,14 @@ class spell_alysrazor_turn_monstrosity : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_GENERIC_DUMMY_CAST))
- return false;
- if (!sSpellMgr->GetSpellInfo(SPELL_KNOCKBACK_RIGHT))
- return false;
- if (!sSpellMgr->GetSpellInfo(SPELL_KNOCKBACK_LEFT))
- return false;
- if (!sSpellMgr->GetSpellInfo(SPELL_KNOCKBACK_FORWARD))
- return false;
- if (!sSpellMgr->GetSpellInfo(SPELL_KNOCKBACK_BACK))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_GENERIC_DUMMY_CAST,
+ SPELL_KNOCKBACK_RIGHT,
+ SPELL_KNOCKBACK_LEFT,
+ SPELL_KNOCKBACK_FORWARD,
+ SPELL_KNOCKBACK_BACK
+ });
}
void KnockBarrage(SpellEffIndex effIndex)
@@ -670,9 +667,7 @@ class spell_alysrazor_fieroblast : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_FIRE_IT_UP))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_FIRE_IT_UP });
}
void FireItUp()
diff --git a/src/server/scripts/Kalimdor/Firelands/firelands.cpp b/src/server/scripts/Kalimdor/Firelands/firelands.cpp
new file mode 100644
index 00000000000..092ff5c3b2a
--- /dev/null
+++ b/src/server/scripts/Kalimdor/Firelands/firelands.cpp
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2008-2017 TrinityCore <http://www.trinitycore.org/>
+ *
+ * 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 2 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/>.
+ */
+
+#include "firelands.h"
+#include "Creature.h"
+#include "CreatureAI.h"
+
+bool DelayedAttackStartEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
+{
+ _owner->AI()->DoZoneInCombat(_owner, 200.0f);
+ return true;
+}
diff --git a/src/server/scripts/Kalimdor/Firelands/firelands.h b/src/server/scripts/Kalimdor/Firelands/firelands.h
index d160bbdef65..59fa43baeec 100644
--- a/src/server/scripts/Kalimdor/Firelands/firelands.h
+++ b/src/server/scripts/Kalimdor/Firelands/firelands.h
@@ -18,8 +18,10 @@
#ifndef FIRELANDS_H_
#define FIRELANDS_H_
-#include "Map.h"
-#include "CreatureAI.h"
+#include "CreatureAIImpl.h"
+#include "EventProcessor.h"
+
+class Creature;
#define DataHeader "FL"
#define FirelandsScriptName "instance_firelands"
@@ -52,24 +54,16 @@ class DelayedAttackStartEvent : public BasicEvent
public:
DelayedAttackStartEvent(Creature* owner) : _owner(owner) { }
- bool Execute(uint64 /*e_time*/, uint32 /*p_time*/) override
- {
- _owner->AI()->DoZoneInCombat(_owner, 200.0f);
- return true;
- }
+ bool Execute(uint64 /*e_time*/, uint32 /*p_time*/) override;
private:
Creature* _owner;
};
-template<class AI>
-CreatureAI* GetFirelandsAI(Creature* creature)
+template<typename AI>
+inline AI* GetFirelandsAI(Creature* creature)
{
- if (InstanceMap* instance = creature->GetMap()->ToInstanceMap())
- if (instance->GetInstanceScript())
- if (instance->GetScriptId() == sObjectMgr->GetScriptId(FirelandsScriptName))
- return new AI(creature);
- return NULL;
+ return GetInstanceAI<AI>(creature, FirelandsScriptName);
}
#endif // FIRELANDS_H_
diff --git a/src/server/scripts/Kalimdor/Firelands/instance_firelands.cpp b/src/server/scripts/Kalimdor/Firelands/instance_firelands.cpp
index e5edb9af6fa..da1fe55d2a5 100644
--- a/src/server/scripts/Kalimdor/Firelands/instance_firelands.cpp
+++ b/src/server/scripts/Kalimdor/Firelands/instance_firelands.cpp
@@ -16,8 +16,10 @@
*/
#include "ScriptMgr.h"
-#include "InstanceScript.h"
+#include "Creature.h"
#include "firelands.h"
+#include "InstanceScript.h"
+#include "Map.h"
class instance_firelands : public InstanceMapScript
{
diff --git a/src/server/scripts/Kalimdor/HallsOfOrigination/boss_anraphet.cpp b/src/server/scripts/Kalimdor/HallsOfOrigination/boss_anraphet.cpp
index 9e0c6a12e17..9efa74edd4f 100644
--- a/src/server/scripts/Kalimdor/HallsOfOrigination/boss_anraphet.cpp
+++ b/src/server/scripts/Kalimdor/HallsOfOrigination/boss_anraphet.cpp
@@ -15,15 +15,15 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ObjectMgr.h"
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "SpellScript.h"
-#include "SpellAuraEffects.h"
#include "GridNotifiers.h"
-#include "Player.h"
-#include "ObjectAccessor.h"
#include "halls_of_origination.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
+#include "ScriptedCreature.h"
+#include "SpellAuraEffects.h"
+#include "SpellScript.h"
enum Texts
{
@@ -289,7 +289,7 @@ class npc_omega_stance : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_omega_stanceAI(creature);
+ return GetHallsOfOriginationAI<npc_omega_stanceAI>(creature);
}
};
diff --git a/src/server/scripts/Kalimdor/HallsOfOrigination/boss_earthrager_ptah.cpp b/src/server/scripts/Kalimdor/HallsOfOrigination/boss_earthrager_ptah.cpp
index 587c210bf50..bdf4e6e3c0a 100644
--- a/src/server/scripts/Kalimdor/HallsOfOrigination/boss_earthrager_ptah.cpp
+++ b/src/server/scripts/Kalimdor/HallsOfOrigination/boss_earthrager_ptah.cpp
@@ -15,15 +15,15 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ObjectMgr.h"
#include "ScriptMgr.h"
+#include "halls_of_origination.h"
+#include "InstanceScript.h"
+#include "Player.h"
#include "ScriptedCreature.h"
-#include "SpellScript.h"
#include "SpellAuraEffects.h"
-#include "Player.h"
+#include "SpellScript.h"
+#include "TemporarySummon.h"
#include "Weather.h"
-#include "WorldSession.h"
-#include "halls_of_origination.h"
enum Texts
{
@@ -107,6 +107,7 @@ public:
for (std::list<Creature*>::iterator itr = units.begin(); itr != units.end(); ++itr)
(*itr)->DespawnOrUnsummon();
+ units.clear();
GetCreatureListWithEntryInGrid(units, me, NPC_JEWELED_SCARAB, 100.0f);
for (std::list<Creature*>::iterator itr = units.begin(); itr != units.end(); ++itr)
(*itr)->DespawnOrUnsummon();
diff --git a/src/server/scripts/Kalimdor/HallsOfOrigination/boss_temple_guardian_anhuur.cpp b/src/server/scripts/Kalimdor/HallsOfOrigination/boss_temple_guardian_anhuur.cpp
index 0aa63f2811b..c8c4c57bac7 100644
--- a/src/server/scripts/Kalimdor/HallsOfOrigination/boss_temple_guardian_anhuur.cpp
+++ b/src/server/scripts/Kalimdor/HallsOfOrigination/boss_temple_guardian_anhuur.cpp
@@ -15,14 +15,15 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ObjectMgr.h"
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "SpellScript.h"
-#include "SpellAuraEffects.h"
#include "GridNotifiers.h"
-#include "Player.h"
#include "halls_of_origination.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
+#include "ScriptedCreature.h"
+#include "SpellAuraEffects.h"
+#include "SpellScript.h"
enum Texts
{
diff --git a/src/server/scripts/Kalimdor/HallsOfOrigination/halls_of_origination.h b/src/server/scripts/Kalimdor/HallsOfOrigination/halls_of_origination.h
index 9a252662e9e..43b54694841 100644
--- a/src/server/scripts/Kalimdor/HallsOfOrigination/halls_of_origination.h
+++ b/src/server/scripts/Kalimdor/HallsOfOrigination/halls_of_origination.h
@@ -18,6 +18,8 @@
#ifndef HALLS_OF_ORIGINATION_H
#define HALLS_OF_ORIGINATION_H
+#include "CreatureAIImpl.h"
+
#define DataHeader "HOO"
#define HoOScriptName "instance_halls_of_origination"
@@ -114,14 +116,10 @@ enum HOOGlobalActions
ACTION_OMEGA_TRIGGER,
};
-template<class AI>
-CreatureAI* GetHallsOfOriginationAI(Creature* creature)
+template<typename AI>
+inline AI* GetHallsOfOriginationAI(Creature* creature)
{
- if (InstanceMap* instance = creature->GetMap()->ToInstanceMap())
- if (instance->GetInstanceScript())
- if (instance->GetScriptId() == sObjectMgr->GetScriptId(HoOScriptName))
- return new AI(creature);
- return NULL;
+ return GetInstanceAI<AI>(creature, HoOScriptName);
}
#endif // HALLS_OF_ORIGINATION_H
diff --git a/src/server/scripts/Kalimdor/Maraudon/boss_landslide.cpp b/src/server/scripts/Kalimdor/Maraudon/boss_landslide.cpp
index 37f79658906..047f3ae9836 100644
--- a/src/server/scripts/Kalimdor/Maraudon/boss_landslide.cpp
+++ b/src/server/scripts/Kalimdor/Maraudon/boss_landslide.cpp
@@ -24,6 +24,7 @@ SDCategory: Maraudon
EndScriptData */
#include "ScriptMgr.h"
+#include "maraudon.h"
#include "ScriptedCreature.h"
enum Spells
@@ -40,7 +41,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_landslideAI(creature);
+ return GetMaraudonAI<boss_landslideAI>(creature);
}
struct boss_landslideAI : public ScriptedAI
diff --git a/src/server/scripts/Kalimdor/Maraudon/boss_noxxion.cpp b/src/server/scripts/Kalimdor/Maraudon/boss_noxxion.cpp
index 51065ed35d4..a163dea9765 100644
--- a/src/server/scripts/Kalimdor/Maraudon/boss_noxxion.cpp
+++ b/src/server/scripts/Kalimdor/Maraudon/boss_noxxion.cpp
@@ -24,6 +24,7 @@ SDCategory: Maraudon
EndScriptData */
#include "ScriptMgr.h"
+#include "maraudon.h"
#include "ScriptedCreature.h"
enum Spells
@@ -39,7 +40,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_noxxionAI(creature);
+ return GetMaraudonAI<boss_noxxionAI>(creature);
}
struct boss_noxxionAI : public ScriptedAI
diff --git a/src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp b/src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp
index e5b98337883..c8116fe027b 100644
--- a/src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp
+++ b/src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp
@@ -24,7 +24,7 @@ SDCategory: Maraudon
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "maraudon.h"
#include "ScriptedCreature.h"
enum Spells
@@ -42,7 +42,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_ptheradrasAI(creature);
+ return GetMaraudonAI<boss_ptheradrasAI>(creature);
}
struct boss_ptheradrasAI : public ScriptedAI
diff --git a/src/server/scripts/Kalimdor/Maraudon/instance_maraudon.cpp b/src/server/scripts/Kalimdor/Maraudon/instance_maraudon.cpp
index b3e3552b4d5..35d5760605f 100644
--- a/src/server/scripts/Kalimdor/Maraudon/instance_maraudon.cpp
+++ b/src/server/scripts/Kalimdor/Maraudon/instance_maraudon.cpp
@@ -24,11 +24,13 @@ gets instead the deserter debuff.
#include "ScriptMgr.h"
#include "InstanceScript.h"
+#include "Map.h"
+#include "maraudon.h"
class instance_maraudon : public InstanceMapScript
{
public:
- instance_maraudon() : InstanceMapScript("instance_maraudon", 349) { }
+ instance_maraudon() : InstanceMapScript(MaraudonScriptName, 349) { }
InstanceScript* GetInstanceScript(InstanceMap* map) const override
{
diff --git a/src/server/scripts/Kalimdor/Maraudon/maraudon.h b/src/server/scripts/Kalimdor/Maraudon/maraudon.h
new file mode 100644
index 00000000000..a60deb6b081
--- /dev/null
+++ b/src/server/scripts/Kalimdor/Maraudon/maraudon.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2008-2017 TrinityCore <http://www.trinitycore.org/>
+ *
+ * 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 2 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/>.
+ */
+
+#ifndef maraudon_h__
+#define maraudon_h__
+
+#include "CreatureAIImpl.h"
+
+#define MaraudonScriptName "instance_maraudon"
+
+template<typename AI>
+inline AI* GetMaraudonAI(Creature* creature)
+{
+ return GetInstanceAI<AI>(creature, MaraudonScriptName);
+}
+
+#endif // maraudon_h__
diff --git a/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp b/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp
index 1da2fcb45c3..049ab5ef45e 100644
--- a/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp
+++ b/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp
@@ -26,12 +26,14 @@ SDCategory: Onyxia's Lair
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "Cell.h"
#include "CellImpl.h"
-#include "GridNotifiers.h"
+#include "CreatureAIImpl.h"
#include "GridNotifiersImpl.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
#include "onyxias_lair.h"
+#include "ScriptedCreature.h"
+#include "TemporarySummon.h"
enum Yells
{
@@ -492,7 +494,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_onyxiaAI>(creature);
+ return GetInstanceAI<boss_onyxiaAI>(creature, OLScriptName);
}
};
diff --git a/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp b/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp
index a0dfec7d722..e7472e1abd4 100644
--- a/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp
+++ b/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp
@@ -23,11 +23,11 @@ SDCategory: Onyxia's Lair
EndScriptData */
#include "ScriptMgr.h"
-#include "InstanceScript.h"
-#include "Cell.h"
+#include "AreaBoundary.h"
#include "CellImpl.h"
-#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
+#include "InstanceScript.h"
+#include "Map.h"
#include "onyxias_lair.h"
#include "TemporarySummon.h"
@@ -39,7 +39,7 @@ BossBoundaryData const boundaries =
class instance_onyxias_lair : public InstanceMapScript
{
public:
- instance_onyxias_lair() : InstanceMapScript("instance_onyxias_lair", 249) { }
+ instance_onyxias_lair() : InstanceMapScript(OLScriptName, 249) { }
InstanceScript* GetInstanceScript(InstanceMap* map) const override
{
diff --git a/src/server/scripts/Kalimdor/OnyxiasLair/onyxias_lair.h b/src/server/scripts/Kalimdor/OnyxiasLair/onyxias_lair.h
index ba931c86ccd..d9d86dce711 100644
--- a/src/server/scripts/Kalimdor/OnyxiasLair/onyxias_lair.h
+++ b/src/server/scripts/Kalimdor/OnyxiasLair/onyxias_lair.h
@@ -18,6 +18,7 @@
#ifndef DEF_ONYXIAS_LAIR_H
#define DEF_ONYXIAS_LAIR_H
+#define OLScriptName "instance_onyxias_lair"
#define DataHeader "OL"
uint32 const EncounterCount = 1;
diff --git a/src/server/scripts/Kalimdor/RagefireChasm/instance_ragefire_chasm.cpp b/src/server/scripts/Kalimdor/RagefireChasm/instance_ragefire_chasm.cpp
index c49d6b296ec..ba00eb87728 100644
--- a/src/server/scripts/Kalimdor/RagefireChasm/instance_ragefire_chasm.cpp
+++ b/src/server/scripts/Kalimdor/RagefireChasm/instance_ragefire_chasm.cpp
@@ -24,6 +24,7 @@ gets instead the deserter debuff.
#include "ScriptMgr.h"
#include "InstanceScript.h"
+#include "Map.h"
class instance_ragefire_chasm : public InstanceMapScript
{
diff --git a/src/server/scripts/Kalimdor/RazorfenDowns/boss_amnennar_the_coldbringer.cpp b/src/server/scripts/Kalimdor/RazorfenDowns/boss_amnennar_the_coldbringer.cpp
index ffb75543d84..2c531662492 100644
--- a/src/server/scripts/Kalimdor/RazorfenDowns/boss_amnennar_the_coldbringer.cpp
+++ b/src/server/scripts/Kalimdor/RazorfenDowns/boss_amnennar_the_coldbringer.cpp
@@ -16,8 +16,8 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "razorfen_downs.h"
+#include "ScriptedCreature.h"
enum Say
{
@@ -151,7 +151,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_amnennar_the_coldbringerAI(creature);
+ return GetRazorfenDownsAI<boss_amnennar_the_coldbringerAI>(creature);
}
};
diff --git a/src/server/scripts/Kalimdor/RazorfenDowns/boss_glutton.cpp b/src/server/scripts/Kalimdor/RazorfenDowns/boss_glutton.cpp
index 553375db4f8..4cd75637854 100644
--- a/src/server/scripts/Kalimdor/RazorfenDowns/boss_glutton.cpp
+++ b/src/server/scripts/Kalimdor/RazorfenDowns/boss_glutton.cpp
@@ -16,8 +16,8 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "razorfen_downs.h"
+#include "ScriptedCreature.h"
enum Say
{
@@ -97,7 +97,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_gluttonAI(creature);
+ return GetRazorfenDownsAI<boss_gluttonAI>(creature);
}
};
diff --git a/src/server/scripts/Kalimdor/RazorfenDowns/boss_mordresh_fire_eye.cpp b/src/server/scripts/Kalimdor/RazorfenDowns/boss_mordresh_fire_eye.cpp
index 2f6e469f257..a2294e120b0 100644
--- a/src/server/scripts/Kalimdor/RazorfenDowns/boss_mordresh_fire_eye.cpp
+++ b/src/server/scripts/Kalimdor/RazorfenDowns/boss_mordresh_fire_eye.cpp
@@ -16,8 +16,8 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "razorfen_downs.h"
+#include "ScriptedCreature.h"
enum Say
{
@@ -129,7 +129,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_mordresh_fire_eyeAI(creature);
+ return GetRazorfenDownsAI<boss_mordresh_fire_eyeAI>(creature);
}
};
diff --git a/src/server/scripts/Kalimdor/RazorfenDowns/boss_tuten_kash.cpp b/src/server/scripts/Kalimdor/RazorfenDowns/boss_tuten_kash.cpp
index 2ad263d325b..c4b521a0130 100644
--- a/src/server/scripts/Kalimdor/RazorfenDowns/boss_tuten_kash.cpp
+++ b/src/server/scripts/Kalimdor/RazorfenDowns/boss_tuten_kash.cpp
@@ -16,8 +16,8 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "razorfen_downs.h"
+#include "ScriptedCreature.h"
enum Spells
{
@@ -100,7 +100,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_tuten_kashAI(creature);
+ return GetRazorfenDownsAI<boss_tuten_kashAI>(creature);
}
};
diff --git a/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp b/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp
index 24cb88a071c..d485d6f7802 100644
--- a/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp
+++ b/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp
@@ -28,14 +28,14 @@ npc_henry_stern
EndContentData */
#include "ScriptMgr.h"
+#include "CellImpl.h"
+#include "GridNotifiersImpl.h"
+#include "InstanceScript.h"
+#include "Player.h"
+#include "razorfen_downs.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
-#include "razorfen_downs.h"
-#include "Player.h"
-#include "GridNotifiers.h"
-#include "GridNotifiersImpl.h"
-#include "Cell.h"
-#include "CellImpl.h"
+#include "TemporarySummon.h"
/*###
## npc_belnistrasz for Quest 3525 "Extinguishing the Idol"
@@ -204,7 +204,7 @@ public:
case EVENT_COMPLETE:
{
DoCast(me, SPELL_IDOM_ROOM_CAMERA_SHAKE);
- me->SummonGameObject(GO_BELNISTRASZS_BRAZIER, 2577.196f, 947.0781f, 53.16757f, 2.356195f, G3D::Quat(0.f, 0.f, 0.9238796f, 0.3826832f), 3600);
+ me->SummonGameObject(GO_BELNISTRASZS_BRAZIER, 2577.196f, 947.0781f, 53.16757f, 2.356195f, QuaternionData(0.f, 0.f, 0.9238796f, 0.3826832f), 3600);
std::list<WorldObject*> ClusterList;
Trinity::AllWorldObjectsInRange objects(me, 50.0f);
Trinity::WorldObjectListSearcher<Trinity::AllWorldObjectsInRange> searcher(me, ClusterList, objects);
@@ -255,7 +255,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_belnistraszAI>(creature);
+ return GetRazorfenDownsAI<npc_belnistraszAI>(creature);
}
};
@@ -293,7 +293,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_idol_room_spawnerAI>(creature);
+ return GetRazorfenDownsAI<npc_idol_room_spawnerAI>(creature);
}
};
@@ -363,7 +363,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_tomb_creatureAI>(creature);
+ return GetRazorfenDownsAI<npc_tomb_creatureAI>(creature);
}
};
diff --git a/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.h b/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.h
index 2501b399d11..fd6f687afb3 100644
--- a/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.h
+++ b/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.h
@@ -18,6 +18,8 @@
#ifndef DEF_RAZORFEN_DOWNS_H
#define DEF_RAZORFEN_DOWNS_H
+#include "CreatureAIImpl.h"
+
#define RFDScriptName "instance_razorfen_downs"
#define DataHeader "RFD"
@@ -61,8 +63,8 @@ enum RFDGameObjectIds
GO_BELNISTRASZS_BRAZIER = 152097
};
-template<class AI>
-AI* GetRazorfenDownsAI(Creature* creature)
+template<typename AI>
+inline AI* GetRazorfenDownsAI(Creature* creature)
{
return GetInstanceAI<AI>(creature, RFDScriptName);
}
diff --git a/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp b/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp
index dc0bbd57255..8f704f906ce 100644
--- a/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp
+++ b/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp
@@ -24,17 +24,18 @@ SDCategory: Razorfen Kraul
EndScriptData */
#include "ScriptMgr.h"
+#include "GameObject.h"
#include "InstanceScript.h"
-#include "razorfen_kraul.h"
-#include "Player.h"
#include "Log.h"
+#include "Map.h"
+#include "razorfen_kraul.h"
#define WARD_KEEPERS_NR 2
class instance_razorfen_kraul : public InstanceMapScript
{
public:
- instance_razorfen_kraul() : InstanceMapScript("instance_razorfen_kraul", 47) { }
+ instance_razorfen_kraul() : InstanceMapScript(RFKScriptName, 47) { }
InstanceScript* GetInstanceScript(InstanceMap* map) const override
{
@@ -52,18 +53,6 @@ public:
ObjectGuid DoorWardGUID;
int WardKeeperDeath;
- Player* GetPlayerInMap()
- {
- Map::PlayerList const& players = instance->GetPlayers();
- for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
- {
- if (Player* player = itr->GetSource())
- return player;
- }
- TC_LOG_DEBUG("scripts", "Instance Razorfen Kraul: GetPlayerInMap, but PlayerList is empty!");
- return NULL;
- }
-
void OnGameObjectCreate(GameObject* go) override
{
switch (go->GetEntry())
diff --git a/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp b/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp
index 1cf97e8e6dc..c8ba60f7aef 100644
--- a/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp
+++ b/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp
@@ -17,11 +17,11 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedEscortAI.h"
-#include "razorfen_kraul.h"
-#include "Player.h"
+#include "GameObject.h"
#include "PetAI.h"
+#include "Player.h"
+#include "razorfen_kraul.h"
+#include "ScriptedEscortAI.h"
#include "SpellScript.h"
enum Willix
@@ -132,7 +132,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_willixAI(creature);
+ return GetRazorfenKraulAI<npc_willixAI>(creature);
}
};
@@ -151,7 +151,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_snufflenose_gopherAI(creature);
+ return GetRazorfenKraulAI<npc_snufflenose_gopherAI>(creature);
}
struct npc_snufflenose_gopherAI : public PetAI
diff --git a/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.h b/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.h
index 1de42a0bb3a..f8bb926baff 100644
--- a/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.h
+++ b/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.h
@@ -19,7 +19,17 @@
#ifndef DEF_RAZORFEN_KRAUL_H
#define DEF_RAZORFEN_KRAUL_H
+#include "CreatureAIImpl.h"
+
+#define RFKScriptName "instance_razorfen_kraul"
#define DataHeader "RFK"
#define EVENT_WARD_KEEPER 1
+
+template<typename AI>
+inline AI* GetRazorfenKraulAI(Creature* creature)
+{
+ return GetInstanceAI<AI>(creature, RFKScriptName);
+}
+
#endif
diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp
index 23247e0ba06..aa383be1443 100644
--- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp
+++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp
@@ -17,9 +17,11 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "Player.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "ObjectAccessor.h"
#include "ruins_of_ahnqiraj.h"
+#include "ScriptedCreature.h"
enum Spells
{
@@ -241,7 +243,7 @@ class boss_ayamiss : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_ayamissAI>(creature);
+ return GetAQ20AI<boss_ayamissAI>(creature);
}
};
@@ -259,14 +261,13 @@ class npc_hive_zara_larva : public CreatureScript
void MovementInform(uint32 type, uint32 id) override
{
- if (type == POINT_MOTION_TYPE)
- if (id == POINT_PARALYZE)
- if (Player* target = ObjectAccessor::GetPlayer(*me, _instance->GetGuidData(DATA_PARALYZED)))
+ if (type == POINT_MOTION_TYPE && id == POINT_PARALYZE)
+ if (Unit* target = ObjectAccessor::GetUnit(*me, _instance->GetGuidData(DATA_PARALYZED)))
+ if (target->GetTypeId() == TYPEID_PLAYER)
DoCast(target, SPELL_FEED); // Omnomnom
}
void MoveInLineOfSight(Unit* who) override
-
{
if (_instance->GetBossState(DATA_AYAMISS) == IN_PROGRESS)
return;
@@ -295,7 +296,7 @@ class npc_hive_zara_larva : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_hive_zara_larvaAI>(creature);
+ return GetAQ20AI<npc_hive_zara_larvaAI>(creature);
}
};
diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp
index 735463744d7..88097b1ec30 100644
--- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp
+++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp
@@ -17,9 +17,11 @@
*/
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
+#include "ruins_of_ahnqiraj.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
-#include "ruins_of_ahnqiraj.h"
enum Emotes
{
@@ -77,7 +79,7 @@ class boss_buru : public CreatureScript
BossAI::EnterEvadeMode(why);
for (ObjectGuid eggGuid : Eggs)
- if (Creature* egg = me->GetMap()->GetCreature(eggGuid))
+ if (Creature* egg = ObjectAccessor::GetCreature(*me, eggGuid))
egg->Respawn();
Eggs.clear();
@@ -161,7 +163,7 @@ class boss_buru : public CreatureScript
events.ScheduleEvent(EVENT_CREEPING_PLAGUE, 6000);
break;
case EVENT_RESPAWN_EGG:
- if (Creature* egg = me->GetMap()->GetCreature(*Eggs.begin()))
+ if (Creature* egg = ObjectAccessor::GetCreature(*me, Eggs.front()))
{
egg->Respawn();
Eggs.pop_front();
@@ -189,7 +191,7 @@ class boss_buru : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_buruAI(creature);
+ return GetAQ20AI<boss_buruAI>(creature);
}
};
@@ -208,7 +210,7 @@ class npc_buru_egg : public CreatureScript
void EnterCombat(Unit* attacker) override
{
- if (Creature* buru = me->GetMap()->GetCreature(_instance->GetGuidData(DATA_BURU)))
+ if (Creature* buru = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_BURU)))
if (!buru->IsInCombat())
buru->AI()->AttackStart(attacker);
}
@@ -216,7 +218,7 @@ class npc_buru_egg : public CreatureScript
void JustSummoned(Creature* who) override
{
if (who->GetEntry() == NPC_HATCHLING)
- if (Creature* buru = me->GetMap()->GetCreature(_instance->GetGuidData(DATA_BURU)))
+ if (Creature* buru = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_BURU)))
if (Unit* target = buru->AI()->SelectTarget(SELECT_TARGET_RANDOM))
who->AI()->AttackStart(target);
}
@@ -227,7 +229,7 @@ class npc_buru_egg : public CreatureScript
DoCastAOE(SPELL_EXPLODE_2, true); // Unknown purpose
DoCast(me, SPELL_SUMMON_HATCHLING, true);
- if (Creature* buru = me->GetMap()->GetCreature(_instance->GetGuidData(DATA_BURU)))
+ if (Creature* buru = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_BURU)))
if (boss_buru::boss_buruAI* buruAI = dynamic_cast<boss_buru::boss_buruAI*>(buru->AI()))
buruAI->ManageRespawn(me->GetGUID());
}
@@ -237,7 +239,7 @@ class npc_buru_egg : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_buru_eggAI>(creature);
+ return GetAQ20AI<npc_buru_eggAI>(creature);
}
};
diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp
index 1e8db0f104c..3d208c4fd1b 100644
--- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp
+++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp
@@ -15,11 +15,11 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ObjectMgr.h"
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ruins_of_ahnqiraj.h"
#include "CreatureTextMgr.h"
+#include "InstanceScript.h"
+#include "ruins_of_ahnqiraj.h"
+#include "ScriptedCreature.h"
enum Spells
{
@@ -83,7 +83,7 @@ class boss_kurinnaxx : public CreatureScript
void JustDied(Unit* /*killer*/) override
{
_JustDied();
- if (Creature* Ossirian = me->GetMap()->GetCreature(instance->GetGuidData(DATA_OSSIRIAN)))
+ if (Creature* Ossirian = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_OSSIRIAN)))
sCreatureTextMgr->SendChat(Ossirian, SAY_KURINAXX_DEATH, NULL, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_ZONE);
}
@@ -136,7 +136,7 @@ class boss_kurinnaxx : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_kurinnaxxAI>(creature);
+ return GetAQ20AI<boss_kurinnaxxAI>(creature);
}
};
diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp
index 9f214eb5e12..0c3dc662dde 100644
--- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp
+++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp
@@ -16,8 +16,8 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "ruins_of_ahnqiraj.h"
+#include "ScriptedCreature.h"
enum Texts
{
@@ -183,7 +183,7 @@ class boss_moam : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_moamAI(creature);
+ return GetAQ20AI<boss_moamAI>(creature);
}
};
diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp
index 8a111f1de10..beca6e88156 100644
--- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp
+++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp
@@ -15,14 +15,16 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "ScriptMgr.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
#include "MiscPackets.h"
#include "Player.h"
#include "ruins_of_ahnqiraj.h"
#include "ScriptedCreature.h"
-#include "ScriptMgr.h"
#include "SpellInfo.h"
+#include "TemporarySummon.h"
#include "Weather.h"
-#include "WorldPacket.h"
enum Texts
{
@@ -118,7 +120,8 @@ class boss_ossirian : public CreatureScript
if (spell->Id == SpellWeakness[i])
{
me->RemoveAurasDueToSpell(SPELL_SUPREME);
- ((TempSummon*)caster)->UnSummon();
+ if (Creature* creatureCaster = caster->ToCreature())
+ creatureCaster->DespawnOrUnsummon();
SpawnNextCrystal();
}
}
@@ -187,10 +190,10 @@ class boss_ossirian : public CreatureScript
if (CrystalIterator == NUM_CRYSTALS)
CrystalIterator = 0;
- if (Creature* Trigger = me->GetMap()->SummonCreature(NPC_OSSIRIAN_TRIGGER, CrystalCoordinates[CrystalIterator]))
+ if (Creature* Trigger = me->SummonCreature(NPC_OSSIRIAN_TRIGGER, CrystalCoordinates[CrystalIterator]))
{
TriggerGUID = Trigger->GetGUID();
- if (GameObject* Crystal = Trigger->SummonGameObject(GO_OSSIRIAN_CRYSTAL, CrystalCoordinates[CrystalIterator], G3D::Quat(), uint32(-1)))
+ if (GameObject* Crystal = Trigger->SummonGameObject(GO_OSSIRIAN_CRYSTAL, CrystalCoordinates[CrystalIterator], QuaternionData(), uint32(-1)))
{
CrystalGUID = Crystal->GetGUID();
++CrystalIterator;
@@ -269,7 +272,7 @@ class boss_ossirian : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_ossirianAI>(creature);
+ return GetAQ20AI<boss_ossirianAI>(creature);
}
};
diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_rajaxx.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_rajaxx.cpp
index 5fd456c0295..1ab55c301ba 100644
--- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_rajaxx.cpp
+++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_rajaxx.cpp
@@ -15,10 +15,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ObjectMgr.h"
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "ruins_of_ahnqiraj.h"
+#include "ScriptedCreature.h"
enum Yells
{
@@ -130,7 +129,7 @@ class boss_rajaxx : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_rajaxxAI(creature);
+ return GetAQ20AI<boss_rajaxxAI>(creature);
}
};
diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp
index 2c3e23f4dd4..8a24b8bdaf3 100644
--- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp
+++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp
@@ -16,13 +16,15 @@
*/
#include "ScriptMgr.h"
+#include "Creature.h"
#include "InstanceScript.h"
+#include "Map.h"
#include "ruins_of_ahnqiraj.h"
class instance_ruins_of_ahnqiraj : public InstanceMapScript
{
public:
- instance_ruins_of_ahnqiraj() : InstanceMapScript("instance_ruins_of_ahnqiraj", 509) { }
+ instance_ruins_of_ahnqiraj() : InstanceMapScript(AQ20ScriptName, 509) { }
struct instance_ruins_of_ahnqiraj_InstanceMapScript : public InstanceScript
{
diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/ruins_of_ahnqiraj.h b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/ruins_of_ahnqiraj.h
index 944c2768b9d..42da5d7cf7c 100644
--- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/ruins_of_ahnqiraj.h
+++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/ruins_of_ahnqiraj.h
@@ -18,6 +18,9 @@
#ifndef DEF_RUINS_OF_AHNQIRAJ_H
#define DEF_RUINS_OF_AHNQIRAJ_H
+#include "CreatureAIImpl.h"
+
+#define AQ20ScriptName "instance_ruins_of_ahnqiraj"
#define DataHeader "AQR"
enum AQRDataTypes
@@ -57,4 +60,10 @@ enum AQRGameObjectIds
GO_OSSIRIAN_CRYSTAL = 180619
};
+template<typename AI>
+inline AI* GetAQ20AI(Creature* creature)
+{
+ return GetInstanceAI<AI>(creature, AQ20ScriptName);
+}
+
#endif
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp
index 8fd8e42e554..5558fb1c70f 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp
@@ -24,8 +24,11 @@ SDCategory: Temple of Ahn'Qiraj
EndScriptData */
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
#include "temple_of_ahnqiraj.h"
+#include "TemporarySummon.h"
enum Spells
{
@@ -48,7 +51,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_kriAI>(creature);
+ return GetAQ40AI<boss_kriAI>(creature);
}
struct boss_kriAI : public ScriptedAI
@@ -147,7 +150,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_vemAI>(creature);
+ return GetAQ40AI<boss_vemAI>(creature);
}
struct boss_vemAI : public ScriptedAI
@@ -242,7 +245,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_yaujAI>(creature);
+ return GetAQ40AI<boss_yaujAI>(creature);
}
struct boss_yaujAI : public ScriptedAI
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp
index b77d317ba01..992d05720e1 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp
@@ -24,9 +24,13 @@ SDCategory: Temple of Ahn'Qiraj
EndScriptData */
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "MapReference.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
#include "temple_of_ahnqiraj.h"
-#include "Player.h"
+#include "TemporarySummon.h"
/*
* This is a 2 phases events. Here follows an explanation of the main events and transition between phases and sub-phases.
@@ -153,7 +157,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<eye_of_cthunAI>(creature);
+ return GetAQ40AI<eye_of_cthunAI>(creature);
}
struct eye_of_cthunAI : public ScriptedAI
@@ -453,7 +457,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<cthunAI>(creature);
+ return GetAQ40AI<cthunAI>(creature);
}
struct cthunAI : public ScriptedAI
@@ -891,7 +895,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new eye_tentacleAI(creature);
+ return GetAQ40AI<eye_tentacleAI>(creature);
}
struct eye_tentacleAI : public ScriptedAI
@@ -969,7 +973,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new claw_tentacleAI(creature);
+ return GetAQ40AI<claw_tentacleAI>(creature);
}
struct claw_tentacleAI : public ScriptedAI
@@ -1083,7 +1087,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new giant_claw_tentacleAI(creature);
+ return GetAQ40AI<giant_claw_tentacleAI>(creature);
}
struct giant_claw_tentacleAI : public ScriptedAI
@@ -1207,7 +1211,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new giant_eye_tentacleAI(creature);
+ return GetAQ40AI<giant_eye_tentacleAI>(creature);
}
struct giant_eye_tentacleAI : public ScriptedAI
@@ -1273,7 +1277,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new flesh_tentacleAI(creature);
+ return GetAQ40AI<flesh_tentacleAI>(creature);
}
struct flesh_tentacleAI : public ScriptedAI
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_fankriss.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_fankriss.cpp
index 011cf1509a5..e03bbe211c5 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_fankriss.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_fankriss.cpp
@@ -25,6 +25,8 @@ EndScriptData */
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
+#include "temple_of_ahnqiraj.h"
+#include "TemporarySummon.h"
#define SOUND_SENTENCE_YOU 8588
#define SOUND_SERVE_TO 8589
@@ -48,7 +50,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_fankrissAI(creature);
+ return GetAQ40AI<boss_fankrissAI>(creature);
}
struct boss_fankrissAI : public ScriptedAI
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_huhuran.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_huhuran.cpp
index 45a61cecd47..d0912023709 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_huhuran.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_huhuran.cpp
@@ -25,6 +25,7 @@ EndScriptData */
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
+#include "temple_of_ahnqiraj.h"
enum Huhuran
{
@@ -46,7 +47,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_huhuranAI(creature);
+ return GetAQ40AI<boss_huhuranAI>(creature);
}
struct boss_huhuranAI : public ScriptedAI
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp
index daf9e3eb535..3c9956adeae 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp
@@ -43,7 +43,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_ouroAI(creature);
+ return GetAQ40AI<boss_ouroAI>(creature);
}
struct boss_ouroAI : public ScriptedAI
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_sartura.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_sartura.cpp
index 006d6377b42..8d1e8ad302e 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_sartura.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_sartura.cpp
@@ -25,6 +25,7 @@ EndScriptData */
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
+#include "temple_of_ahnqiraj.h"
enum Sartura
{
@@ -48,7 +49,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_sarturaAI(creature);
+ return GetAQ40AI<boss_sarturaAI>(creature);
}
struct boss_sarturaAI : public ScriptedAI
@@ -198,7 +199,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_sartura_royal_guardAI(creature);
+ return GetAQ40AI<npc_sartura_royal_guardAI>(creature);
}
struct npc_sartura_royal_guardAI : public ScriptedAI
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp
index 1cbdaf7b18d..2163ea31ab2 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp
@@ -81,7 +81,7 @@ class boss_skeram : public CreatureScript
{
ScriptedAI::EnterEvadeMode(why);
if (me->IsSummon())
- ((TempSummon*)me)->UnSummon();
+ me->DespawnOrUnsummon();
}
void JustSummoned(Creature* creature) override
@@ -199,25 +199,10 @@ class boss_skeram : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_skeramAI(creature);
+ return GetAQ40AI<boss_skeramAI>(creature);
}
};
-class PlayerOrPetCheck
-{
- public:
- bool operator()(WorldObject* object) const
- {
- if (object->GetTypeId() == TYPEID_PLAYER)
- return false;
-
- if (Creature* creature = object->ToCreature())
- return !creature->IsPet();
-
- return true;
- }
-};
-
class spell_skeram_arcane_explosion : public SpellScriptLoader
{
public:
@@ -229,7 +214,10 @@ class spell_skeram_arcane_explosion : public SpellScriptLoader
void FilterTargets(std::list<WorldObject*>& targets)
{
- targets.remove_if(PlayerOrPetCheck());
+ targets.remove_if([](WorldObject* target)
+ {
+ return target->GetTypeId() != TYPEID_PLAYER && (target->GetTypeId() != TYPEID_UNIT || !target->ToUnit()->IsPet());
+ });
}
void Register() override
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp
index 924888219d0..c70bede36ed 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp
@@ -395,7 +395,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_veknilashAI>(creature);
+ return GetAQ40AI<boss_veknilashAI>(creature);
}
struct boss_veknilashAI : public boss_twinemperorsAI
@@ -483,7 +483,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_veklorAI>(creature);
+ return GetAQ40AI<boss_veklorAI>(creature);
}
struct boss_veklorAI : public boss_twinemperorsAI
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp
index 1d41e808bc9..c8102675ac5 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp
@@ -16,9 +16,12 @@
*/
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
#include "SpellInfo.h"
#include "temple_of_ahnqiraj.h"
+#include "TemporarySummon.h"
enum Spells
{
@@ -255,7 +258,7 @@ class boss_viscidus : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_viscidusAI(creature);
+ return GetAQ40AI<boss_viscidusAI>(creature);
}
};
@@ -272,10 +275,9 @@ class npc_glob_of_viscidus : public CreatureScript
{
InstanceScript* Instance = me->GetInstanceScript();
- if (Creature* Viscidus = me->GetMap()->GetCreature(Instance->GetGuidData(DATA_VISCIDUS)))
+ if (Creature* Viscidus = ObjectAccessor::GetCreature(*me, Instance->GetGuidData(DATA_VISCIDUS)))
{
- if (BossAI* ViscidusAI = dynamic_cast<BossAI*>(Viscidus->GetAI()))
- ViscidusAI->SummonedCreatureDespawn(me);
+ Viscidus->AI()->SummonedCreatureDespawn(me);
if (Viscidus->IsAlive() && Viscidus->GetHealthPct() < 5.0f)
{
@@ -304,7 +306,7 @@ class npc_glob_of_viscidus : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_glob_of_viscidusAI>(creature);
+ return GetAQ40AI<npc_glob_of_viscidusAI>(creature);
}
};
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp
index 054844c9c2f..51bc8a27550 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp
@@ -24,13 +24,15 @@ SDCategory: Temple of Ahn'Qiraj
EndScriptData */
#include "ScriptMgr.h"
+#include "Creature.h"
#include "InstanceScript.h"
+#include "Map.h"
#include "temple_of_ahnqiraj.h"
class instance_temple_of_ahnqiraj : public InstanceMapScript
{
public:
- instance_temple_of_ahnqiraj() : InstanceMapScript("instance_temple_of_ahnqiraj", 531) { }
+ instance_temple_of_ahnqiraj() : InstanceMapScript(AQ40ScriptName, 531) { }
InstanceScript* GetInstanceScript(InstanceMap* map) const override
{
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp
index 9a8bfff933f..cf987d35289 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp
@@ -24,17 +24,11 @@ SDCategory: Temple of Ahn'Qiraj
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "WorldPacket.h"
-
-#include "Item.h"
-#include "Player.h"
-#include "Spell.h"
-
-#include "Cell.h"
#include "CellImpl.h"
-#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
+#include "temple_of_ahnqiraj.h"
enum Spells
{
@@ -66,7 +60,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new aqsentinelAI(creature);
+ return GetAQ40AI<aqsentinelAI>(creature);
}
struct aqsentinelAI : public ScriptedAI
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/temple_of_ahnqiraj.h b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/temple_of_ahnqiraj.h
index 58e75af6276..bff449e9d82 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/temple_of_ahnqiraj.h
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/temple_of_ahnqiraj.h
@@ -19,6 +19,9 @@
#ifndef DEF_TEMPLE_OF_AHNQIRAJ_H
#define DEF_TEMPLE_OF_AHNQIRAJ_H
+#include "CreatureAIImpl.h"
+
+#define AQ40ScriptName "instance_temple_of_ahnqiraj"
#define DataHeader "AQT"
enum AQTDataTypes
@@ -62,4 +65,10 @@ enum AQTCreatures
NPC_VEKNILASH = 15275
};
+template<typename AI>
+inline AI* GetAQ40AI(Creature* creature)
+{
+ return GetInstanceAI<AI>(creature, AQ40ScriptName);
+}
+
#endif
diff --git a/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp b/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp
index c5a360258c6..44448706a25 100644
--- a/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp
+++ b/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp
@@ -23,9 +23,11 @@ SDComment: Everything seems to work, still need some checking
SDCategory: Wailing Caverns
EndScriptData */
-#include "Log.h"
-#include "InstanceScript.h"
#include "ScriptMgr.h"
+#include "Creature.h"
+#include "InstanceScript.h"
+#include "Log.h"
+#include "Map.h"
#include "wailing_caverns.h"
#define MAX_ENCOUNTER 9
@@ -33,7 +35,7 @@ EndScriptData */
class instance_wailing_caverns : public InstanceMapScript
{
public:
- instance_wailing_caverns() : InstanceMapScript("instance_wailing_caverns", 43) { }
+ instance_wailing_caverns() : InstanceMapScript(WCScriptName, 43) { }
InstanceScript* GetInstanceScript(InstanceMap* map) const override
{
diff --git a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp
index 7f9710d504f..27b096e3561 100644
--- a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp
+++ b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp
@@ -27,11 +27,11 @@ EndScriptData */
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "InstanceScript.h"
+#include "Player.h"
#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
#include "wailing_caverns.h"
-#include "Player.h"
/*######
## npc_disciple_of_naralex
@@ -81,7 +81,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_disciple_of_naralexAI>(creature);
+ return GetWailingCavernsAI<npc_disciple_of_naralexAI>(creature);
}
bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) override
diff --git a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.h b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.h
index 1b655815934..d0757964c85 100644
--- a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.h
+++ b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.h
@@ -19,6 +19,9 @@
#ifndef DEF_WAILING_CAVERNS_H
#define DEF_WAILING_CAVERNS_H
+#include "CreatureAIImpl.h"
+
+#define WCScriptName "instance_wailing_caverns"
#define DataHeader "WC"
enum WCDataTypes
@@ -37,4 +40,10 @@ enum WCDataTypes
DATA_NARALEX = 3679,
};
+template<typename AI>
+inline AI* GetWailingCavernsAI(Creature* creature)
+{
+ return GetInstanceAI<AI>(creature, WCScriptName);
+}
+
#endif
diff --git a/src/server/scripts/Kalimdor/ZulFarrak/boss_zum_rah.cpp b/src/server/scripts/Kalimdor/ZulFarrak/boss_zum_rah.cpp
index 424803ae2ca..0fd0ffa8c41 100644
--- a/src/server/scripts/Kalimdor/ZulFarrak/boss_zum_rah.cpp
+++ b/src/server/scripts/Kalimdor/ZulFarrak/boss_zum_rah.cpp
@@ -21,6 +21,7 @@ Category: Tanaris, ZulFarrak
*/
#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "ScriptedCreature.h"
#include "zulfarrak.h"
@@ -157,7 +158,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_zum_rahAI>(creature);
+ return GetZulFarrakAI<boss_zum_rahAI>(creature);
}
};
diff --git a/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp b/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp
index cafd9a8c917..695d99872e9 100644
--- a/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp
+++ b/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp
@@ -16,10 +16,11 @@
*/
#include "ScriptMgr.h"
+#include "GameObject.h"
#include "InstanceScript.h"
-#include "zulfarrak.h"
-#include "Player.h"
+#include "Map.h"
#include "TemporarySummon.h"
+#include "zulfarrak.h"
enum Misc
{
@@ -99,7 +100,7 @@ float Spawnsway[2][3] =
class instance_zulfarrak : public InstanceMapScript
{
public:
- instance_zulfarrak() : InstanceMapScript("instance_zulfarrak", 209) { }
+ instance_zulfarrak() : InstanceMapScript(ZFScriptName, 209) { }
InstanceScript* GetInstanceScript(InstanceMap* map) const override
{
@@ -328,9 +329,11 @@ public:
if (pyramidSpawns[i][0] == (float)wave)
{
Position pos = {pyramidSpawns[i][2], pyramidSpawns[i][3], 8.87f, 0};
- TempSummon* ts = instance->SummonCreature(uint32(pyramidSpawns[i][1]), pos);
- ts->GetMotionMaster()->MoveRandom(10);
- addsAtBase.push_back(ts->GetGUID());
+ if (TempSummon* ts = instance->SummonCreature(uint32(pyramidSpawns[i][1]), pos))
+ {
+ ts->GetMotionMaster()->MoveRandom(10);
+ addsAtBase.push_back(ts->GetGUID());
+ }
}
}
}
@@ -359,7 +362,7 @@ public:
void SendAddsUpStairs(uint32 count)
{
//pop a add from list, send him up the stairs...
- for (uint32 addCount = 0; addCount<count && !addsAtBase.empty(); addCount++)
+ for (uint32 addCount = 0; addCount < count && !addsAtBase.empty(); addCount++)
{
if (Creature* add = instance->GetCreature(*addsAtBase.begin()))
{
diff --git a/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp b/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp
index 5b419b0217a..c30d956bcc4 100644
--- a/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp
+++ b/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp
@@ -29,10 +29,13 @@ npc_weegli_blastfuse
EndContentData */
#include "ScriptMgr.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
#include "zulfarrak.h"
-#include "Player.h"
/*######
## npc_sergeant_bly
@@ -97,7 +100,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_sergeant_blyAI>(creature);
+ return GetZulFarrakAI<npc_sergeant_blyAI>(creature);
}
struct npc_sergeant_blyAI : public ScriptedAI
@@ -141,7 +144,7 @@ public:
{
case 1:
//weegli doesn't fight - he goes & blows up the door
- if (Creature* pWeegli = instance->instance->GetCreature(instance->GetGuidData(ENTRY_WEEGLI)))
+ if (Creature* pWeegli = ObjectAccessor::GetCreature(*me, instance->GetGuidData(ENTRY_WEEGLI)))
pWeegli->AI()->DoAction(0);
Talk(SAY_1);
Text_Timer = 5000;
@@ -300,7 +303,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_weegli_blastfuseAI>(creature);
+ return GetZulFarrakAI<npc_weegli_blastfuseAI>(creature);
}
struct npc_weegli_blastfuseAI : public ScriptedAI
diff --git a/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.h b/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.h
index cb38db2c55c..bc6ed4441a2 100644
--- a/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.h
+++ b/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.h
@@ -19,6 +19,9 @@
#ifndef DEF_ZF_H
#define DEF_ZF_H
+#include "CreatureAIImpl.h"
+
+#define ZFScriptName "instance_zulfarrak"
#define DataHeader "ZF"
enum ZFEntries
@@ -54,4 +57,10 @@ enum ZFPyramidPhases
PYRAMID_KILLED_ALL_TROLLS,
};
+template<typename AI>
+inline AI* GetZulFarrakAI(Creature* creature)
+{
+ return GetInstanceAI<AI>(creature, ZFScriptName);
+}
+
#endif \ No newline at end of file
diff --git a/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp b/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp
index 6a06ff3f7be..e9337d3e4ee 100644
--- a/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp
+++ b/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp
@@ -33,12 +33,13 @@ npc_death_ravager
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedEscortAI.h"
-#include "ScriptedGossip.h"
#include "CellImpl.h"
#include "GridNotifiersImpl.h"
#include "Log.h"
+#include "ObjectAccessor.h"
+#include "ScriptedEscortAI.h"
+#include "ScriptedGossip.h"
+#include "TemporarySummon.h"
/*######
## npc_draenei_survivor
diff --git a/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp b/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp
index 04da6aa74aa..f1aec9a37be 100644
--- a/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp
+++ b/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp
@@ -27,14 +27,14 @@ EndScriptData */
npc_webbed_creature
EndContentData */
-#include "Player.h"
-#include "Group.h"
-#include "GridNotifiersImpl.h"
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedEscortAI.h"
-#include "PassiveAI.h"
#include "CellImpl.h"
+#include "GridNotifiersImpl.h"
+#include "Group.h"
+#include "ObjectAccessor.h"
+#include "PassiveAI.h"
+#include "Player.h"
+#include "ScriptedEscortAI.h"
/*######
## npc_webbed_creature
@@ -499,7 +499,7 @@ public:
_explosivesGuids.clear();
for (uint8 i = 0; i != MAX_EXPLOSIVES; ++i)
{
- if (GameObject* explosive = me->SummonGameObject(GO_DRAENEI_EXPLOSIVES_1, ExplosivesPos[0][i], G3D::Quat(), 0))
+ if (GameObject* explosive = me->SummonGameObject(GO_DRAENEI_EXPLOSIVES_1, ExplosivesPos[0][i], QuaternionData(), 0))
_explosivesGuids.push_back(explosive->GetGUID());
}
me->HandleEmoteCommand(EMOTE_ONESHOT_NONE); // reset anim state
@@ -595,7 +595,7 @@ public:
_explosivesGuids.clear();
for (uint8 i = 0; i != MAX_EXPLOSIVES; ++i)
{
- if (GameObject* explosive = me->SummonGameObject(GO_DRAENEI_EXPLOSIVES_2, ExplosivesPos[1][i], G3D::Quat(), 0))
+ if (GameObject* explosive = me->SummonGameObject(GO_DRAENEI_EXPLOSIVES_2, ExplosivesPos[1][i], QuaternionData(), 0))
_explosivesGuids.push_back(explosive->GetGUID());
}
Talk(SAY_LEGOSO_15);
diff --git a/src/server/scripts/Kalimdor/zone_durotar.cpp b/src/server/scripts/Kalimdor/zone_durotar.cpp
index 3a3d045cb06..a1a6b2d5329 100644
--- a/src/server/scripts/Kalimdor/zone_durotar.cpp
+++ b/src/server/scripts/Kalimdor/zone_durotar.cpp
@@ -135,12 +135,16 @@ class spell_voodoo : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_BREW) || !sSpellMgr->GetSpellInfo(SPELL_GHOSTLY) ||
- !sSpellMgr->GetSpellInfo(SPELL_HEX1) || !sSpellMgr->GetSpellInfo(SPELL_HEX2) ||
- !sSpellMgr->GetSpellInfo(SPELL_HEX3) || !sSpellMgr->GetSpellInfo(SPELL_GROW) ||
- !sSpellMgr->GetSpellInfo(SPELL_LAUNCH))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_BREW,
+ SPELL_GHOSTLY,
+ SPELL_HEX1,
+ SPELL_HEX2,
+ SPELL_HEX3,
+ SPELL_GROW,
+ SPELL_LAUNCH
+ });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
diff --git a/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp b/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp
index dbc46b60a93..bb5ca8716e8 100644
--- a/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp
+++ b/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp
@@ -28,6 +28,7 @@ EndContentData */
#include "ScriptMgr.h"
#include "Player.h"
+#include "QuestDef.h"
#include "ScriptedEscortAI.h"
#include "ScriptedGossip.h"
#include "SpellInfo.h"
@@ -247,9 +248,7 @@ class spell_ooze_zap : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_OOZE_ZAP))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_OOZE_ZAP });
}
SpellCastResult CheckRequirement()
@@ -294,9 +293,7 @@ class spell_ooze_zap_channel_end : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_OOZE_ZAP_CHANNEL_END))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_OOZE_ZAP_CHANNEL_END });
}
void HandleDummy(SpellEffIndex effIndex)
@@ -330,9 +327,7 @@ class spell_energize_aoe : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_ENERGIZED))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_ENERGIZED });
}
void FilterTargets(std::list<WorldObject*>& targets)
diff --git a/src/server/scripts/Kalimdor/zone_silithus.cpp b/src/server/scripts/Kalimdor/zone_silithus.cpp
index 81481b54a73..afece0568de 100644
--- a/src/server/scripts/Kalimdor/zone_silithus.cpp
+++ b/src/server/scripts/Kalimdor/zone_silithus.cpp
@@ -36,10 +36,14 @@ go_wind_stone
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
+#include "CreatureAIImpl.h"
+#include "GameObject.h"
#include "Group.h"
#include "Player.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
+#include "TemporarySummon.h"
/*#####
# Quest: A Pawn on the Eternal Board
@@ -505,11 +509,11 @@ public:
DoCast(player, SPELL_CALL_PRISMATIC_BARRIER, true);
break;
case 37:
- me->SummonGameObject(GO_GATE_OF_AHN_QIRAJ, Position(-8130.f, 1525.f, 17.5f, 0.f), G3D::Quat(), 0);
+ me->SummonGameObject(GO_GATE_OF_AHN_QIRAJ, Position(-8130.f, 1525.f, 17.5f, 0.f), QuaternionData(), 0);
break;
case 38:
DoCast(player, SPELL_CALL_GLYPHS_OF_WARDING, true);
- me->SummonGameObject(GO_GLYPH_OF_AHN_QIRAJ, Position(-8130.f, 1525.f, 17.5f, 0.f), G3D::Quat(), 0);
+ me->SummonGameObject(GO_GLYPH_OF_AHN_QIRAJ, Position(-8130.f, 1525.f, 17.5f, 0.f), QuaternionData(), 0);
break;
case 39:
Talk(ANACHRONOS_SAY_5, Fandral);
@@ -518,7 +522,7 @@ public:
Fandral->CastSpell(me, SPELL_CALL_ANCIENTS, true);
break;
case 41:
- Fandral->SummonGameObject(GO_ROOTS_OF_AHN_QIRAJ, Position(-8130.f, 1525.f, 17.5f, 0.f), G3D::Quat(), 0);
+ Fandral->SummonGameObject(GO_ROOTS_OF_AHN_QIRAJ, Position(-8130.f, 1525.f, 17.5f, 0.f), QuaternionData(), 0);
Fandral->AI()->Talk(FANDRAL_SAY_3);
break;
case 42:
diff --git a/src/server/scripts/Kalimdor/zone_tanaris.cpp b/src/server/scripts/Kalimdor/zone_tanaris.cpp
index c1880995732..4c074407025 100644
--- a/src/server/scripts/Kalimdor/zone_tanaris.cpp
+++ b/src/server/scripts/Kalimdor/zone_tanaris.cpp
@@ -29,12 +29,11 @@ npc_OOX17
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptedEscortAI.h"
#include "ScriptedFollowerAI.h"
-#include "Player.h"
-#include "WorldSession.h"
+#include "ScriptedGossip.h"
/*######
## npc_aquementas
diff --git a/src/server/scripts/Kalimdor/zone_the_barrens.cpp b/src/server/scripts/Kalimdor/zone_the_barrens.cpp
index 5045c1efe8a..88d776d887d 100644
--- a/src/server/scripts/Kalimdor/zone_the_barrens.cpp
+++ b/src/server/scripts/Kalimdor/zone_the_barrens.cpp
@@ -28,11 +28,12 @@ npc_wizzlecrank_shredder
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
-#include "ScriptedEscortAI.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "ScriptedEscortAI.h"
+#include "ScriptedGossip.h"
#include "SpellInfo.h"
+#include "TemporarySummon.h"
/*######
## npc_beaten_corpse
diff --git a/src/server/scripts/Kalimdor/zone_winterspring.cpp b/src/server/scripts/Kalimdor/zone_winterspring.cpp
index 687740ce559..8d87d82e4a7 100644
--- a/src/server/scripts/Kalimdor/zone_winterspring.cpp
+++ b/src/server/scripts/Kalimdor/zone_winterspring.cpp
@@ -30,10 +30,11 @@ go_elune_fire
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
-#include "ScriptedEscortAI.h"
+#include "GameObject.h"
#include "Player.h"
+#include "ScriptedEscortAI.h"
+#include "ScriptedGossip.h"
+#include "TemporarySummon.h"
#include "WorldSession.h"
/*######
diff --git a/src/server/scripts/Maelstrom/Stonecore/boss_corborus.cpp b/src/server/scripts/Maelstrom/Stonecore/boss_corborus.cpp
index be0d7053129..868c1ae21a1 100644
--- a/src/server/scripts/Maelstrom/Stonecore/boss_corborus.cpp
+++ b/src/server/scripts/Maelstrom/Stonecore/boss_corborus.cpp
@@ -16,8 +16,9 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "CreatureGroups.h"
+#include "InstanceScript.h"
+#include "ScriptedCreature.h"
#include "stonecore.h"
// TO-DO:
@@ -250,7 +251,7 @@ class boss_corborus : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_corborusAI>(creature);
+ return GetStonecoreAI<boss_corborusAI>(creature);
}
};
@@ -312,7 +313,7 @@ class npc_rock_borer : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_rock_borerAI>(creature);
+ return GetStonecoreAI<npc_rock_borerAI>(creature);
}
};
diff --git a/src/server/scripts/Maelstrom/Stonecore/boss_high_priestess_azil.cpp b/src/server/scripts/Maelstrom/Stonecore/boss_high_priestess_azil.cpp
index ba6728f76f6..ce6a3d77411 100644
--- a/src/server/scripts/Maelstrom/Stonecore/boss_high_priestess_azil.cpp
+++ b/src/server/scripts/Maelstrom/Stonecore/boss_high_priestess_azil.cpp
@@ -22,7 +22,6 @@
#include "Player.h"
#include "ScriptedCreature.h"
#include "Spell.h"
-#include "SpellMgr.h"
#include "SpellScript.h"
#include "stonecore.h"
#include "Vehicle.h"
@@ -300,7 +299,7 @@ class boss_high_priestess_azil : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_high_priestess_azilAI>(creature);
+ return GetStonecoreAI<boss_high_priestess_azilAI>(creature);
}
};
@@ -334,7 +333,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_devout_followerAI>(creature);
+ return GetStonecoreAI<npc_devout_followerAI>(creature);
}
};
@@ -351,7 +350,7 @@ public:
DoCast(me, SPELL_GRAVITY_WELL_VISUAL);
events.ScheduleEvent(EVENT_GRAVITY_WELL_AURA_DAMAGE, 3200);
events.ScheduleEvent(EVENT_GRAVITY_WELL_AURA_PULL, 4500);
- if (!me->GetMap()->IsHeroic())
+ if (!IsHeroic())
me->DespawnOrUnsummon(23200);
}
@@ -392,7 +391,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_gravity_wellAI>(creature);
+ return GetStonecoreAI<npc_gravity_wellAI>(creature);
}
};
@@ -465,7 +464,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_seismic_shardAI>(creature);
+ return GetStonecoreAI<npc_seismic_shardAI>(creature);
}
};
@@ -481,9 +480,7 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_ADD_SOUTH))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SUMMON_ADD_SOUTH });
}
void HandleScript(SpellEffIndex /*effIndex*/)
@@ -517,9 +514,7 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_ADD_WEST))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SUMMON_ADD_WEST });
}
void HandleScript(SpellEffIndex /*effIndex*/)
diff --git a/src/server/scripts/Maelstrom/Stonecore/boss_ozruk.cpp b/src/server/scripts/Maelstrom/Stonecore/boss_ozruk.cpp
index 963e336dd51..38303a31ae2 100644
--- a/src/server/scripts/Maelstrom/Stonecore/boss_ozruk.cpp
+++ b/src/server/scripts/Maelstrom/Stonecore/boss_ozruk.cpp
@@ -19,8 +19,9 @@
#include "ScriptedCreature.h"
#include "SpellScript.h"
#include "SpellAuraEffects.h"
-#include "Vehicle.h"
#include "stonecore.h"
+#include "TemporarySummon.h"
+#include "Vehicle.h"
enum Spells
{
@@ -180,7 +181,7 @@ class boss_ozruk : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_ozrukAI>(creature);
+ return GetStonecoreAI<boss_ozrukAI>(creature);
}
};
diff --git a/src/server/scripts/Maelstrom/Stonecore/boss_slabhide.cpp b/src/server/scripts/Maelstrom/Stonecore/boss_slabhide.cpp
index 1b8c3682b09..a9beb1b5421 100644
--- a/src/server/scripts/Maelstrom/Stonecore/boss_slabhide.cpp
+++ b/src/server/scripts/Maelstrom/Stonecore/boss_slabhide.cpp
@@ -19,10 +19,8 @@
#include "GameObject.h"
#include "InstanceScript.h"
#include "Map.h"
-#include "Player.h"
#include "ScriptedCreature.h"
#include "Spell.h"
-#include "SpellMgr.h"
#include "SpellScript.h"
#include "stonecore.h"
@@ -318,7 +316,7 @@ class boss_slabhide : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_slabhideAI>(creature);
+ return GetStonecoreAI<boss_slabhideAI>(creature);
}
};
@@ -361,7 +359,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_lava_fissureAI>(creature);
+ return GetStonecoreAI<npc_lava_fissureAI>(creature);
}
};
@@ -407,7 +405,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_stalactite_triggerAI>(creature);
+ return GetStonecoreAI<npc_stalactite_triggerAI>(creature);
}
};
@@ -513,9 +511,7 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_CRYSTAL_STORM_TRIGGER))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_CRYSTAL_STORM_TRIGGER });
}
void HandleDummyEffect(SpellEffIndex /*eff*/)
diff --git a/src/server/scripts/Maelstrom/Stonecore/instance_stonecore.cpp b/src/server/scripts/Maelstrom/Stonecore/instance_stonecore.cpp
index c8624afa969..6ef8893292f 100644
--- a/src/server/scripts/Maelstrom/Stonecore/instance_stonecore.cpp
+++ b/src/server/scripts/Maelstrom/Stonecore/instance_stonecore.cpp
@@ -16,9 +16,11 @@
*/
#include "ScriptMgr.h"
-#include "Player.h"
+#include "Creature.h"
#include "CreatureGroups.h"
+#include "GameObject.h"
#include "InstanceScript.h"
+#include "Map.h"
#include "stonecore.h"
#define MAX_ENCOUNTER 4
diff --git a/src/server/scripts/Maelstrom/Stonecore/stonecore.cpp b/src/server/scripts/Maelstrom/Stonecore/stonecore.cpp
index 5b267676561..26c42183c93 100644
--- a/src/server/scripts/Maelstrom/Stonecore/stonecore.cpp
+++ b/src/server/scripts/Maelstrom/Stonecore/stonecore.cpp
@@ -15,12 +15,13 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ObjectGuid.h"
-#include "ObjectMgr.h"
#include "ScriptMgr.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "ObjectMgr.h"
+#include "Player.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
-#include "Player.h"
#include "stonecore.h"
enum Texts
@@ -264,7 +265,7 @@ class npc_sc_millhouse_manastorm : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_sc_millhouse_manastormAI>(creature);
+ return GetStonecoreAI<npc_sc_millhouse_manastormAI>(creature);
}
};
@@ -343,7 +344,7 @@ class spell_sc_twilight_documents : public SpellScriptLoader
void SpawnGameObject(SpellEffIndex /*effIndex*/)
{
if (WorldLocation* loc = GetHitDest())
- GetCaster()->SummonGameObject(GAMEOBJECT_TWILIGHT_DOCUMENTS, *loc, G3D::Quat(), 7200);
+ GetCaster()->SummonGameObject(GAMEOBJECT_TWILIGHT_DOCUMENTS, *loc, QuaternionData(), 7200);
}
void Register() override
diff --git a/src/server/scripts/Maelstrom/Stonecore/stonecore.h b/src/server/scripts/Maelstrom/Stonecore/stonecore.h
index 7d5aa8183cb..ef9749d5797 100644
--- a/src/server/scripts/Maelstrom/Stonecore/stonecore.h
+++ b/src/server/scripts/Maelstrom/Stonecore/stonecore.h
@@ -18,6 +18,8 @@
#ifndef DEF_STONECORE_H
#define DEF_STONECORE_H
+#include "CreatureAIImpl.h"
+
#define SCScriptName "instance_stonecore"
#define DataHeader "SC"
@@ -74,4 +76,10 @@ enum SCMisc
CREATURE_FORMATION_MILLHOUSE_EVENT_LAST_GROUP = 340492,
};
+template<typename AI>
+inline AI* GetStonecoreAI(Creature* creature)
+{
+ return GetInstanceAI<AI>(creature, SCScriptName);
+}
+
#endif // DEF_STONECORE
diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/ahnkahet.h b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/ahnkahet.h
index 90c657502f9..813199ecf91 100644
--- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/ahnkahet.h
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/ahnkahet.h
@@ -18,11 +18,11 @@
#ifndef AHNKAHET_H_
#define AHNKAHET_H_
+#include "CreatureAIImpl.h"
+
#define AhnKahetScriptName "instance_ahnkahet"
#define DataHeader "AK"
-#include "InstanceScript.h"
-
uint32 const EncounterCount = 5;
enum AKDataTypes
@@ -82,8 +82,8 @@ enum AKGameObjectIds
GO_SPHERE_2 = 193094
};
-template<class AI>
-AI* GetAhnKahetAI(Creature* creature)
+template<typename AI>
+inline AI* GetAhnKahetAI(Creature* creature)
{
return GetInstanceAI<AI>(creature, AhnKahetScriptName);
}
diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp
index 9f7f97a0cab..f4881aaa9ed 100644
--- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp
@@ -16,8 +16,10 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "ahnkahet.h"
+#include "InstanceScript.h"
+#include "ScriptedCreature.h"
+#include "TemporarySummon.h"
enum Spells
{
@@ -88,22 +90,18 @@ class boss_amanitar : public CreatureScript
for (uint8 i = 0; i < 30; ++i)
{
Position pos = me->GetRandomNearPosition(30.0f);
- pos.m_positionZ = me->GetMap()->GetHeight(me->GetPhases(), pos.GetPositionX(), pos.GetPositionY(), MAX_HEIGHT) + 2.0f;
+ me->UpdateGroundPositionZ(pos.GetPositionX(), pos.GetPositionY(), pos.m_positionZ);
if (Creature* trigger = me->SummonCreature(NPC_TRIGGER, pos))
{
Creature* temp1 = trigger->FindNearestCreature(NPC_HEALTHY_MUSHROOM, 4.0f, true);
Creature* temp2 = trigger->FindNearestCreature(NPC_POISONOUS_MUSHROOM, 4.0f, true);
- if (temp1 || temp2)
- {
- trigger->DisappearAndDie();
- }
- else
+ if (!temp1 && !temp2)
{
u = 1 - u;
- trigger->DisappearAndDie();
me->SummonCreature(u > 0 ? NPC_POISONOUS_MUSHROOM : NPC_HEALTHY_MUSHROOM, pos, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60 * IN_MILLISECONDS);
}
+ trigger->DespawnOrUnsummon();
}
}
}
@@ -227,7 +225,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_amanitar_mushroomsAI(creature);
+ return GetAhnKahetAI<npc_amanitar_mushroomsAI>(creature);
}
};
diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_elder_nadox.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_elder_nadox.cpp
index 242dd354a00..fd6b5dbee68 100644
--- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_elder_nadox.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_elder_nadox.cpp
@@ -16,10 +16,10 @@
*/
#include "ScriptMgr.h"
+#include "ahnkahet.h"
#include "ScriptedCreature.h"
#include "SpellAuras.h"
#include "SpellScript.h"
-#include "ahnkahet.h"
enum Yells
{
@@ -224,7 +224,7 @@ class npc_ahnkahar_nerubian : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_ahnkahar_nerubianAI(creature);
+ return GetAhnKahetAI<npc_ahnkahar_nerubianAI>(creature);
}
};
@@ -247,9 +247,7 @@ class spell_ahn_kahet_swarm : public SpellScriptLoader
private:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SWARM_BUFF))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SWARM_BUFF });
}
void CountTargets(std::list<WorldObject*>& targets)
diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp
index e1793e06bb6..a2464104bdc 100644
--- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp
@@ -20,10 +20,15 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "ahnkahet.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "ScriptedCreature.h"
#include "SpellInfo.h"
+#include "SpellMgr.h"
+#include "TemporarySummon.h"
enum Spells
{
@@ -285,7 +290,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_volazjAI>(creature);
+ return GetAhnKahetAI<boss_volazjAI>(creature);
}
};
diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp
index d3bc4734459..956d2b60e55 100644
--- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp
@@ -21,9 +21,11 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "ahnkahet.h"
-
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
+#include "TemporarySummon.h"
enum Yells
{
@@ -326,7 +328,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_jedoga_shadowseekerAI>(creature);
+ return GetAhnKahetAI<boss_jedoga_shadowseekerAI>(creature);
}
};
@@ -429,7 +431,7 @@ public:
{
case 1:
{
- Creature* boss = me->GetMap()->GetCreature(instance->GetGuidData(DATA_JEDOGA_SHADOWSEEKER));
+ Creature* boss = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_JEDOGA_SHADOWSEEKER));
if (boss)
{
ENSURE_AI(boss_jedoga_shadowseeker::boss_jedoga_shadowseekerAI, boss->AI())->bOpFerok = true;
@@ -495,7 +497,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_jedoga_initiandAI>(creature);
+ return GetAhnKahetAI<npc_jedoga_initiandAI>(creature);
}
};
@@ -578,7 +580,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_jedogas_aufseher_triggerAI>(creature);
+ return GetAhnKahetAI<npc_jedogas_aufseher_triggerAI>(creature);
}
};
diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp
index b573b3b463b..36ac2107bab 100644
--- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp
@@ -19,6 +19,7 @@
#include "ahnkahet.h"
#include "GameObject.h"
#include "InstanceScript.h"
+#include "Map.h"
#include "ObjectAccessor.h"
#include "Player.h"
#include "ScriptedCreature.h"
@@ -374,7 +375,7 @@ class npc_prince_taldaram_flame_sphere : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_prince_taldaram_flame_sphereAI(creature);
+ return GetAhnKahetAI<npc_prince_taldaram_flame_sphereAI>(creature);
}
};
@@ -426,11 +427,12 @@ class spell_prince_taldaram_conjure_flame_sphere : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_FLAME_SPHERE_SUMMON_1)
- || !sSpellMgr->GetSpellInfo(SPELL_FLAME_SPHERE_SUMMON_2)
- || !sSpellMgr->GetSpellInfo(SPELL_FLAME_SPHERE_SUMMON_3))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_FLAME_SPHERE_SUMMON_1,
+ SPELL_FLAME_SPHERE_SUMMON_2,
+ SPELL_FLAME_SPHERE_SUMMON_3
+ });
}
void HandleScript(SpellEffIndex /*effIndex*/)
diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp
index be7b4cf4894..c629a5e66e7 100644
--- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp
@@ -16,9 +16,12 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "InstanceScript.h"
#include "ahnkahet.h"
+#include "Creature.h"
+#include "CreatureAI.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "Map.h"
DoorData const doorData[] =
{
diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/azjol_nerub.h b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/azjol_nerub.h
index 8c332bac1fb..134c7407d17 100644
--- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/azjol_nerub.h
+++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/azjol_nerub.h
@@ -18,11 +18,11 @@
#ifndef AZJOL_NERUB_H_
#define AZJOL_NERUB_H_
+#include "CreatureAIImpl.h"
+
#define AzjolNerubScriptName "instance_azjol_nerub"
#define DataHeader "AN"
-#include "InstanceScript.h"
-
uint32 const EncounterCount = 3;
enum ANDataTypes
@@ -64,8 +64,8 @@ enum ANInstanceActions
ACTION_GATEWATCHER_GREET = 1
};
-template<class AI>
-AI* GetAzjolNerubAI(Creature* creature)
+template<typename AI>
+inline AI* GetAzjolNerubAI(Creature* creature)
{
return GetInstanceAI<AI>(creature, AzjolNerubScriptName);
}
diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp
index 14914bb6b07..cb8f01be073 100644
--- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp
@@ -24,7 +24,6 @@
#include "PassiveAI.h"
#include "ScriptedCreature.h"
#include "SpellInfo.h"
-#include "SpellMgr.h"
#include "SpellScript.h"
#include "TemporarySummon.h"
@@ -653,7 +652,7 @@ class spell_anubarak_pound : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- return sSpellMgr->GetSpellInfo(SPELL_POUND_DAMAGE) != nullptr;
+ return ValidateSpellInfo({ SPELL_POUND_DAMAGE });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -686,7 +685,7 @@ class spell_anubarak_carrion_beetles : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- return (sSpellMgr->GetSpellInfo(SPELL_CARRION_BEETLE) != nullptr);
+ return ValidateSpellInfo({ SPELL_CARRION_BEETLE });
}
void HandlePeriodic(AuraEffect const* /*eff*/)
diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp
index ac840c58f55..cc8a7e6829d 100644
--- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp
@@ -16,11 +16,14 @@
*/
#include "ScriptMgr.h"
+#include "azjol_nerub.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
-#include "SpellScript.h"
-#include "SpellAuras.h"
#include "SpellAuraEffects.h"
-#include "azjol_nerub.h"
+#include "SpellAuras.h"
+#include "SpellScript.h"
+#include "TemporarySummon.h"
enum Events
{
@@ -380,7 +383,7 @@ public:
summons.Summon(summon);
// Do not enter combat with zone
}
-
+
private:
bool _enteredCombat; // has a player entered combat with the first crusher pack? (talk and spawn two more packs)
bool _doorsWebbed; // obvious - have we reached the top and webbed the doors shut? (trigger for hadronox denied achievement)
@@ -616,7 +619,7 @@ class npc_anub_ar_crusher_champion : public CreatureScript
}
};
-static const Position cryptFiendWaypoints[] =
+static const Position cryptFiendWaypoints[] =
{
{ 520.3911f, 548.7895f, 732.0118f, 5.0091f },
{ },
@@ -953,9 +956,7 @@ class spell_hadronox_periodic_summon_template_AuraScript : public AuraScript
bool Validate(SpellInfo const* /*spell*/) override
{
- return
- (sSpellMgr->GetSpellInfo(_topSpellId) != nullptr) &&
- (sSpellMgr->GetSpellInfo(_bottomSpellId) != nullptr);
+ return ValidateSpellInfo({ _topSpellId, _bottomSpellId });
}
void HandleApply(AuraEffect const* /*eff*/, AuraEffectHandleModes /*mode*/)
@@ -1056,7 +1057,7 @@ class spell_hadronox_leeching_poison : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- return sSpellMgr->GetSpellInfo(SPELL_LEECH_POISON_HEAL) != nullptr;
+ return ValidateSpellInfo({ SPELL_LEECH_POISON_HEAL });
}
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -1094,11 +1095,12 @@ class spell_hadronox_web_doors : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- return (
- sSpellMgr->GetSpellInfo(SPELL_SUMMON_CHAMPION_PERIODIC) &&
- sSpellMgr->GetSpellInfo(SPELL_SUMMON_CRYPT_FIEND_PERIODIC) &&
- sSpellMgr->GetSpellInfo(SPELL_SUMMON_NECROMANCER_PERIODIC)
- );
+ return ValidateSpellInfo(
+ {
+ SPELL_SUMMON_CHAMPION_PERIODIC,
+ SPELL_SUMMON_CRYPT_FIEND_PERIODIC,
+ SPELL_SUMMON_NECROMANCER_PERIODIC
+ });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp
index a06d915e594..a1a4732a6f9 100644
--- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp
@@ -20,11 +20,13 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "SpellScript.h"
+#include "azjol_nerub.h"
+#include "InstanceScript.h"
#include "PassiveAI.h"
+#include "ScriptedCreature.h"
#include "SpellAuras.h"
-#include "azjol_nerub.h"
+#include "SpellScript.h"
+#include "TemporarySummon.h"
enum Events
{
@@ -926,7 +928,7 @@ class spell_gatewatcher_subboss_trigger : public SpellScriptLoader
{
public:
spell_gatewatcher_subboss_trigger() : SpellScriptLoader("spell_gatewatcher_subboss_trigger") { }
-
+
class spell_gatewatcher_subboss_trigger_SpellScript : public SpellScript
{
PrepareSpellScript(spell_gatewatcher_subboss_trigger_SpellScript);
@@ -983,7 +985,7 @@ class spell_anub_ar_skirmisher_fixtate : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- return sSpellMgr->GetSpellInfo(SPELL_FIXTATE_TRIGGERED) != nullptr;
+ return ValidateSpellInfo({ SPELL_FIXTATE_TRIGGERED });
}
void HandleScript(SpellEffIndex /*effIndex*/)
@@ -1015,7 +1017,7 @@ class spell_gatewatcher_web_wrap : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- return sSpellMgr->GetSpellInfo(SPELL_WEB_WRAP_WRAPPED) != nullptr;
+ return ValidateSpellInfo({ SPELL_WEB_WRAP_WRAPPED });
}
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -1032,7 +1034,7 @@ class spell_gatewatcher_web_wrap : public SpellScriptLoader
OnEffectRemove += AuraEffectRemoveFn(spell_gatewatcher_web_wrap_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_MOD_ROOT, AURA_EFFECT_HANDLE_REAL);
}
};
-
+
AuraScript* GetAuraScript() const override
{
return new spell_gatewatcher_web_wrap_AuraScript();
diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp
index 7ebf309c74f..2a62c39b7d8 100644
--- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp
@@ -16,8 +16,12 @@
*/
#include "ScriptMgr.h"
-#include "InstanceScript.h"
+#include "AreaBoundary.h"
#include "azjol_nerub.h"
+#include "Creature.h"
+#include "CreatureAI.h"
+#include "InstanceScript.h"
+#include "Map.h"
DoorData const doorData[] =
{
@@ -45,7 +49,7 @@ ObjectData const gameobjectData[] =
{ 0, 0 } // END
};
-BossBoundaryData const boundaries =
+BossBoundaryData const boundaries =
{
{ DATA_KRIKTHIR_THE_GATEWATCHER, new RectangleBoundary(400.0f, 580.0f, 623.5f, 810.0f) },
{ DATA_HADRONOX, new ZRangeBoundary(666.0f, 776.0f) },
diff --git a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp
index 71487b5e048..47243c77e25 100644
--- a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp
+++ b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp
@@ -16,12 +16,13 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "GridNotifiers.h"
-#include "GridNotifiersImpl.h"
-#include "Cell.h"
#include "CellImpl.h"
+#include "GridNotifiersImpl.h"
+#include "InstanceScript.h"
#include "obsidian_sanctum.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
+#include "TemporarySummon.h"
enum Enums
{
diff --git a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/instance_obsidian_sanctum.cpp b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/instance_obsidian_sanctum.cpp
index 4bdbee94db1..6cb362c6a7b 100644
--- a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/instance_obsidian_sanctum.cpp
+++ b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/instance_obsidian_sanctum.cpp
@@ -16,7 +16,10 @@
*/
#include "ScriptMgr.h"
+#include "AreaBoundary.h"
+#include "Creature.h"
#include "InstanceScript.h"
+#include "Map.h"
#include "obsidian_sanctum.h"
/* Obsidian Sanctum encounters:
diff --git a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.cpp b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.cpp
index 45ca29fe6d1..80b14d6ec85 100644
--- a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.cpp
+++ b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.cpp
@@ -16,12 +16,13 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "GridNotifiers.h"
-#include "GridNotifiersImpl.h"
-#include "Cell.h"
#include "CellImpl.h"
+#include "GridNotifiersImpl.h"
+#include "InstanceScript.h"
#include "obsidian_sanctum.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
+#include "TemporarySummon.h"
enum Enums
{
@@ -904,7 +905,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_flame_tsunamiAI(creature);
+ return GetObsidianSanctumAI<npc_flame_tsunamiAI>(creature);
}
};
@@ -958,7 +959,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_twilight_fissureAI(creature);
+ return GetObsidianSanctumAI<npc_twilight_fissureAI>(creature);
}
};
@@ -1013,7 +1014,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_twilight_whelpAI(creature);
+ return GetObsidianSanctumAI<npc_twilight_whelpAI>(creature);
}
};
diff --git a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.h b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.h
index 92331e8c8bf..6c15db37002 100644
--- a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.h
+++ b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.h
@@ -18,6 +18,8 @@
#ifndef OBSIDIAN_SANCTUM_H_
#define OBSIDIAN_SANCTUM_H_
+#include "CreatureAIImpl.h"
+
#define OSScriptName "instance_obsidian_sanctum"
#define DataHeader "OS"
@@ -46,8 +48,8 @@ enum OSGameObjectIds
GO_TWILIGHT_PORTAL = 193988
};
-template<class AI>
-AI* GetObsidianSanctumAI(Creature* creature)
+template<typename AI>
+inline AI* GetObsidianSanctumAI(Creature* creature)
{
return GetInstanceAI<AI>(creature, OSScriptName);
}
diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp
index dd327325390..23fc2a9e5aa 100644
--- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp
+++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp
@@ -16,9 +16,11 @@
*/
#include "ScriptedCreature.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
#include "ScriptMgr.h"
-#include "SpellScript.h"
#include "SpellAuraEffects.h"
+#include "SpellScript.h"
#include "ruby_sanctum.h"
enum Texts
diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp
index 80ab200d148..acbf2010510 100644
--- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp
+++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp
@@ -16,9 +16,10 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedEscortAI.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
#include "ruby_sanctum.h"
+#include "ScriptedEscortAI.h"
enum Texts
{
diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp
index ee7ebaad976..a3a6c530c2f 100644
--- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp
+++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp
@@ -16,14 +16,20 @@
*/
#include "ScriptMgr.h"
-#include "SpellScript.h"
-#include "SpellAuraEffects.h"
-#include "Spell.h"
-#include "Vehicle.h"
+#include "DB2Stores.h"
+#include "GameObject.h"
#include "GameObjectAI.h"
-#include "ScriptedCreature.h"
-#include "ruby_sanctum.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "ruby_sanctum.h"
+#include "ScriptedCreature.h"
+#include "Spell.h"
+#include "SpellAuraEffects.h"
+#include "SpellScript.h"
+#include "TemporarySummon.h"
+#include "Vehicle.h"
enum Texts
{
@@ -1422,9 +1428,7 @@ class spell_halion_combustion_consumption : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(_markSpell))
- return false;
- return true;
+ return ValidateSpellInfo({ _markSpell });
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -1476,9 +1480,7 @@ class spell_halion_combustion_consumption_periodic : public SpellScriptLoader
bool Validate(SpellInfo const* spellInfo) override
{
- if (!sSpellMgr->GetSpellInfo(spellInfo->GetEffect(EFFECT_0)->TriggerSpell))
- return false;
- return true;
+ return ValidateSpellInfo({ spellInfo->GetEffect(EFFECT_0)->TriggerSpell });
}
void HandleTick(AuraEffect const* aurEff)
@@ -1522,9 +1524,7 @@ class spell_halion_marks : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(_summonSpellId))
- return false;
- return true;
+ return ValidateSpellInfo({ _summonSpellId });
}
/// We were purged. Force removed stacks to zero and trigger the appropriated remove handler.
@@ -1620,9 +1620,7 @@ class spell_halion_twilight_realm_handlers : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(_beforeHitSpellId))
- return false;
- return true;
+ return ValidateSpellInfo({ _beforeHitSpellId });
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*handle*/)
@@ -1679,11 +1677,11 @@ class spell_halion_clear_debuffs : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_CLEAR_DEBUFFS))
- return false;
- if (!sSpellMgr->GetSpellInfo(SPELL_TWILIGHT_REALM))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_CLEAR_DEBUFFS,
+ SPELL_TWILIGHT_REALM,
+ });
}
void HandleScript(SpellEffIndex effIndex)
diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp
index e1e3f085a4a..df0e85281ab 100644
--- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp
+++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp
@@ -16,9 +16,10 @@
*/
#include "ScriptMgr.h"
+#include "Map.h"
+#include "ruby_sanctum.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
-#include "ruby_sanctum.h"
enum Texts
{
diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp
index 52049a13962..3d8bef82502 100644
--- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp
+++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp
@@ -15,13 +15,17 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "InstanceScript.h"
-#include "Player.h"
-#include "ScriptedCreature.h"
#include "ScriptMgr.h"
-#include "TemporarySummon.h"
-#include "WorldPacket.h"
+#include "AreaBoundary.h"
+#include "CreatureAI.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "Map.h"
#include "ruby_sanctum.h"
+#include "TemporarySummon.h"
+#include "WorldStatePackets.h"
+
+Position const HalionControllerSpawnPos = { 3156.037f, 533.2656f, 72.97205f, 0.0f };
BossBoundaryData const boundaries =
{
diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.cpp
index 986ec58e7df..cfcd0f662f9 100644
--- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.cpp
+++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.cpp
@@ -16,11 +16,13 @@
*/
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
+#include "ruby_sanctum.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
#include "SpellScript.h"
-#include "ruby_sanctum.h"
-#include "Player.h"
enum Texts
{
@@ -183,9 +185,7 @@ class spell_ruby_sanctum_rallying_shout : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_RALLY))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_RALLY });
}
void CountTargets(std::list<WorldObject*>& targets)
diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.h b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.h
index afd5dc3a0bd..bef7eefab7d 100644
--- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.h
+++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.h
@@ -18,13 +18,13 @@
#ifndef RUBY_SANCTUM_H_
#define RUBY_SANCTUM_H_
+#include "CreatureAIImpl.h"
+
#define RSScriptName "instance_ruby_sanctum"
#define DataHeader "RS"
uint32 const EncounterCount = 4;
-Position const HalionControllerSpawnPos = {3156.037f, 533.2656f, 72.97205f, 0.0f};
-
enum RSDataTypes
{
// Encounter States/Boss GUIDs
@@ -127,25 +127,10 @@ enum RSInstanceSpell
SPELL_BERSERK = 26662,
};
-template<class AI>
-CreatureAI* GetRubySanctumAI(Creature* creature)
-{
- if (InstanceMap* instance = creature->GetMap()->ToInstanceMap())
- if (instance->GetInstanceScript())
- if (instance->GetScriptId() == sObjectMgr->GetScriptId(RSScriptName))
- return new AI(creature);
- return NULL;
-}
-
-template<class AI>
-GameObjectAI* GetRubySanctumAI(GameObject* go)
+template<typename AI, typename T>
+inline AI* GetRubySanctumAI(T* obj)
{
- if (InstanceMap* instance = go->GetMap()->ToInstanceMap())
- if (instance->GetInstanceScript())
- if (instance->GetScriptId() == sObjectMgr->GetScriptId(RSScriptName))
- return new AI(go);
-
- return NULL;
+ return GetInstanceAI<AI>(obj, RSScriptName);
}
#endif // RUBY_SANCTUM_H_
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp
index 9137ee98090..d3c1a491f20 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp
@@ -23,10 +23,12 @@ SDCategory: Trial of the Champion
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
+#include "ScriptedEscortAI.h"
#include "SpellScript.h"
+#include "TemporarySummon.h"
#include "trial_of_the_champion.h"
-#include "ScriptedEscortAI.h"
/*
enum Yells
{
@@ -253,7 +255,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_eadricAI>(creature);
+ return GetTrialOfTheChampionAI<boss_eadricAI>(creature);
}
};
@@ -415,7 +417,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_paletressAI>(creature);
+ return GetTrialOfTheChampionAI<boss_paletressAI>(creature);
}
};
@@ -492,7 +494,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_memoryAI(creature);
+ return GetTrialOfTheChampionAI<npc_memoryAI>(creature);
}
};
@@ -605,11 +607,11 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_argent_soldierAI>(creature);
+ return GetTrialOfTheChampionAI<npc_argent_soldierAI>(creature);
}
};
-uint32 const memorySpellId[25] =
+uint32 constexpr memorySpellId[25] =
{
SPELL_MEMORY_ALGALON,
SPELL_MEMORY_ARCHIMONDE,
@@ -650,10 +652,7 @@ class spell_paletress_summon_memory : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- for (uint8 i = 0; i < 25; ++i)
- if (!sSpellMgr->GetSpellInfo(memorySpellId[i]))
- return false;
- return true;
+ return ValidateSpellInfo(memorySpellId);
}
void FilterTargets(std::list<WorldObject*>& targets)
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp
index e5b749c5da0..be1c5b69bd8 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp
@@ -23,7 +23,7 @@ SDCategory: Trial of the Champion
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "InstanceScript.h"
#include "ScriptedEscortAI.h"
#include "trial_of_the_champion.h"
@@ -296,7 +296,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_black_knightAI>(creature);
+ return GetTrialOfTheChampionAI<boss_black_knightAI>(creature);
}
};
@@ -345,7 +345,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_risen_ghoulAI(creature);
+ return GetTrialOfTheChampionAI<npc_risen_ghoulAI>(creature);
}
};
@@ -374,7 +374,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_black_knight_skeletal_gryphonAI(creature);
+ return GetTrialOfTheChampionAI<npc_black_knight_skeletal_gryphonAI>(creature);
}
};
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp
index 19bfb02bd59..c08bcd75a88 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp
@@ -24,11 +24,13 @@ SDCategory: Trial Of the Champion
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptedEscortAI.h"
-#include "Vehicle.h"
#include "trial_of_the_champion.h"
-#include "Player.h"
+#include "Vehicle.h"
enum Spells
{
@@ -303,7 +305,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<generic_vehicleAI_toc5AI>(creature);
+ return GetTrialOfTheChampionAI<generic_vehicleAI_toc5AI>(creature);
}
};
@@ -440,7 +442,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_warrior_toc5AI>(creature);
+ return GetTrialOfTheChampionAI<boss_warrior_toc5AI>(creature);
}
};
@@ -583,7 +585,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_mage_toc5AI>(creature);
+ return GetTrialOfTheChampionAI<boss_mage_toc5AI>(creature);
}
};
@@ -734,7 +736,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_shaman_toc5AI>(creature);
+ return GetTrialOfTheChampionAI<boss_shaman_toc5AI>(creature);
}
};
@@ -894,7 +896,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_hunter_toc5AI>(creature);
+ return GetTrialOfTheChampionAI<boss_hunter_toc5AI>(creature);
}
};
@@ -1019,7 +1021,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_rouge_toc5AI>(creature);
+ return GetTrialOfTheChampionAI<boss_rouge_toc5AI>(creature);
}
};
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp
index 48db0ee6e4e..46e9792aafd 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp
@@ -22,18 +22,21 @@ SDCategory: Trial Of the Champion
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "Creature.h"
+#include "CreatureAI.h"
+#include "GameObject.h"
#include "InstanceScript.h"
-#include "trial_of_the_champion.h"
-#include "Player.h"
#include "Log.h"
+#include "Map.h"
+#include "Player.h"
+#include "trial_of_the_champion.h"
#define MAX_ENCOUNTER 4
class instance_trial_of_the_champion : public InstanceMapScript
{
public:
- instance_trial_of_the_champion() : InstanceMapScript("instance_trial_of_the_champion", 650) { }
+ instance_trial_of_the_champion() : InstanceMapScript(ToCScriptName, 650) { }
InstanceScript* GetInstanceScript(InstanceMap* map) const override
{
@@ -181,7 +184,7 @@ public:
{
pAnnouncer->GetMotionMaster()->MovePoint(0, 748.309f, 619.487f, 411.171f);
pAnnouncer->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
- pAnnouncer->SummonGameObject(instance->IsHeroic()? GO_CHAMPIONS_LOOT_H : GO_CHAMPIONS_LOOT, 746.59f, 618.49f, 411.09f, 1.42f, G3D::Quat(), 90000);
+ pAnnouncer->SummonGameObject(instance->IsHeroic()? GO_CHAMPIONS_LOOT_H : GO_CHAMPIONS_LOOT, 746.59f, 618.49f, 411.09f, 1.42f, QuaternionData(), 90000);
}
}
}
@@ -204,7 +207,7 @@ public:
{
pAnnouncer->GetMotionMaster()->MovePoint(0, 748.309f, 619.487f, 411.171f);
pAnnouncer->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
- pAnnouncer->SummonGameObject(instance->IsHeroic()? GO_EADRIC_LOOT_H : GO_EADRIC_LOOT, 746.59f, 618.49f, 411.09f, 1.42f, G3D::Quat(), 90000);
+ pAnnouncer->SummonGameObject(instance->IsHeroic()? GO_EADRIC_LOOT_H : GO_EADRIC_LOOT, 746.59f, 618.49f, 411.09f, 1.42f, QuaternionData(), 90000);
}
break;
case BOSS_ARGENT_CHALLENGE_P:
@@ -213,7 +216,7 @@ public:
{
pAnnouncer->GetMotionMaster()->MovePoint(0, 748.309f, 619.487f, 411.171f);
pAnnouncer->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
- pAnnouncer->SummonGameObject(instance->IsHeroic()? GO_PALETRESS_LOOT_H : GO_PALETRESS_LOOT, 746.59f, 618.49f, 411.09f, 1.42f, G3D::Quat(), 90000);
+ pAnnouncer->SummonGameObject(instance->IsHeroic()? GO_PALETRESS_LOOT_H : GO_PALETRESS_LOOT, 746.59f, 618.49f, 411.09f, 1.42f, QuaternionData(), 90000);
}
break;
}
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp
index 839488cff86..4af6e5991ab 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp
@@ -27,11 +27,16 @@ npc_announcer_toc5
EndContentData */
#include "ScriptMgr.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
+#include "TemporarySummon.h"
#include "trial_of_the_champion.h"
#include "Vehicle.h"
-#include "Player.h"
enum Yells
{
@@ -450,7 +455,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_announcer_toc5AI>(creature);
+ return GetTrialOfTheChampionAI<npc_announcer_toc5AI>(creature);
}
bool OnGossipHello(Player* player, Creature* creature) override
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.h b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.h
index d4be2f90f6e..e23df687caa 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.h
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.h
@@ -19,6 +19,9 @@
#ifndef DEF_TOC_H
#define DEF_TOC_H
+#include "CreatureAIImpl.h"
+
+#define ToCScriptName "instance_trial_of_the_champion"
#define DataHeader "TC"
enum TCData
@@ -127,4 +130,10 @@ enum TCVehicles
VEHICLE_BLACK_KNIGHT = 35491
};
+template<class AI>
+inline AI* GetTrialOfTheChampionAI(Creature* creature)
+{
+ return GetInstanceAI<AI>(creature, ToCScriptName);
+}
+
#endif
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp
index 14da165d1b2..48e80a6613e 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp
@@ -22,11 +22,13 @@
// Scarab - Kill credit isn't crediting?
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
-#include "trial_of_the_crusader.h"
#include "SpellScript.h"
#include "SpellAuraEffects.h"
-#include <limits>
+#include "TemporarySummon.h"
+#include "trial_of_the_crusader.h"
enum Yells
{
@@ -427,7 +429,7 @@ class boss_anubarak_trial : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_anubarak_trialAI>(creature);
+ return GetTrialOfTheCrusaderAI<boss_anubarak_trialAI>(creature);
};
};
@@ -505,7 +507,7 @@ class npc_swarm_scarab : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_swarm_scarabAI>(creature);
+ return GetTrialOfTheCrusaderAI<npc_swarm_scarabAI>(creature);
};
};
@@ -599,7 +601,7 @@ class npc_nerubian_burrower : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_nerubian_burrowerAI>(creature);
+ return GetTrialOfTheCrusaderAI<npc_nerubian_burrowerAI>(creature);
};
};
@@ -625,7 +627,8 @@ class npc_frost_sphere : public CreatureScript
if (me->GetHealth() <= damage)
{
damage = 0;
- float floorZ = me->GetMap()->GetHeight(me->GetPhases(), me->GetPositionX(), me->GetPositionY(), me->GetPositionZ());
+ float floorZ = me->GetPositionZ();
+ me->UpdateGroundPositionZ(me->GetPositionX(), me->GetPositionY(), floorZ);
if (fabs(me->GetPositionZ() - floorZ) < 0.1f)
{
// we are close to the ground
@@ -670,7 +673,7 @@ class npc_frost_sphere : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_frost_sphereAI(creature);
+ return GetTrialOfTheCrusaderAI<npc_frost_sphereAI>(creature);
};
};
@@ -823,7 +826,7 @@ class npc_anubarak_spike : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_anubarak_spikeAI(creature);
+ return GetTrialOfTheCrusaderAI<npc_anubarak_spikeAI>(creature);
};
};
@@ -868,9 +871,7 @@ class spell_anubarak_leeching_swarm : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_LEECHING_SWARM_DMG) || !sSpellMgr->GetSpellInfo(SPELL_LEECHING_SWARM_HEAL))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_LEECHING_SWARM_DMG, SPELL_LEECHING_SWARM_HEAL });
}
void HandleEffectPeriodic(AuraEffect const* aurEff)
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp
index a6c1009a4cc..b3b6f825777 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp
@@ -17,12 +17,16 @@
*/
#include "ScriptMgr.h"
+#include "GridNotifiers.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
#include "SpellAuraEffects.h"
+#include "TemporarySummon.h"
#include "trial_of_the_crusader.h"
-#include "Player.h"
-#include "GridNotifiers.h"
enum Yells
{
@@ -339,6 +343,32 @@ enum Events
EVENT_SPELL_LOCK = 2
};
+const Position FactionChampionLoc[] =
+{
+ { 514.231f, 105.569f, 418.234f, 0 }, // 0 - Horde Initial Pos 0
+ { 508.334f, 115.377f, 418.234f, 0 }, // 1 - Horde Initial Pos 1
+ { 506.454f, 126.291f, 418.234f, 0 }, // 2 - Horde Initial Pos 2
+ { 506.243f, 106.596f, 421.592f, 0 }, // 3 - Horde Initial Pos 3
+ { 499.885f, 117.717f, 421.557f, 0 }, // 4 - Horde Initial Pos 4
+
+ { 613.127f, 100.443f, 419.74f, 0 }, // 5 - Ally Initial Pos 0
+ { 621.126f, 128.042f, 418.231f, 0 }, // 6 - Ally Initial Pos 1
+ { 618.829f, 113.606f, 418.232f, 0 }, // 7 - Ally Initial Pos 2
+ { 625.845f, 112.914f, 421.575f, 0 }, // 8 - Ally Initial Pos 3
+ { 615.566f, 109.653f, 418.234f, 0 }, // 9 - Ally Initial Pos 4
+
+ { 535.469f, 113.012f, 394.66f, 0 }, // 10 - Horde Final Pos 0
+ { 526.417f, 137.465f, 394.749f, 0 }, // 11 - Horde Final Pos 1
+ { 528.108f, 111.057f, 395.289f, 0 }, // 12 - Horde Final Pos 2
+ { 519.92f, 134.285f, 395.289f, 0 }, // 13 - Horde Final Pos 3
+ { 533.648f, 119.148f, 394.646f, 0 }, // 14 - Horde Final Pos 4
+ { 531.399f, 125.63f, 394.708f, 0 }, // 15 - Horde Final Pos 5
+ { 528.958f, 131.47f, 394.73f, 0 }, // 16 - Horde Final Pos 6
+ { 526.309f, 116.667f, 394.833f, 0 }, // 17 - Horde Final Pos 7
+ { 524.238f, 122.411f, 394.819f, 0 }, // 18 - Horde Final Pos 8
+ { 521.901f, 128.488f, 394.832f, 0 } // 19 - Horde Final Pos 9
+};
+
class boss_toc_champion_controller : public CreatureScript
{
public:
@@ -384,7 +414,7 @@ class boss_toc_champion_controller : public CreatureScript
vOtherEntries.push_back(playerTeam == ALLIANCE ? NPC_HORDE_WARRIOR : NPC_ALLIANCE_WARRIOR);
uint8 healersSubtracted = 2;
- if (_instance->instance->GetSpawnMode() == DIFFICULTY_25_N || _instance->instance->GetSpawnMode() == DIFFICULTY_25_HC)
+ if (Is25ManRaid())
healersSubtracted = 1;
for (uint8 i = 0; i < healersSubtracted; ++i)
{
@@ -421,7 +451,7 @@ class boss_toc_champion_controller : public CreatureScript
vHealersEntries.erase(vHealersEntries.begin() + pos);
}
- if (_instance->instance->GetSpawnMode() == DIFFICULTY_10_N || _instance->instance->GetSpawnMode() == DIFFICULTY_10_HC)
+ if (!Is25ManRaid())
for (uint8 i = 0; i < 4; ++i)
vOtherEntries.erase(vOtherEntries.begin() + urand(0, vOtherEntries.size() - 1));
@@ -545,7 +575,7 @@ class boss_toc_champion_controller : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_toc_champion_controllerAI>(creature);
+ return GetTrialOfTheCrusaderAI<boss_toc_champion_controllerAI>(creature);
}
};
@@ -835,7 +865,7 @@ class npc_toc_druid : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_toc_druidAI>(creature);
+ return GetTrialOfTheCrusaderAI<npc_toc_druidAI>(creature);
}
};
@@ -928,7 +958,7 @@ class npc_toc_shaman : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_toc_shamanAI>(creature);
+ return GetTrialOfTheCrusaderAI<npc_toc_shamanAI>(creature);
}
};
@@ -1032,7 +1062,7 @@ class npc_toc_paladin : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_toc_paladinAI>(creature);
+ return GetTrialOfTheCrusaderAI<npc_toc_paladinAI>(creature);
}
};
@@ -1117,7 +1147,7 @@ class npc_toc_priest : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_toc_priestAI>(creature);
+ return GetTrialOfTheCrusaderAI<npc_toc_priestAI>(creature);
}
};
@@ -1215,7 +1245,7 @@ class npc_toc_shadow_priest : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_toc_shadow_priestAI>(creature);
+ return GetTrialOfTheCrusaderAI<npc_toc_shadow_priestAI>(creature);
}
};
@@ -1306,7 +1336,7 @@ class npc_toc_warlock : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_toc_warlockAI>(creature);
+ return GetTrialOfTheCrusaderAI<npc_toc_warlockAI>(creature);
}
};
@@ -1400,7 +1430,7 @@ class npc_toc_mage : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_toc_mageAI>(creature);
+ return GetTrialOfTheCrusaderAI<npc_toc_mageAI>(creature);
}
};
@@ -1502,7 +1532,7 @@ class npc_toc_hunter : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_toc_hunterAI>(creature);
+ return GetTrialOfTheCrusaderAI<npc_toc_hunterAI>(creature);
}
};
@@ -1594,7 +1624,7 @@ class npc_toc_boomkin : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_toc_boomkinAI>(creature);
+ return GetTrialOfTheCrusaderAI<npc_toc_boomkinAI>(creature);
}
};
@@ -1698,7 +1728,7 @@ class npc_toc_warrior : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_toc_warriorAI>(creature);
+ return GetTrialOfTheCrusaderAI<npc_toc_warriorAI>(creature);
}
};
@@ -1794,7 +1824,7 @@ class npc_toc_dk : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_toc_dkAI>(creature);
+ return GetTrialOfTheCrusaderAI<npc_toc_dkAI>(creature);
}
};
@@ -1899,7 +1929,7 @@ class npc_toc_rogue : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_toc_rogueAI>(creature);
+ return GetTrialOfTheCrusaderAI<npc_toc_rogueAI>(creature);
}
};
@@ -2033,7 +2063,7 @@ class npc_toc_enh_shaman : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_toc_enh_shamanAI>(creature);
+ return GetTrialOfTheCrusaderAI<npc_toc_enh_shamanAI>(creature);
}
};
@@ -2139,7 +2169,7 @@ class npc_toc_retro_paladin : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_toc_retro_paladinAI>(creature);
+ return GetTrialOfTheCrusaderAI<npc_toc_retro_paladinAI>(creature);
}
};
@@ -2191,7 +2221,7 @@ class npc_toc_pet_warlock : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_toc_pet_warlockAI>(creature);
+ return GetTrialOfTheCrusaderAI<npc_toc_pet_warlockAI>(creature);
}
};
@@ -2239,7 +2269,7 @@ class npc_toc_pet_hunter : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_toc_pet_hunterAI>(creature);
+ return GetTrialOfTheCrusaderAI<npc_toc_pet_hunterAI>(creature);
}
};
@@ -2254,9 +2284,7 @@ class spell_faction_champion_warl_unstable_affliction : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_UNSTABLE_AFFLICTION_DISPEL))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_UNSTABLE_AFFLICTION_DISPEL });
}
void HandleDispel(DispelInfo* dispelInfo)
@@ -2288,18 +2316,12 @@ class spell_faction_champion_death_grip : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DEATH_GRIP_PULL))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DEATH_GRIP_PULL });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
- if (Unit* target = GetHitUnit())
- {
- if (Unit* caster = GetCaster())
- target->CastSpell(caster, SPELL_DEATH_GRIP_PULL);
- }
+ GetHitUnit()->CastSpell(GetCaster(), SPELL_DEATH_GRIP_PULL);
}
void Register() override
@@ -2326,9 +2348,7 @@ class spell_toc_bloodlust : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(AURA_SATED))
- return false;
- return true;
+ return ValidateSpellInfo({ AURA_SATED });
}
void RemoveInvalidTargets(std::list<WorldObject*>& targets)
@@ -2367,9 +2387,7 @@ class spell_toc_heroism : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(AURA_EXHAUSTION))
- return false;
- return true;
+ return ValidateSpellInfo({ AURA_EXHAUSTION });
}
void RemoveInvalidTargets(std::list<WorldObject*>& targets)
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp
index a5f62a81f47..c4885676330 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp
@@ -20,7 +20,6 @@
#include "InstanceScript.h"
#include "ScriptedCreature.h"
#include "SpellInfo.h"
-#include "SpellMgr.h"
#include "SpellScript.h"
#include "trial_of_the_crusader.h"
@@ -209,7 +208,7 @@ class boss_jaraxxus : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_jaraxxusAI>(creature);
+ return GetTrialOfTheCrusaderAI<boss_jaraxxusAI>(creature);
}
};
@@ -245,7 +244,7 @@ class npc_legion_flame : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_legion_flameAI>(creature);
+ return GetTrialOfTheCrusaderAI<npc_legion_flameAI>(creature);
}
};
@@ -352,7 +351,7 @@ class npc_fel_infernal : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_fel_infernalAI>(creature);
+ return GetTrialOfTheCrusaderAI<npc_fel_infernalAI>(creature);
}
};
@@ -403,7 +402,7 @@ class npc_nether_portal : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_nether_portalAI(creature);
+ return GetTrialOfTheCrusaderAI<npc_nether_portalAI>(creature);
}
};
@@ -481,7 +480,7 @@ class npc_mistress_of_pain : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_mistress_of_painAI>(creature);
+ return GetTrialOfTheCrusaderAI<npc_mistress_of_painAI>(creature);
}
};
@@ -496,10 +495,7 @@ class spell_mistress_kiss : public SpellScriptLoader
bool Load() override
{
- if (GetCaster())
- if (sSpellMgr->GetSpellInfo(SPELL_MISTRESS_KISS_DAMAGE_SILENCE))
- return true;
- return false;
+ return ValidateSpellInfo({ SPELL_MISTRESS_KISS_DAMAGE_SILENCE });
}
void HandleDummyTick(AuraEffect const* /*aurEff*/)
@@ -592,9 +588,7 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_FEL_STREAK))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_FEL_STREAK });
}
void HandleScript(SpellEffIndex /*effIndex*/)
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp
index 0b927ab231c..9b404606fbe 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp
@@ -20,12 +20,16 @@
// Gormok - Snobolled (creature at back)
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "trial_of_the_crusader.h"
-#include "Vehicle.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "ScriptedCreature.h"
#include "SpellScript.h"
#include "SpellAuraEffects.h"
+#include "TemporarySummon.h"
+#include "trial_of_the_crusader.h"
+#include "Vehicle.h"
enum Yells
{
@@ -288,7 +292,7 @@ class boss_gormok : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_gormokAI>(creature);
+ return GetTrialOfTheCrusaderAI<boss_gormokAI>(creature);
}
};
@@ -449,7 +453,7 @@ class npc_snobold_vassal : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_snobold_vassalAI>(creature);
+ return GetTrialOfTheCrusaderAI<npc_snobold_vassalAI>(creature);
}
};
@@ -485,7 +489,7 @@ class npc_firebomb : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_firebombAI>(creature);
+ return GetTrialOfTheCrusaderAI<npc_firebombAI>(creature);
}
};
@@ -713,7 +717,7 @@ class boss_acidmaw : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_acidmawAI>(creature);
+ return GetTrialOfTheCrusaderAI<boss_acidmawAI>(creature);
}
};
@@ -777,7 +781,7 @@ class boss_dreadscale : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_dreadscaleAI>(creature);
+ return GetTrialOfTheCrusaderAI<boss_dreadscaleAI>(creature);
}
};
@@ -824,7 +828,7 @@ class npc_slime_pool : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_slime_poolAI>(creature);
+ return GetTrialOfTheCrusaderAI<npc_slime_poolAI>(creature);
}
};
@@ -1141,7 +1145,7 @@ class boss_icehowl : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_icehowlAI>(creature);
+ return GetTrialOfTheCrusaderAI<boss_icehowlAI>(creature);
}
};
@@ -1156,9 +1160,7 @@ public:
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PARALYSIS))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_PARALYSIS });
}
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -1227,9 +1229,7 @@ public:
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(_spellId))
- return false;
- return true;
+ return ValidateSpellInfo({ _spellId });
}
void HandleScript(SpellEffIndex /*effIndex*/)
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp
index 7dadf497e10..d6041d72b35 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp
@@ -21,14 +21,15 @@
// - Hardcoded bullets spawner
#include "ScriptMgr.h"
+#include "CellImpl.h"
+#include "GridNotifiersImpl.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
-#include "SpellScript.h"
#include "SpellAuraEffects.h"
-#include "GridNotifiers.h"
-#include "GridNotifiersImpl.h"
-#include "Cell.h"
-#include "CellImpl.h"
+#include "SpellScript.h"
#include "trial_of_the_crusader.h"
enum Texts
@@ -443,7 +444,7 @@ class boss_fjola : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_fjolaAI>(creature);
+ return GetTrialOfTheCrusaderAI<boss_fjolaAI>(creature);
}
};
@@ -476,7 +477,7 @@ class boss_eydis : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_eydisAI>(creature);
+ return GetTrialOfTheCrusaderAI<boss_eydisAI>(creature);
}
};
@@ -510,7 +511,7 @@ class npc_essence_of_twin : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_essence_of_twinAI(creature);
+ return GetTrialOfTheCrusaderAI<npc_essence_of_twinAI>(creature);
};
bool OnGossipHello(Player* player, Creature* creature) override
@@ -609,7 +610,7 @@ class npc_unleashed_dark : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_unleashed_darkAI(creature);
+ return GetTrialOfTheCrusaderAI<npc_unleashed_darkAI>(creature);
}
};
@@ -641,7 +642,7 @@ class npc_unleashed_light : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_unleashed_lightAI(creature);
+ return GetTrialOfTheCrusaderAI<npc_unleashed_lightAI>(creature);
}
};
@@ -670,7 +671,7 @@ class npc_bullet_controller : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_bullet_controllerAI(creature);
+ return GetTrialOfTheCrusaderAI<npc_bullet_controllerAI>(creature);
}
};
@@ -729,21 +730,17 @@ class spell_valkyr_essences : public SpellScriptLoader
{
PrepareAuraScript(spell_valkyr_essences_AuraScript);
- public:
- spell_valkyr_essences_AuraScript()
- {
- spellId = 0;
- }
-
- private:
- uint32 spellId;
-
bool Load() override
{
- spellId = SPELL_SURGE_OF_SPEED;
- if (!sSpellMgr->GetSpellInfo(spellId))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_SURGE_OF_SPEED,
+ SPELL_LIGHT_VORTEX_DAMAGE,
+ SPELL_DARK_VORTEX_DAMAGE,
+ SPELL_POWERING_UP,
+ SPELL_UNLEASHED_DARK,
+ SPELL_UNLEASHED_LIGHT
+ });
}
void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & /*absorbAmount*/)
@@ -753,16 +750,14 @@ class spell_valkyr_essences : public SpellScriptLoader
if (dmgInfo.GetSpellInfo())
{
if (urand(0, 99) < 5)
- GetTarget()->CastSpell(GetTarget(), spellId, true);
+ GetTarget()->CastSpell(GetTarget(), SPELL_SURGE_OF_SPEED, true);
// Twin Vortex part
- uint32 lightVortex = SPELL_LIGHT_VORTEX_DAMAGE;
- uint32 darkVortex = SPELL_DARK_VORTEX_DAMAGE;
int32 stacksCount = dmgInfo.GetSpellInfo()->GetEffect(EFFECT_0)->CalcValue() / 1000 - 1;
- if (lightVortex && darkVortex && stacksCount)
+ if (stacksCount)
{
- if (dmgInfo.GetSpellInfo()->Id == darkVortex || dmgInfo.GetSpellInfo()->Id == lightVortex)
+ if (dmgInfo.GetSpellInfo()->Id == SPELL_DARK_VORTEX_DAMAGE || dmgInfo.GetSpellInfo()->Id == SPELL_LIGHT_VORTEX_DAMAGE)
{
Aura* pAura = owner->GetAura(SPELL_POWERING_UP);
if (pAura)
@@ -780,27 +775,21 @@ class spell_valkyr_essences : public SpellScriptLoader
}
// Picking floating balls
- uint32 unleashedDark = SPELL_UNLEASHED_DARK;
- uint32 unleashedLight = SPELL_UNLEASHED_LIGHT;
-
- if (unleashedDark && unleashedLight)
+ if (dmgInfo.GetSpellInfo()->Id == SPELL_UNLEASHED_DARK || dmgInfo.GetSpellInfo()->Id == SPELL_UNLEASHED_LIGHT)
{
- if (dmgInfo.GetSpellInfo()->Id == unleashedDark || dmgInfo.GetSpellInfo()->Id == unleashedLight)
+ // need to do the things in this order, else players might have 100 charges of Powering Up without anything happening
+ Aura* pAura = owner->GetAura(SPELL_POWERING_UP);
+ if (pAura)
{
- // need to do the things in this order, else players might have 100 charges of Powering Up without anything happening
- Aura* pAura = owner->GetAura(SPELL_POWERING_UP);
- if (pAura)
- {
- // 2 lines together add the correct amount of buff stacks
- pAura->ModStackAmount(stacksCount);
- owner->CastSpell(owner, SPELL_POWERING_UP, true);
- }
- else
- {
- owner->CastSpell(owner, SPELL_POWERING_UP, true);
- if (Aura* pTemp = owner->GetAura(SPELL_POWERING_UP))
- pTemp->ModStackAmount(stacksCount);
- }
+ // 2 lines together add the correct amount of buff stacks
+ pAura->ModStackAmount(stacksCount);
+ owner->CastSpell(owner, SPELL_POWERING_UP, true);
+ }
+ else
+ {
+ owner->CastSpell(owner, SPELL_POWERING_UP, true);
+ if (Aura* pTemp = owner->GetAura(SPELL_POWERING_UP))
+ pTemp->ModStackAmount(stacksCount);
}
}
}
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp
index eafad7be015..ce56f6b8030 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp
@@ -16,14 +16,18 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "ScriptMgr.h"
+#include "AreaBoundary.h"
+#include "GameObject.h"
#include "InstanceScript.h"
#include "Log.h"
+#include "Map.h"
#include "Player.h"
-#include "ScriptMgr.h"
-#include "trial_of_the_crusader.h"
#include "TemporarySummon.h"
+#include "trial_of_the_crusader.h"
-BossBoundaryData const boundaries = {
+BossBoundaryData const boundaries =
+{
{ BOSS_BEASTS, new CircleBoundary(Position(563.26f, 139.6f), 75.0) },
{ BOSS_JARAXXUS, new CircleBoundary(Position(563.26f, 139.6f), 75.0) },
{ BOSS_CRUSADERS, new CircleBoundary(Position(563.26f, 139.6f), 75.0) },
@@ -34,7 +38,7 @@ BossBoundaryData const boundaries = {
class instance_trial_of_the_crusader : public InstanceMapScript
{
public:
- instance_trial_of_the_crusader() : InstanceMapScript("instance_trial_of_the_crusader", 649) { }
+ instance_trial_of_the_crusader() : InstanceMapScript(ToCrScriptName, 649) { }
struct instance_trial_of_the_crusader_InstanceMapScript : public InstanceScript
{
@@ -80,7 +84,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript
// make sure Anub'arak isnt missing
if (GetBossState(BOSS_LICH_KING) == DONE && TrialCounter && GetBossState(BOSS_ANUBARAK) != DONE)
- if (!ObjectAccessor::GetCreature(*player, GetGuidData(NPC_ANUBARAK)))
+ if (!instance->GetCreature(AnubarakGUID))
player->SummonCreature(NPC_ANUBARAK, AnubarakLoc[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME);
}
@@ -315,7 +319,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript
if (tributeChest)
if (Creature* tirion = instance->GetCreature(TirionGUID))
- if (GameObject* chest = tirion->SummonGameObject(tributeChest, 805.62f, 134.87f, 142.16f, 3.27f, G3D::Quat(), WEEK))
+ if (GameObject* chest = tirion->SummonGameObject(tributeChest, 805.62f, 134.87f, 142.16f, 3.27f, QuaternionData(), WEEK))
chest->SetRespawnTime(chest->GetRespawnDelay());
break;
}
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp
index 711be2c5772..76313a9bd4a 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp
@@ -20,10 +20,15 @@
// - Need better implementation of Gossip and correct gossip text and option
#include "ScriptMgr.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
+#include "TemporarySummon.h"
#include "trial_of_the_crusader.h"
-#include "Player.h"
enum Yells
{
@@ -81,6 +86,73 @@ enum Yells
SAY_STAGE_4_07 = 1
};
+Position const ToCSpawnLoc[] =
+{
+ { 563.912f, 261.625f, 394.73f, 4.70437f }, // 0 Center
+ { 575.451f, 261.496f, 394.73f, 4.6541f }, // 1 Left
+ { 549.951f, 261.55f, 394.73f, 4.74835f } // 2 Right
+};
+
+Position const ToCCommonLoc[23] =
+{
+ { 559.257996f, 90.266197f, 395.122986f, 0 }, // 0 Barrent
+
+ { 563.672974f, 139.571f, 393.837006f, 0 }, // 1 Center
+ { 563.833008f, 187.244995f, 394.5f, 0 }, // 2 Backdoor
+ { 577.347839f, 195.338888f, 395.14f, 0 }, // 3 - Right
+ { 550.955933f, 195.338888f, 395.14f, 0 }, // 4 - Left
+ { 563.833008f, 195.244995f, 394.585561f, 0 }, // 5 - Center
+ { 573.5f, 180.5f, 395.14f, 0 }, // 6 Move 0 Right
+ { 553.5f, 180.5f, 395.14f, 0 }, // 7 Move 0 Left
+ { 573.0f, 170.0f, 395.14f, 0 }, // 8 Move 1 Right
+ { 555.5f, 170.0f, 395.14f, 0 }, // 9 Move 1 Left
+ { 563.8f, 216.1f, 395.1f, 0 }, // 10 Behind the door
+
+ { 575.042358f, 195.260727f, 395.137146f, 0 }, // 5
+ { 552.248901f, 195.331955f, 395.132658f, 0 }, // 6
+ { 573.342285f, 195.515823f, 395.135956f, 0 }, // 7
+ { 554.239929f, 195.825577f, 395.137909f, 0 }, // 8
+ { 571.042358f, 195.260727f, 395.137146f, 0 }, // 9
+ { 556.720581f, 195.015472f, 395.132658f, 0 }, // 10
+ { 569.534119f, 195.214478f, 395.139526f, 0 }, // 11
+ { 569.231201f, 195.941071f, 395.139526f, 0 }, // 12
+ { 558.811610f, 195.985779f, 394.671661f, 0 }, // 13
+ { 567.641724f, 195.351501f, 394.659943f, 0 }, // 14
+ { 560.633972f, 195.391708f, 395.137543f, 0 }, // 15
+ { 565.816956f, 195.477921f, 395.136810f, 0 } // 16
+};
+
+Position const TwinValkyrsLoc[] =
+{
+ { 586.060242f, 117.514809f, 394.41f, 0 }, // 0 - Dark essence 1
+ { 541.602112f, 161.879837f, 394.41f, 0 }, // 1 - Dark essence 2
+ { 541.021118f, 117.262932f, 394.41f, 0 }, // 2 - Light essence 1
+ { 586.200562f, 162.145523f, 394.41f, 0 } // 3 - Light essence 2
+};
+
+Position const LichKingLoc[] =
+{
+ { 563.549f, 152.474f, 394.393f, 0 }, // 0 - Lich king start
+ { 563.547f, 141.613f, 393.908f, 0 } // 1 - Lich king end
+};
+
+Position const AnubarakLoc[6] =
+{
+ { 783.9305f, 132.9722f, 142.6711f, 3.141593f }, // 0 - Anub'arak Spawn Location (sniffed)
+ { 695.240051f, 137.834824f, 142.200000f, 0 }, // 1 - Anub'arak move point location
+ { 694.886353f, 102.484665f, 142.119614f, 0 }, // 3 - Nerub Spawn
+ { 694.500671f, 185.363968f, 142.117905f, 0 }, // 5 - Nerub Spawn
+ { 731.987244f, 83.3824690f, 142.119614f, 0 }, // 2 - Nerub Spawn
+ { 740.184509f, 193.443390f, 142.117584f, 0 } // 4 - Nerub Spawn
+};
+
+Position const EndSpawnLoc[] =
+{
+ { 648.9167f, 131.0208f, 141.6161f, 0.f }, // 0 - Highlord Tirion Fordring
+ { 649.1614f, 142.0399f, 141.3057f, 0.f }, // 1 - Argent Mage
+ { 644.6250f, 149.2743f, 140.6015f, 5.f } // 2 - Portal to Dalaran
+};
+
struct _Messages
{
AnnouncerMessages msgnum;
@@ -211,7 +283,7 @@ class npc_announcer_toc10 : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_announcer_toc10AI(creature);
+ return GetTrialOfTheCrusaderAI<npc_announcer_toc10AI>(creature);
}
};
@@ -340,7 +412,7 @@ class boss_lich_king_toc : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_lich_king_tocAI>(creature);
+ return GetTrialOfTheCrusaderAI<boss_lich_king_tocAI>(creature);
}
};
@@ -510,7 +582,7 @@ class npc_fizzlebang_toc : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_fizzlebang_tocAI>(creature);
+ return GetTrialOfTheCrusaderAI<npc_fizzlebang_tocAI>(creature);
}
};
@@ -756,7 +828,7 @@ class npc_tirion_toc : public CreatureScript
case 6000:
me->SummonCreature(NPC_TIRION_FORDRING, EndSpawnLoc[0]);
me->SummonCreature(NPC_ARGENT_MAGE, EndSpawnLoc[1]);
- me->SummonGameObject(GO_PORTAL_TO_DALARAN, EndSpawnLoc[2], G3D::Quat(), 0);
+ me->SummonGameObject(GO_PORTAL_TO_DALARAN, EndSpawnLoc[2], QuaternionData(), 0);
_updateTimer = 20*IN_MILLISECONDS;
_instance->SetData(TYPE_EVENT, 6005);
break;
@@ -797,7 +869,7 @@ class npc_tirion_toc : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_tirion_tocAI>(creature);
+ return GetTrialOfTheCrusaderAI<npc_tirion_tocAI>(creature);
}
};
@@ -880,7 +952,7 @@ class npc_garrosh_toc : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_garrosh_tocAI>(creature);
+ return GetTrialOfTheCrusaderAI<npc_garrosh_tocAI>(creature);
}
};
@@ -963,7 +1035,7 @@ class npc_varian_toc : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_varian_tocAI>(creature);
+ return GetTrialOfTheCrusaderAI<npc_varian_tocAI>(creature);
}
};
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h
index 5178961d651..9a0aad724e7 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h
@@ -1,12 +1,31 @@
-/* Copyright (C) 2009 - 2010 by /dev/rsa for ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
- * This program is free software licensed under GPL version 2
- * Please see the included DOCS/LICENSE.TXT for more information */
+/*
+ * Copyright (C) 2008-2017 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
+ *
+ * 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 2 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/>.
+ */
#ifndef DEF_CRUSADER_H
#define DEF_CRUSADER_H
+#include "CreatureAIImpl.h"
+
+#define ToCrScriptName "instance_trial_of_the_crusader"
#define DataHeader "TCR"
+struct Position;
+
enum TCRDataTypes
{
BOSS_BEASTS = 0,
@@ -44,106 +63,8 @@ enum TCRMiscData
DESPAWN_TIME = 1200000
};
-const Position ToCSpawnLoc[]=
-{
- {563.912f, 261.625f, 394.73f, 4.70437f}, // 0 Center
- {575.451f, 261.496f, 394.73f, 4.6541f}, // 1 Left
- {549.951f, 261.55f, 394.73f, 4.74835f} // 2 Right
-};
-
-const Position ToCCommonLoc[]=
-{
- {559.257996f, 90.266197f, 395.122986f, 0}, // 0 Barrent
-
- {563.672974f, 139.571f, 393.837006f, 0}, // 1 Center
- {563.833008f, 187.244995f, 394.5f, 0}, // 2 Backdoor
- {577.347839f, 195.338888f, 395.14f, 0}, // 3 - Right
- {550.955933f, 195.338888f, 395.14f, 0}, // 4 - Left
- {563.833008f, 195.244995f, 394.585561f, 0}, // 5 - Center
- {573.5f, 180.5f, 395.14f, 0}, // 6 Move 0 Right
- {553.5f, 180.5f, 395.14f, 0}, // 7 Move 0 Left
- {573.0f, 170.0f, 395.14f, 0}, // 8 Move 1 Right
- {555.5f, 170.0f, 395.14f, 0}, // 9 Move 1 Left
- {563.8f, 216.1f, 395.1f, 0}, // 10 Behind the door
-
- {575.042358f, 195.260727f, 395.137146f, 0}, // 5
- {552.248901f, 195.331955f, 395.132658f, 0}, // 6
- {573.342285f, 195.515823f, 395.135956f, 0}, // 7
- {554.239929f, 195.825577f, 395.137909f, 0}, // 8
- {571.042358f, 195.260727f, 395.137146f, 0}, // 9
- {556.720581f, 195.015472f, 395.132658f, 0}, // 10
- {569.534119f, 195.214478f, 395.139526f, 0}, // 11
- {569.231201f, 195.941071f, 395.139526f, 0}, // 12
- {558.811610f, 195.985779f, 394.671661f, 0}, // 13
- {567.641724f, 195.351501f, 394.659943f, 0}, // 14
- {560.633972f, 195.391708f, 395.137543f, 0}, // 15
- {565.816956f, 195.477921f, 395.136810f, 0} // 16
-};
-
-const Position JaraxxusLoc[]=
-{
- {508.104767f, 138.247345f, 395.128052f, 0}, // 0 - Fizzlebang start location
- {548.610596f, 139.807800f, 394.321838f, 0}, // 1 - fizzlebang end
- {581.854187f, 138.0f, 394.319f, 0}, // 2 - Portal Right
- {550.558838f, 138.0f, 394.319f, 0} // 3 - Portal Left
-};
-
-const Position FactionChampionLoc[]=
-{
- {514.231f, 105.569f, 418.234f, 0}, // 0 - Horde Initial Pos 0
- {508.334f, 115.377f, 418.234f, 0}, // 1 - Horde Initial Pos 1
- {506.454f, 126.291f, 418.234f, 0}, // 2 - Horde Initial Pos 2
- {506.243f, 106.596f, 421.592f, 0}, // 3 - Horde Initial Pos 3
- {499.885f, 117.717f, 421.557f, 0}, // 4 - Horde Initial Pos 4
-
- {613.127f, 100.443f, 419.74f, 0}, // 5 - Ally Initial Pos 0
- {621.126f, 128.042f, 418.231f, 0}, // 6 - Ally Initial Pos 1
- {618.829f, 113.606f, 418.232f, 0}, // 7 - Ally Initial Pos 2
- {625.845f, 112.914f, 421.575f, 0}, // 8 - Ally Initial Pos 3
- {615.566f, 109.653f, 418.234f, 0}, // 9 - Ally Initial Pos 4
-
- {535.469f, 113.012f, 394.66f, 0}, // 10 - Horde Final Pos 0
- {526.417f, 137.465f, 394.749f, 0}, // 11 - Horde Final Pos 1
- {528.108f, 111.057f, 395.289f, 0}, // 12 - Horde Final Pos 2
- {519.92f, 134.285f, 395.289f, 0}, // 13 - Horde Final Pos 3
- {533.648f, 119.148f, 394.646f, 0}, // 14 - Horde Final Pos 4
- {531.399f, 125.63f, 394.708f, 0}, // 15 - Horde Final Pos 5
- {528.958f, 131.47f, 394.73f, 0}, // 16 - Horde Final Pos 6
- {526.309f, 116.667f, 394.833f, 0}, // 17 - Horde Final Pos 7
- {524.238f, 122.411f, 394.819f, 0}, // 18 - Horde Final Pos 8
- {521.901f, 128.488f, 394.832f, 0} // 19 - Horde Final Pos 9
-};
-
-const Position TwinValkyrsLoc[]=
-{
- {586.060242f, 117.514809f, 394.41f, 0}, // 0 - Dark essence 1
- {541.602112f, 161.879837f, 394.41f, 0}, // 1 - Dark essence 2
- {541.021118f, 117.262932f, 394.41f, 0}, // 2 - Light essence 1
- {586.200562f, 162.145523f, 394.41f, 0} // 3 - Light essence 2
-};
-
-const Position LichKingLoc[]=
-{
- {563.549f, 152.474f, 394.393f, 0}, // 0 - Lich king start
- {563.547f, 141.613f, 393.908f, 0} // 1 - Lich king end
-};
-
-const Position AnubarakLoc[]=
-{
- {783.9305f, 132.9722f, 142.6711f, 3.141593f}, // 0 - Anub'arak Spawn Location (sniffed)
- {695.240051f, 137.834824f, 142.200000f, 0}, // 1 - Anub'arak move point location
- {694.886353f, 102.484665f, 142.119614f, 0}, // 3 - Nerub Spawn
- {694.500671f, 185.363968f, 142.117905f, 0}, // 5 - Nerub Spawn
- {731.987244f, 83.3824690f, 142.119614f, 0}, // 2 - Nerub Spawn
- {740.184509f, 193.443390f, 142.117584f, 0} // 4 - Nerub Spawn
-};
-
-const Position EndSpawnLoc[]=
-{
- {648.9167f, 131.0208f, 141.6161f, 0.f}, // 0 - Highlord Tirion Fordring
- {649.1614f, 142.0399f, 141.3057f, 0.f}, // 1 - Argent Mage
- {644.6250f, 149.2743f, 140.6015f, 5.f} // 2 - Portal to Dalaran
-};
+extern Position const ToCCommonLoc[];
+extern Position const AnubarakLoc[];
enum TCRWorldStateIds
{
@@ -298,4 +219,10 @@ enum TCRAchievementData
EVENT_START_TWINS_FIGHT = 21853
};
+template<typename AI>
+inline AI* GetTrialOfTheCrusaderAI(Creature* creature)
+{
+ return GetInstanceAI<AI>(creature, ToCrScriptName);
+}
+
#endif
diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_king_dred.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_king_dred.cpp
index 58c7f780adb..57a60bc86ff 100644
--- a/src/server/scripts/Northrend/DraktharonKeep/boss_king_dred.cpp
+++ b/src/server/scripts/Northrend/DraktharonKeep/boss_king_dred.cpp
@@ -20,8 +20,10 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "drak_tharon_keep.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
enum Spells
{
diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp
index cc85481b3d6..22fa07bd2ef 100644
--- a/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp
+++ b/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp
@@ -16,9 +16,12 @@
*/
#include "ScriptMgr.h"
-#include "SpellScript.h"
-#include "ScriptedCreature.h"
#include "drak_tharon_keep.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
enum Yells
{
@@ -393,9 +396,7 @@ class spell_novos_summon_minions : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_COPY_OF_MINIONS))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SUMMON_COPY_OF_MINIONS });
}
void HandleScript(SpellEffIndex /*effIndex*/)
diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp
index 00676a0a3c3..663afae9d6f 100644
--- a/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp
+++ b/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp
@@ -16,11 +16,9 @@
*/
#include "ScriptMgr.h"
+#include "drak_tharon_keep.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
-#include "SpellAuraEffects.h"
-#include "Player.h"
-#include "drak_tharon_keep.h"
/*
* Known Issues: Spell 49356 and 53463 will be interrupted for an unknown reason
@@ -219,9 +217,7 @@ class spell_tharon_ja_clear_gift_of_tharon_ja : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_GIFT_OF_THARON_JA))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_GIFT_OF_THARON_JA });
}
void HandleScript(SpellEffIndex /*effIndex*/)
diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp
index 3c008c1ccf7..77962c46db1 100644
--- a/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp
+++ b/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp
@@ -16,10 +16,12 @@
*/
#include "ScriptMgr.h"
+#include "drak_tharon_keep.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
-#include "SpellScript.h"
#include "SpellAuraEffects.h"
-#include "drak_tharon_keep.h"
+#include "SpellScript.h"
enum Spells
{
@@ -234,9 +236,7 @@ class spell_trollgore_consume : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_CONSUME_BUFF))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_CONSUME_BUFF });
}
void HandleConsume(SpellEffIndex /*effIndex*/)
@@ -269,9 +269,7 @@ class spell_trollgore_corpse_explode : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_CORPSE_EXPLODE_DAMAGE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_CORPSE_EXPLODE_DAMAGE });
}
void PeriodicTick(AuraEffect const* aurEff)
@@ -312,9 +310,7 @@ class spell_trollgore_invader_taunt : public SpellScriptLoader
bool Validate(SpellInfo const* spellInfo) override
{
- if (!sSpellMgr->GetSpellInfo(spellInfo->GetEffect(EFFECT_0)->CalcValue()))
- return false;
- return true;
+ return spellInfo->GetEffect(EFFECT_0) && ValidateSpellInfo({ uint32(spellInfo->GetEffect(EFFECT_0)->CalcValue()) });
}
void HandleTaunt(SpellEffIndex /*effIndex*/)
diff --git a/src/server/scripts/Northrend/DraktharonKeep/drak_tharon_keep.h b/src/server/scripts/Northrend/DraktharonKeep/drak_tharon_keep.h
index de016aed14e..9421eb23e53 100644
--- a/src/server/scripts/Northrend/DraktharonKeep/drak_tharon_keep.h
+++ b/src/server/scripts/Northrend/DraktharonKeep/drak_tharon_keep.h
@@ -18,6 +18,8 @@
#ifndef DRAK_THARON_KEEP_H_
#define DRAK_THARON_KEEP_H_
+#include "CreatureAIImpl.h"
+
#define DrakTharonKeepScriptName "instance_drak_tharon_keep"
#define DataHeader "DTK"
@@ -84,8 +86,8 @@ enum DTKGameObjectIds
GO_NOVOS_CRYSTAL_4 = 189302
};
-template<class AI>
-AI* GetDrakTharonKeepAI(Creature* creature)
+template<typename AI>
+inline AI* GetDrakTharonKeepAI(Creature* creature)
{
return GetInstanceAI<AI>(creature, DrakTharonKeepScriptName);
}
diff --git a/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp b/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp
index 68ba3cb2591..a07b2607d0d 100644
--- a/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp
+++ b/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp
@@ -16,9 +16,12 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "InstanceScript.h"
+#include "Creature.h"
+#include "CreatureAI.h"
#include "drak_tharon_keep.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "Map.h"
class instance_drak_tharon_keep : public InstanceMapScript
{
diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp
index a71214b7974..8ac3e9a5594 100644
--- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp
@@ -16,10 +16,13 @@
*/
#include "ScriptMgr.h"
+#include "forge_of_souls.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
#include "SpellAuraEffects.h"
-#include "forge_of_souls.h"
enum Yells
{
@@ -138,11 +141,10 @@ class boss_bronjahm : public CreatureScript
{
uint32 count = 0;
for (ObjectGuid const& guid : summons)
- {
if (Creature* summon = ObjectAccessor::GetCreature(*me, guid))
if (summon->GetEntry() == NPC_CORRUPTED_SOUL_FRAGMENT && summon->IsAlive())
++count;
- }
+
return count;
}
@@ -212,7 +214,7 @@ class boss_bronjahm : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_bronjahmAI>(creature, FoSScriptName);
+ return GetForgeOfSoulsAI<boss_bronjahmAI>(creature);
}
};
@@ -252,7 +254,7 @@ class npc_corrupted_soul_fragment : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_corrupted_soul_fragmentAI>(creature, FoSScriptName);
+ return GetForgeOfSoulsAI<npc_corrupted_soul_fragmentAI>(creature);
}
};
diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp
index b7eeca93801..08609ec1d94 100644
--- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp
@@ -16,12 +16,14 @@
*/
#include "ScriptMgr.h"
+#include "forge_of_souls.h"
+#include "InstanceScript.h"
+#include "Map.h"
#include "ScriptedCreature.h"
-#include "Player.h"
-#include "SpellInfo.h"
#include "SpellAuraEffects.h"
+#include "SpellInfo.h"
#include "SpellScript.h"
-#include "forge_of_souls.h"
+#include "TemporarySummon.h"
/*
* @todo
@@ -157,7 +159,7 @@ class boss_devourer_of_souls : public CreatureScript
Talk(SAY_FACE_AGGRO);
if (!me->FindNearestCreature(NPC_CRUCIBLE_OF_SOULS, 60)) // Prevent double spawn
- instance->instance->SummonCreature(NPC_CRUCIBLE_OF_SOULS, CrucibleSummonPos);
+ me->GetMap()->SummonCreature(NPC_CRUCIBLE_OF_SOULS, CrucibleSummonPos);
events.ScheduleEvent(EVENT_PHANTOM_BLAST, 5000);
events.ScheduleEvent(EVENT_MIRRORED_SOUL, 8000);
events.ScheduleEvent(EVENT_WELL_OF_SOULS, 30000);
@@ -342,7 +344,7 @@ class boss_devourer_of_souls : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_devourer_of_soulsAI>(creature, FoSScriptName);
+ return GetForgeOfSoulsAI<boss_devourer_of_soulsAI>(creature);
}
};
@@ -358,9 +360,7 @@ class spell_devourer_of_souls_mirrored_soul : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_MIRRORED_SOUL_PROC_AURA))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_MIRRORED_SOUL_PROC_AURA });
}
void HandleScript(SpellEffIndex /*effIndex*/)
@@ -393,9 +393,7 @@ class spell_devourer_of_souls_mirrored_soul_proc : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_MIRRORED_SOUL_DAMAGE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_MIRRORED_SOUL_DAMAGE });
}
bool CheckProc(ProcEventInfo& /*eventInfo*/)
@@ -435,9 +433,7 @@ class spell_devourer_of_souls_mirrored_soul_target_selector : public SpellScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_MIRRORED_SOUL_BUFF))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_MIRRORED_SOUL_BUFF });
}
void FilterTargets(std::list<WorldObject*>& targets)
diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp
index 4e11e4afdb9..4af340537fb 100644
--- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp
@@ -16,10 +16,9 @@
*/
#include "ScriptMgr.h"
+#include "forge_of_souls.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
-#include "forge_of_souls.h"
-#include "Player.h"
enum Events
{
@@ -79,7 +78,6 @@ public:
npc_sylvanas_fosAI(Creature* creature) : ScriptedAI(creature)
{
Initialize();
- instance = me->GetInstanceScript();
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
}
@@ -88,8 +86,6 @@ public:
phase = PHASE_NORMAL;
}
- InstanceScript* instance;
-
EventMap events;
Phase phase;
@@ -162,7 +158,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_sylvanas_fosAI>(creature);
+ return GetForgeOfSoulsAI<npc_sylvanas_fosAI>(creature);
}
};
@@ -176,7 +172,6 @@ public:
npc_jaina_fosAI(Creature* creature) : ScriptedAI(creature)
{
Initialize();
- instance = me->GetInstanceScript();
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
}
@@ -185,8 +180,6 @@ public:
phase = PHASE_NORMAL;
}
- InstanceScript* instance;
-
EventMap events;
Phase phase;
@@ -270,7 +263,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_jaina_fosAI>(creature);
+ return GetForgeOfSoulsAI<npc_jaina_fosAI>(creature);
}
};
diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.h b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.h
index 897cd72ba50..1ff20b4b6f1 100644
--- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.h
+++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.h
@@ -18,6 +18,8 @@
#ifndef FORGE_OF_SOULS_H_
#define FORGE_OF_SOULS_H_
+#include "CreatureAIImpl.h"
+
#define FoSScriptName "instance_forge_of_souls"
#define DataHeader "FOS"
@@ -55,4 +57,10 @@ enum FOSCreatures
NPC_CRUCIBLE_OF_SOULS = 37094
};
+template<typename AI>
+inline AI* GetForgeOfSoulsAI(Creature* creature)
+{
+ return GetInstanceAI<AI>(creature, FoSScriptName);
+}
+
#endif // FORGE_OF_SOULS_H_
diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp
index dfaaa3aed52..dbc297b1dc6 100644
--- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp
@@ -16,8 +16,10 @@
*/
#include "ScriptMgr.h"
-#include "InstanceScript.h"
+#include "Creature.h"
#include "forge_of_souls.h"
+#include "InstanceScript.h"
+#include "Map.h"
#include "Player.h"
class instance_forge_of_souls : public InstanceMapScript
diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp
index ec4c262c4d3..f007dd39348 100644
--- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp
@@ -16,8 +16,10 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "boss_horAI.h"
#include "halls_of_reflection.h"
+#include "InstanceScript.h"
+#include "ScriptedCreature.h"
enum Texts
{
diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_horAI.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_horAI.cpp
new file mode 100644
index 00000000000..9f0049557ff
--- /dev/null
+++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_horAI.cpp
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2008-2017 TrinityCore <http://www.trinitycore.org/>
+ *
+ * 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 2 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/>.
+ */
+
+#include "boss_horAI.h"
+#include "halls_of_reflection.h"
+#include "InstanceScript.h"
+
+boss_horAI::boss_horAI(Creature* creature, uint32 bossId) : BossAI(creature, bossId)
+{
+}
+
+void boss_horAI::Reset()
+{
+ _Reset();
+ me->SetVisible(false);
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
+ me->SetReactState(REACT_PASSIVE);
+ if (instance->GetData(DATA_WAVE_COUNT) != NOT_STARTED)
+ instance->ProcessEvent(NULL, EVENT_DO_WIPE);
+}
+
+void boss_horAI::DoAction(int32 actionId)
+{
+ switch (actionId)
+ {
+ case ACTION_ENTER_COMBAT: // called by InstanceScript when boss shall enter in combat.
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
+ me->SetReactState(REACT_AGGRESSIVE);
+ DoZoneInCombat(me, 150.0f);
+ break;
+ default:
+ break;
+ }
+}
+
+void boss_horAI::JustSummoned(Creature* summon)
+{
+ summons.Summon(summon);
+}
diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_horAI.h b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_horAI.h
new file mode 100644
index 00000000000..155259a372a
--- /dev/null
+++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_horAI.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2008-2017 TrinityCore <http://www.trinitycore.org/>
+ *
+ * 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 2 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/>.
+ */
+
+#include "ScriptedCreature.h"
+
+// Base class for FALRIC and MARWYN
+struct boss_horAI : BossAI
+{
+ boss_horAI(Creature* creature, uint32 bossId);
+ void Reset() override;
+ void DoAction(int32 actionId) override;
+ void JustSummoned(Creature* summon) override;
+};
diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp
index b56301e8e65..8240ede59a6 100644
--- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp
@@ -16,10 +16,12 @@
*/
#include "ScriptMgr.h"
+#include "boss_horAI.h"
+#include "halls_of_reflection.h"
+#include "InstanceScript.h"
#include "ScriptedCreature.h"
-#include "SpellScript.h"
#include "SpellAuraEffects.h"
-#include "halls_of_reflection.h"
+#include "SpellScript.h"
enum Texts
{
diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp
index 454e201d509..50a23bd8381 100644
--- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp
@@ -16,6 +16,7 @@
*/
#include "ScriptMgr.h"
+#include "halls_of_reflection.h"
#include "InstanceScript.h"
#include "MoveSplineInit.h"
#include "ObjectAccessor.h"
@@ -27,7 +28,6 @@
#include "SpellScript.h"
#include "TemporarySummon.h"
#include "Transport.h"
-#include "halls_of_reflection.h"
enum Text
{
@@ -343,6 +343,12 @@ Position const IceWallTargetPosition[] =
{ 5318.289f, 1749.184f, 771.9423f, 0.8726646f } // 4th Icewall
};
+void GameObjectDeleteDelayEvent::DeleteGameObject()
+{
+ if (GameObject* go = ObjectAccessor::GetGameObject(*_owner, _gameObjectGUID))
+ go->Delete();
+}
+
class npc_jaina_or_sylvanas_intro_hor : public CreatureScript
{
public:
@@ -1645,7 +1651,7 @@ class npc_phantom_hallucination : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_phantom_hallucinationAI(creature);
+ return GetHallsOfReflectionAI<npc_phantom_hallucinationAI>(creature);
}
};
@@ -1999,7 +2005,7 @@ class npc_spiritual_reflection : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_spiritual_reflectionAI(creature);
+ return GetHallsOfReflectionAI<npc_spiritual_reflectionAI>(creature);
}
};
diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h
index 77f7d9d41a7..1a3231a78fa 100644
--- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h
+++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h
@@ -18,6 +18,12 @@
#ifndef HALLS_OF_REFLECTION_H_
#define HALLS_OF_REFLECTION_H_
+#include "CreatureAIImpl.h"
+#include "EventProcessor.h"
+#include "ObjectGuid.h"
+
+class Unit;
+
#define HoRScriptName "instance_halls_of_reflection"
#define DataHeader "HOR"
@@ -192,51 +198,12 @@ enum HORInstanceYells
SAY_CAPTAIN_FINAL = 1
};
-// Base class for FALRIC and MARWYN
-struct boss_horAI : BossAI
-{
- boss_horAI(Creature* creature, uint32 bossId) : BossAI(creature, bossId) { }
-
- void Reset() override
- {
- _Reset();
- me->SetVisible(false);
- me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
- me->SetReactState(REACT_PASSIVE);
- if (instance->GetData(DATA_WAVE_COUNT) != NOT_STARTED)
- instance->ProcessEvent(NULL, EVENT_DO_WIPE);
- }
-
- void DoAction(int32 actionId) override
- {
- switch (actionId)
- {
- case ACTION_ENTER_COMBAT: // called by InstanceScript when boss shall enter in combat.
- me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
- me->SetReactState(REACT_AGGRESSIVE);
- DoZoneInCombat(me, 150.0f);
- break;
- default:
- break;
- }
- }
-
- void JustSummoned(Creature* summon) override
- {
- summons.Summon(summon);
- }
-};
-
class GameObjectDeleteDelayEvent : public BasicEvent
{
public:
GameObjectDeleteDelayEvent(Unit* owner, ObjectGuid gameObjectGUID) : _owner(owner), _gameObjectGUID(gameObjectGUID) { }
- void DeleteGameObject()
- {
- if (GameObject* go = ObjectAccessor::GetGameObject(*_owner, _gameObjectGUID))
- go->Delete();
- }
+ void DeleteGameObject();
bool Execute(uint64 /*execTime*/, uint32 /*diff*/) override
{
@@ -254,8 +221,8 @@ class GameObjectDeleteDelayEvent : public BasicEvent
ObjectGuid _gameObjectGUID;
};
-template<class AI>
-AI* GetHallsOfReflectionAI(Creature* creature)
+template<typename AI>
+inline AI* GetHallsOfReflectionAI(Creature* creature)
{
return GetInstanceAI<AI>(creature, HoRScriptName);
}
diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp
index a2115d9c265..b249d89818c 100644
--- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp
@@ -16,12 +16,17 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "Containers.h"
+#include "Creature.h"
+#include "CreatureAI.h"
+#include "GameObject.h"
+#include "halls_of_reflection.h"
#include "InstanceScript.h"
+#include "Map.h"
#include "Player.h"
+#include "TemporarySummon.h"
#include "Transport.h"
-#include "WorldPacket.h"
-#include "halls_of_reflection.h"
+#include "WorldStatePackets.h"
Position const JainaSpawnPos = { 5236.659f, 1929.894f, 707.7781f, 0.8726646f }; // Jaina Spawn Position
Position const SylvanasSpawnPos = { 5236.667f, 1929.906f, 707.7781f, 0.8377581f }; // Sylvanas Spawn Position (sniffed)
diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp
index a1fa4d6a596..25cc8f7a98f 100644
--- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp
@@ -16,10 +16,13 @@
*/
#include "ScriptMgr.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
+#include "pit_of_saron.h"
#include "ScriptedCreature.h"
-#include "SpellScript.h"
#include "SpellAuras.h"
-#include "pit_of_saron.h"
+#include "SpellScript.h"
enum Yells
{
diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp
index 270f4d0c700..05a3a3a4f2c 100644
--- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp
@@ -16,12 +16,16 @@
*/
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "ObjectAccessor.h"
+#include "pit_of_saron.h"
+#include "Player.h"
#include "ScriptedCreature.h"
-#include "SpellScript.h"
#include "SpellAuraEffects.h"
-#include "pit_of_saron.h"
+#include "SpellScript.h"
+#include "TemporarySummon.h"
#include "Vehicle.h"
-#include "Player.h"
enum Spells
{
diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp
index a03f99094cd..375dd23addc 100644
--- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp
@@ -16,13 +16,16 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "SpellScript.h"
-#include "SpellAuraEffects.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
#include "pit_of_saron.h"
-#include "Vehicle.h"
#include "Player.h"
#include "PlayerAI.h"
+#include "ScriptedCreature.h"
+#include "SpellAuraEffects.h"
+#include "SpellScript.h"
+#include "TemporarySummon.h"
+#include "Vehicle.h"
enum Yells
{
@@ -387,7 +390,7 @@ class boss_rimefang : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_rimefangAI(creature);
+ return GetPitOfSaronAI<boss_rimefangAI>(creature);
}
};
@@ -520,9 +523,7 @@ class spell_tyrannus_rimefang_icy_blast : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_ICY_BLAST_AURA))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_ICY_BLAST_AURA });
}
void HandleTriggerMissile(SpellEffIndex effIndex)
diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp
index 8be0f22bee6..f4151117f61 100644
--- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp
@@ -16,7 +16,10 @@
*/
#include "ScriptMgr.h"
+#include "Creature.h"
+#include "GameObject.h"
#include "InstanceScript.h"
+#include "Map.h"
#include "pit_of_saron.h"
#include "Player.h"
diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp
index cfd99284c14..9976e6b4350 100644
--- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp
@@ -16,13 +16,15 @@
*/
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
+#include "PassiveAI.h"
+#include "pit_of_saron.h"
+#include "Player.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
#include "SpellAuraEffects.h"
-#include "pit_of_saron.h"
-#include "PassiveAI.h"
#include "Vehicle.h"
-#include "Player.h"
enum Spells
{
@@ -40,6 +42,19 @@ enum Events
EVENT_TACTICAL_BLINK = 2,
};
+bool ScheduledIcicleSummons::Execute(uint64 /*time*/, uint32 /*diff*/)
+{
+ if (roll_chance_i(12))
+ {
+ _trigger->CastSpell(_trigger, SPELL_ICICLE_SUMMON, true);
+ _trigger->m_Events.AddEvent(new ScheduledIcicleSummons(_trigger), _trigger->m_Events.CalculateTime(urand(20000, 35000)));
+ }
+ else
+ _trigger->m_Events.AddEvent(new ScheduledIcicleSummons(_trigger), _trigger->m_Events.CalculateTime(urand(1000, 20000)));
+
+ return true;
+}
+
class npc_ymirjar_flamebearer : public CreatureScript
{
public:
@@ -303,12 +318,7 @@ class spell_pos_ice_shards : public SpellScriptLoader
bool Load() override
{
// This script should execute only in Pit of Saron
- if (InstanceMap* instance = GetCaster()->GetMap()->ToInstanceMap())
- if (instance->GetInstanceScript())
- if (instance->GetScriptId() == sObjectMgr->GetScriptId(PoSScriptName))
- return true;
-
- return false;
+ return InstanceHasScript(GetCaster(), PoSScriptName);
}
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.h b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.h
index 7d79e4a9c4c..b0a7107f36f 100644
--- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.h
+++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.h
@@ -18,6 +18,9 @@
#ifndef PIT_OF_SARON_H_
#define PIT_OF_SARON_H_
+#include "CreatureAIImpl.h"
+#include "EventProcessor.h"
+
#define PoSScriptName "instance_pit_of_saron"
#define DataHeader "POS"
@@ -112,25 +115,14 @@ class ScheduledIcicleSummons : public BasicEvent
public:
ScheduledIcicleSummons(Creature* trigger) : _trigger(trigger) { }
- bool Execute(uint64 /*time*/, uint32 /*diff*/) override
- {
- if (roll_chance_i(12))
- {
- _trigger->CastSpell(_trigger, SPELL_ICICLE_SUMMON, true);
- _trigger->m_Events.AddEvent(new ScheduledIcicleSummons(_trigger), _trigger->m_Events.CalculateTime(urand(20000, 35000)));
- }
- else
- _trigger->m_Events. AddEvent(new ScheduledIcicleSummons(_trigger), _trigger->m_Events.CalculateTime(urand(1000,20000)));
-
- return true;
- }
+ bool Execute(uint64 /*time*/, uint32 /*diff*/) override;
private:
Creature* _trigger;
};
-template<class AI>
-AI* GetPitOfSaronAI(Creature* creature)
+template<typename AI>
+inline AI* GetPitOfSaronAI(Creature* creature)
{
return GetInstanceAI<AI>(creature, PoSScriptName);
}
diff --git a/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp b/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp
index 7af34da74bb..c47e163a75f 100644
--- a/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp
+++ b/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp
@@ -20,8 +20,9 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "gundrak.h"
+#include "InstanceScript.h"
+#include "ScriptedCreature.h"
#include "SpellInfo.h"
enum Texts
diff --git a/src/server/scripts/Northrend/Gundrak/boss_eck.cpp b/src/server/scripts/Northrend/Gundrak/boss_eck.cpp
index cb44a42450f..ff260d28042 100644
--- a/src/server/scripts/Northrend/Gundrak/boss_eck.cpp
+++ b/src/server/scripts/Northrend/Gundrak/boss_eck.cpp
@@ -16,8 +16,8 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "gundrak.h"
+#include "ScriptedCreature.h"
enum Texts
{
diff --git a/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp b/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp
index 485892971df..4c0ca6d6db5 100644
--- a/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp
+++ b/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp
@@ -16,12 +16,11 @@
*/
#include "ScriptMgr.h"
+#include "gundrak.h"
#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
#include "SpellInfo.h"
-#include "SpellMgr.h"
#include "SpellScript.h"
-#include "gundrak.h"
/// @todo: implement stampede
@@ -250,9 +249,7 @@ class spell_gal_darah_impaling_charge : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_IMPALING_CHARGE_CONTROL_VEHICLE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_IMPALING_CHARGE_CONTROL_VEHICLE });
}
bool Load() override
diff --git a/src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp b/src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp
index 73b83ccc537..52dadf367a4 100644
--- a/src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp
+++ b/src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp
@@ -16,9 +16,9 @@
*/
#include "ScriptMgr.h"
+#include "gundrak.h"
#include "ScriptedCreature.h"
#include "SpellInfo.h"
-#include "gundrak.h"
/// @todo: implement mojo frenzy
diff --git a/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp b/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp
index 62d215f9161..33f6e09085b 100644
--- a/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp
+++ b/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp
@@ -16,10 +16,11 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "SpellAuras.h"
#include "gundrak.h"
#include "Player.h"
+#include "ScriptedCreature.h"
+#include "SpellAuras.h"
+#include "TemporarySummon.h"
enum Spells
{
@@ -209,7 +210,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_slad_ran_constrictorAI(creature);
+ return GetGundrakAI<npc_slad_ran_constrictorAI>(creature);
}
struct npc_slad_ran_constrictorAI : public ScriptedAI
@@ -264,7 +265,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_slad_ran_viperAI(creature);
+ return GetGundrakAI<npc_slad_ran_viperAI>(creature);
}
struct npc_slad_ran_viperAI : public ScriptedAI
diff --git a/src/server/scripts/Northrend/Gundrak/gundrak.h b/src/server/scripts/Northrend/Gundrak/gundrak.h
index 8ae60f49dff..1df61ea57ab 100644
--- a/src/server/scripts/Northrend/Gundrak/gundrak.h
+++ b/src/server/scripts/Northrend/Gundrak/gundrak.h
@@ -18,6 +18,8 @@
#ifndef GUNDRAK_H_
#define GUNDRAK_H_
+#include "CreatureAIImpl.h"
+
#define GundrakScriptName "instance_gundrak"
#define DataHeader "GD"
@@ -90,7 +92,7 @@ enum GDInstanceMisc
TIMER_STATUE_ACTIVATION = 3500
};
-template<class AI>
+template<typename AI>
inline AI* GetGundrakAI(Creature* creature)
{
return GetInstanceAI<AI>(creature, GundrakScriptName);
diff --git a/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp b/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp
index b35b4f7696d..9db9131259b 100644
--- a/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp
+++ b/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp
@@ -15,11 +15,13 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "InstanceScript.h"
-#include "Player.h"
#include "ScriptMgr.h"
-#include "gundrak.h"
+#include "Creature.h"
#include "EventMap.h"
+#include "GameObject.h"
+#include "gundrak.h"
+#include "InstanceScript.h"
+#include "Map.h"
DoorData const doorData[] =
{
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp
index 432b344f496..80f6d81834f 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp
@@ -15,16 +15,17 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ObjectMgr.h"
-#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "SpellAuraEffects.h"
#include "icecrown_citadel.h"
+#include "InstanceScript.h"
#include "Map.h"
#include "ObjectAccessor.h"
#include "Player.h"
+#include "ScriptedCreature.h"
#include "Spell.h"
-#include "SpellMgr.h"
+#include "SpellAuraEffects.h"
+#include "SpellAuras.h"
+#include "SpellInfo.h"
+#include "SpellScript.h"
#include "TemporarySummon.h"
enum Texts
@@ -386,7 +387,7 @@ class boss_prince_keleseth_icc : public CreatureScript
void InitializeAI() override
{
- if (CreatureData const* data = sObjectMgr->GetCreatureData(me->GetSpawnId()))
+ if (CreatureData const* data = me->GetCreatureData())
if (data->curhealth)
_spawnHealth = data->curhealth;
@@ -601,7 +602,7 @@ class boss_prince_taldaram_icc : public CreatureScript
void InitializeAI() override
{
- if (CreatureData const* data = sObjectMgr->GetCreatureData(me->GetSpawnId()))
+ if (CreatureData const* data = me->GetCreatureData())
if (data->curhealth)
_spawnHealth = data->curhealth;
@@ -820,7 +821,7 @@ class boss_prince_valanar_icc : public CreatureScript
void InitializeAI() override
{
- if (CreatureData const* data = sObjectMgr->GetCreatureData(me->GetSpawnId()))
+ if (CreatureData const* data = me->GetCreatureData())
if (data->curhealth)
_spawnHealth = data->curhealth;
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp
index 3c7eb8dfc86..855afb707ff 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp
@@ -15,13 +15,18 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ObjectMgr.h"
-#include "ScriptMgr.h"
+#include "icecrown_citadel.h"
+#include "GridNotifiers.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptedCreature.h"
-#include "Spell.h"
#include "SpellAuraEffects.h"
-#include "GridNotifiers.h"
-#include "icecrown_citadel.h"
+#include "SpellAuras.h"
+#include "SpellInfo.h"
+#include "SpellMgr.h"
+#include "SpellScript.h"
enum Texts
{
@@ -534,13 +539,12 @@ class spell_blood_queen_vampiric_bite : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_ESSENCE_OF_THE_BLOOD_QUEEN_PLR))
- return false;
- if (!sSpellMgr->GetSpellInfo(SPELL_FRENZIED_BLOODTHIRST))
- return false;
- if (!sSpellMgr->GetSpellInfo(SPELL_PRESENCE_OF_THE_DARKFALLEN))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_ESSENCE_OF_THE_BLOOD_QUEEN_PLR,
+ SPELL_FRENZIED_BLOODTHIRST,
+ SPELL_PRESENCE_OF_THE_DARKFALLEN
+ });
}
SpellCastResult CheckTarget()
@@ -669,9 +673,7 @@ class spell_blood_queen_bloodbolt : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_TWILIGHT_BLOODBOLT))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_TWILIGHT_BLOODBOLT });
}
bool Load() override
@@ -720,9 +722,7 @@ class spell_blood_queen_essence_of_the_blood_queen : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_ESSENCE_OF_THE_BLOOD_QUEEN_HEAL))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_ESSENCE_OF_THE_BLOOD_QUEEN_HEAL });
}
void OnProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -803,9 +803,7 @@ class spell_blood_queen_pact_of_the_darkfallen_dmg : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PACT_OF_THE_DARKFALLEN_DAMAGE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_PACT_OF_THE_DARKFALLEN_DAMAGE });
}
// this is an additional effect to be executed
@@ -813,7 +811,7 @@ class spell_blood_queen_pact_of_the_darkfallen_dmg : public SpellScriptLoader
{
SpellInfo const* damageSpell = sSpellMgr->AssertSpellInfo(SPELL_PACT_OF_THE_DARKFALLEN_DAMAGE);
int32 damage = damageSpell->GetEffect(EFFECT_0)->CalcValue();
- float multiplier = 0.3375f + 0.1f * uint32(aurEff->GetTickNumber()/10); // do not convert to 0.01f - we need tick number/10 as INT (damage increases every 10 ticks)
+ float multiplier = 0.3375f + 0.1f * uint32(aurEff->GetTickNumber() / 10); // do not convert to 0.01f - we need tick number/10 as INT (damage increases every 10 ticks)
damage = int32(damage * multiplier);
GetTarget()->CastCustomSpell(SPELL_PACT_OF_THE_DARKFALLEN_DAMAGE, SPELLVALUE_BASE_POINT0, damage, GetTarget(), true);
}
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp
index c907aa14c3c..d0f14390b64 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp
@@ -15,13 +15,14 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ObjectMgr.h"
-#include "ScriptMgr.h"
+#include "icecrown_citadel.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
#include "SpellAuras.h"
-#include "icecrown_citadel.h"
-#include "Player.h"
+#include "SpellScript.h"
enum ScriptTexts
{
@@ -640,7 +641,7 @@ class npc_high_overlord_saurfang_icc : public CreatureScript
{
if (menuId == GOSSIP_MENU_HIGH_OVERLORD_SAURFANG)
{
- player->PlayerTalkClass->SendCloseGossip();
+ CloseGossipMenuFor(player);
DoAction(ACTION_START_EVENT);
}
}
@@ -836,7 +837,7 @@ class npc_muradin_bronzebeard_icc : public CreatureScript
{
if (menuId == GOSSIP_MENU_MURADIN_BRONZEBEARD)
{
- player->PlayerTalkClass->SendCloseGossip();
+ CloseGossipMenuFor(player);
DoAction(ACTION_START_EVENT);
}
}
@@ -1006,11 +1007,11 @@ class spell_deathbringer_blood_link : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_BLOOD_LINK_POWER))
- return false;
- if (!sSpellMgr->GetSpellInfo(SPELL_BLOOD_POWER))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_BLOOD_LINK_POWER,
+ SPELL_BLOOD_POWER
+ });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -1042,9 +1043,7 @@ class spell_deathbringer_blood_link_aura : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_MARK_OF_THE_FALLEN_CHAMPION))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_MARK_OF_THE_FALLEN_CHAMPION });
}
void HandlePeriodicTick(AuraEffect const* /*aurEff*/)
@@ -1127,9 +1126,7 @@ class spell_deathbringer_rune_of_blood : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_BLOOD_LINK_DUMMY))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_BLOOD_LINK_DUMMY });
}
void HandleScript(SpellEffIndex effIndex)
@@ -1162,9 +1159,7 @@ class spell_deathbringer_blood_beast_blood_link : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_BLOOD_LINK_DUMMY))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_BLOOD_LINK_DUMMY });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -1196,9 +1191,7 @@ class spell_deathbringer_blood_nova : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_BLOOD_LINK_DUMMY))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_BLOOD_LINK_DUMMY });
}
void HandleScript(SpellEffIndex effIndex)
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp
index b7f52c47791..c432225e533 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp
@@ -15,12 +15,14 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ObjectMgr.h"
-#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "SpellAuras.h"
#include "icecrown_citadel.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "ScriptedCreature.h"
+#include "SpellAuras.h"
+#include "SpellScript.h"
enum ScriptTexts
{
@@ -406,9 +408,7 @@ class spell_festergut_gastric_bloat : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_GASTRIC_EXPLOSION))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_GASTRIC_EXPLOSION });
}
void HandleScript(SpellEffIndex /*effIndex*/)
@@ -444,9 +444,7 @@ class spell_festergut_blighted_spores : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_INOCULATED))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_INOCULATED });
}
void ExtraEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp
index 94009dd7c04..57bac6cb166 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp
@@ -15,23 +15,26 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "icecrown_citadel.h"
#include "CellImpl.h"
#include "CreatureTextMgr.h"
#include "GridNotifiersImpl.h"
-#include "GossipDef.h"
+#include "InstanceScript.h"
+#include "Map.h"
#include "MovementPackets.h"
-#include "MoveSpline.h"
-#include "MoveSplineInit.h"
+#include "ObjectAccessor.h"
#include "PassiveAI.h"
-#include "ScriptMgr.h"
+#include "Player.h"
#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "SpellAuraEffects.h"
#include "SpellHistory.h"
+#include "SpellInfo.h"
+#include "SpellMgr.h"
#include "SpellScript.h"
+#include "TemporarySummon.h"
#include "Transport.h"
-#include "TransportMgr.h"
#include "Vehicle.h"
-#include "icecrown_citadel.h"
enum Texts
{
@@ -1392,7 +1395,7 @@ class npc_zafod_boombox : public CreatureScript
void sGossipSelect(Player* player, uint32 /*menuId*/, uint32 /*gossipListId*/) override
{
player->AddItem(ITEM_GOBLIN_ROCKET_PACK, 1);
- player->PlayerTalkClass->SendCloseGossip();
+ CloseGossipMenuFor(player);
}
void UpdateAI(uint32 /*diff*/) override
@@ -1820,16 +1823,16 @@ class spell_igb_rocket_pack : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_ROCKET_PACK_DAMAGE) ||
- !sSpellMgr->GetSpellInfo(SPELL_ROCKET_BURST))
- return false;
-
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_ROCKET_PACK_DAMAGE,
+ SPELL_ROCKET_BURST
+ });
}
void HandlePeriodic(AuraEffect const* /*aurEff*/)
{
- if (GetTarget()->movespline->Finalized())
+ if (!GetTarget()->IsSplineEnabled())
Remove(AURA_REMOVE_BY_EXPIRE);
}
@@ -2092,7 +2095,7 @@ class spell_igb_overheat : public SpellScriptLoader
WorldPackets::Movement::ControlUpdate data;
data.Guid = GetUnitOwner()->GetGUID();
data.On = value;
- player->GetSession()->SendPacket(data.Write());
+ player->SendDirectMessage(data.Write());
}
}
}
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp
index ad24911fac3..ec6a86d906d 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp
@@ -15,14 +15,16 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ObjectMgr.h"
-#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "PoolMgr.h"
-#include "Group.h"
#include "icecrown_citadel.h"
-#include "SpellInfo.h"
+#include "Group.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "PoolMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellInfo.h"
+#include "SpellScript.h"
+#include "TemporarySummon.h"
enum ScriptTexts
{
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp
index 262e36f17e0..2a4649b00ac 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp
@@ -15,13 +15,16 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ObjectMgr.h"
-#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "SpellAuras.h"
+#include "icecrown_citadel.h"
+#include "InstanceScript.h"
+#include "Map.h"
#include "MoveSplineInit.h"
+#include "ObjectAccessor.h"
#include "Player.h"
-#include "icecrown_citadel.h"
+#include "ScriptedCreature.h"
+#include "SpellAuras.h"
+#include "SpellScript.h"
+#include "TemporarySummon.h"
enum ScriptTexts
{
@@ -618,11 +621,7 @@ class spell_marrowgar_bone_spike_graveyard : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- for (uint32 i = 0; i < 3; ++i)
- if (!sSpellMgr->GetSpellInfo(BoneSpikeSummonId[i]))
- return false;
-
- return true;
+ return ValidateSpellInfo(BoneSpikeSummonId);
}
bool Load() override
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp
index c5dbb76de87..bcc1b60eb02 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp
@@ -15,15 +15,23 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ObjectMgr.h"
-#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "SpellAuraEffects.h"
+#include "icecrown_citadel.h"
+#include "DB2Stores.h"
+#include "GameObject.h"
+#include "GridNotifiers.h"
#include "Group.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
#include "Spell.h"
-#include "icecrown_citadel.h"
+#include "SpellAuraEffects.h"
+#include "SpellAuras.h"
+#include "SpellInfo.h"
+#include "SpellMgr.h"
+#include "SpellScript.h"
+#include "TemporarySummon.h"
#include "Vehicle.h"
-#include "GridNotifiers.h"
enum Say
{
@@ -882,11 +890,7 @@ class spell_putricide_ooze_channel : public SpellScriptLoader
private:
bool Validate(SpellInfo const* spell) override
{
- if (!spell->ExcludeTargetAuraSpell)
- return false;
- if (!sSpellMgr->GetSpellInfo(spell->ExcludeTargetAuraSpell))
- return false;
- return true;
+ return spell->ExcludeTargetAuraSpell && ValidateSpellInfo({ spell->ExcludeTargetAuraSpell });
}
// set up initial variables and check if caster is creature
@@ -1104,14 +1108,8 @@ class spell_putricide_ooze_tank_protection : public SpellScriptLoader
bool Validate(SpellInfo const* spellInfo) override
{
SpellEffectInfo const* effect0 = spellInfo->GetEffect(EFFECT_0);
- if (!effect0 || !sSpellMgr->GetSpellInfo(effect0->TriggerSpell))
- return false;
-
SpellEffectInfo const* effect1 = spellInfo->GetEffect(EFFECT_1);
- if (!effect1 || !sSpellMgr->GetSpellInfo(effect1->TriggerSpell))
- return false;
-
- return true;
+ return effect0 && effect1 && ValidateSpellInfo({ effect0->TriggerSpell, effect1->TriggerSpell });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -1180,11 +1178,7 @@ class spell_putricide_unbound_plague : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_UNBOUND_PLAGUE))
- return false;
- if (!sSpellMgr->GetSpellInfo(SPELL_UNBOUND_PLAGUE_SEARCHER))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_UNBOUND_PLAGUE, SPELL_UNBOUND_PLAGUE_SEARCHER });
}
void FilterTargets(std::list<WorldObject*>& targets)
@@ -1198,7 +1192,6 @@ class spell_putricide_unbound_plague : public SpellScriptLoader
}
}
-
targets.remove_if(Trinity::UnitAuraCheck(true, SPELL_UNBOUND_PLAGUE));
Trinity::Containers::RandomResize(targets, 1);
}
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp
index a8be1a887b6..f409ee76562 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp
@@ -15,12 +15,17 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ObjectMgr.h"
-#include "ScriptMgr.h"
+#include "icecrown_citadel.h"
+#include "Containers.h"
+#include "GridNotifiers.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptedCreature.h"
#include "SpellAuraEffects.h"
-#include "GridNotifiers.h"
-#include "icecrown_citadel.h"
+#include "SpellScript.h"
+#include "TemporarySummon.h"
// KNOWN BUGS:
// ~ No Slime Spray animation directly at target spot
@@ -541,9 +546,7 @@ class spell_rotface_mutated_infection : public SpellScriptLoader
bool Validate(SpellInfo const* spellInfo) override
{
SpellEffectInfo const* effect = spellInfo->GetEffect(EFFECT_2);
- if (!effect || !sSpellMgr->GetSpellInfo(uint32(effect->CalcValue())))
- return false;
- return true;
+ return effect && !ValidateSpellInfo({ uint32(effect->CalcValue()) });
}
void HandleEffectRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
@@ -709,9 +712,7 @@ class spell_rotface_unstable_ooze_explosion_init : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_UNSTABLE_OOZE_EXPLOSION_TRIGGER))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_UNSTABLE_OOZE_EXPLOSION_TRIGGER });
}
void HandleCast(SpellEffIndex effIndex)
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp
index ffe1fa0c8b3..522ee971b2d 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp
@@ -15,12 +15,21 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "icecrown_citadel.h"
+#include "GameObject.h"
+#include "GridNotifiers.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "ObjectAccessor.h"
#include "ObjectMgr.h"
-#include "ScriptMgr.h"
+#include "Player.h"
#include "ScriptedCreature.h"
+#include "Spell.h"
#include "SpellAuraEffects.h"
-#include "GridNotifiers.h"
-#include "icecrown_citadel.h"
+#include "SpellAuras.h"
+#include "SpellInfo.h"
+#include "SpellScript.h"
+#include "TemporarySummon.h"
enum Texts
{
@@ -1066,12 +1075,7 @@ class spell_sindragosa_s_fury : public SpellScriptLoader
bool Load() override
{
// This script should execute only in Icecrown Citadel
- if (InstanceMap* instance = GetCaster()->GetMap()->ToInstanceMap())
- if (instance->GetInstanceScript())
- if (instance->GetScriptId() == sObjectMgr->GetScriptId(ICCScriptName))
- return true;
-
- return false;
+ return InstanceHasScript(GetCaster(), ICCScriptName);
}
void SelectDest()
@@ -1224,9 +1228,7 @@ class spell_sindragosa_instability : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_BACKLASH))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_BACKLASH });
}
void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
@@ -1258,9 +1260,7 @@ class spell_sindragosa_frost_beacon : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_ICE_TOMB_DAMAGE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_ICE_TOMB_DAMAGE });
}
void PeriodicTick(AuraEffect const* /*aurEff*/)
@@ -1314,7 +1314,7 @@ class spell_sindragosa_ice_tomb : public SpellScriptLoader
{
summon->AI()->SetGUID(GetTarget()->GetGUID(), DATA_TRAPPED_PLAYER);
GetTarget()->CastSpell(GetTarget(), SPELL_ICE_TOMB_UNTARGETABLE);
- if (GameObject* go = summon->SummonGameObject(GO_ICE_BLOCK, pos, G3D::Quat(), 0))
+ if (GameObject* go = summon->SummonGameObject(GO_ICE_BLOCK, pos, QuaternionData(), 0))
{
go->SetSpellId(SPELL_ICE_TOMB_DAMAGE);
summon->AddGameObject(go);
@@ -1353,9 +1353,7 @@ class spell_sindragosa_icy_grip : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_ICY_GRIP_JUMP))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_ICY_GRIP_JUMP });
}
void HandleScript(SpellEffIndex effIndex)
@@ -1427,9 +1425,7 @@ class spell_rimefang_icy_blast : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_ICY_BLAST_AREA))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_ICY_BLAST_AREA });
}
void HandleTriggerMissile(SpellEffIndex effIndex)
@@ -1479,9 +1475,7 @@ class spell_frostwarden_handler_order_whelp : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_FOCUS_FIRE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_FOCUS_FIRE });
}
void FilterTargets(std::list<WorldObject*>& targets)
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp
index 5f2e364dbfc..c28e26d8022 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp
@@ -15,16 +15,21 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "icecrown_citadel.h"
#include "CellImpl.h"
#include "CreatureTextMgr.h"
+#include "GameObject.h"
#include "GridNotifiersImpl.h"
-#include "icecrown_citadel.h"
-#include "ObjectMgr.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
-#include "ScriptMgr.h"
#include "Spell.h"
#include "SpellAuraEffects.h"
+#include "SpellAuras.h"
+#include "SpellInfo.h"
#include "SpellScript.h"
+#include "TemporarySummon.h"
#include "Vehicle.h"
#include "Weather.h"
@@ -2043,9 +2048,7 @@ class spell_the_lich_king_necrotic_plague : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_NECROTIC_PLAGUE_JUMP))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_NECROTIC_PLAGUE_JUMP });
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -2315,9 +2318,7 @@ class spell_the_lich_king_ice_burst_target_search : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_ICE_BURST))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_ICE_BURST });
}
void CheckTargetCount(std::list<WorldObject*>& unitList)
@@ -2356,11 +2357,10 @@ class spell_the_lich_king_raging_spirit : public SpellScriptLoader
{
PrepareSpellScript(spell_the_lich_king_raging_spirit_SpellScript);
- bool Validate(SpellInfo const* /*spell*/) override
+ bool Validate(SpellInfo const* spell) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_LIFE_SIPHON_HEAL))
- return false;
- return true;
+ SpellEffectInfo const* effect0 = spell->GetEffect(EFFECT_0);
+ return effect0 && ValidateSpellInfo({ uint32(effect0->CalcValue()) });
}
void HandleScript(SpellEffIndex effIndex)
@@ -2480,9 +2480,7 @@ class spell_the_lich_king_soul_reaper : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SOUL_REAPER_BUFF))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SOUL_REAPER_BUFF });
}
void OnPeriodic(AuraEffect const* /*aurEff*/)
@@ -2521,9 +2519,7 @@ class spell_the_lich_king_valkyr_target_search : public SpellScriptLoader
private:
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_ICE_BURST))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_CHARGE });
}
void SelectTarget(std::list<WorldObject*>& targets)
@@ -2607,9 +2603,7 @@ class spell_the_lich_king_life_siphon : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_LIFE_SIPHON_HEAL))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_LIFE_SIPHON_HEAL });
}
void TriggerHeal()
@@ -2967,9 +2961,7 @@ class spell_the_lich_king_dark_hunger : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DARK_HUNGER_HEAL))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DARK_HUNGER_HEAL });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp
index 3ac7e714f36..75a3c9b59d6 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp
@@ -15,15 +15,15 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ObjectMgr.h"
-#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "SpellAuraEffects.h"
-#include "Cell.h"
+#include "icecrown_citadel.h"
#include "CellImpl.h"
-#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
-#include "icecrown_citadel.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
+#include "SpellAuraEffects.h"
+#include "SpellInfo.h"
+#include "SpellScript.h"
enum Texts
{
@@ -297,7 +297,7 @@ class boss_valithria_dreamwalker : public CreatureScript
void InitializeAI() override
{
- if (CreatureData const* data = sObjectMgr->GetCreatureData(me->GetSpawnId()))
+ if (CreatureData const* data = me->GetCreatureData())
if (data->curhealth)
_spawnHealth = data->curhealth;
@@ -675,7 +675,7 @@ class npc_the_lich_king_controller : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_the_lich_king_controllerAI>(creature);
+ return GetIcecrownCitadelAI<npc_the_lich_king_controllerAI>(creature);
}
};
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp
index 04c5fa35875..da5a449e7bb 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp
@@ -15,18 +15,22 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ObjectMgr.h"
-#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedEscortAI.h"
-#include "PassiveAI.h"
-#include "Cell.h"
+#include "icecrown_citadel.h"
#include "CellImpl.h"
-#include "GridNotifiers.h"
+#include "GameObject.h"
#include "GridNotifiersImpl.h"
-#include "SpellAuraEffects.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
+#include "PassiveAI.h"
+#include "PetDefines.h"
+#include "Player.h"
+#include "ScriptedEscortAI.h"
#include "SmartAI.h"
-#include "icecrown_citadel.h"
+#include "Spell.h"
+#include "SpellInfo.h"
+#include "SpellScript.h"
+#include "TemporarySummon.h"
+#include "VehicleDefines.h"
// Weekly quest support
// * Deprogramming (DONE)
@@ -2095,6 +2099,48 @@ class spell_icc_soul_missile : public SpellScriptLoader
}
};
+class spell_trigger_spell_from_caster_SpellScript : public SpellScript
+{
+ PrepareSpellScript(spell_trigger_spell_from_caster_SpellScript);
+
+public:
+ spell_trigger_spell_from_caster_SpellScript(uint32 triggerId, TriggerCastFlags triggerFlags)
+ : SpellScript(), _triggerId(triggerId), _triggerFlags(triggerFlags) { }
+
+ bool Validate(SpellInfo const* /*spell*/) override
+ {
+ return ValidateSpellInfo({ _triggerId });
+ }
+
+ void HandleTrigger()
+ {
+ GetCaster()->CastSpell(GetHitUnit(), _triggerId, _triggerFlags);
+ }
+
+ void Register() override
+ {
+ AfterHit += SpellHitFn(spell_trigger_spell_from_caster_SpellScript::HandleTrigger);
+ }
+
+ uint32 _triggerId;
+ TriggerCastFlags _triggerFlags;
+};
+
+spell_trigger_spell_from_caster::spell_trigger_spell_from_caster(char const* scriptName, uint32 triggerId)
+ : SpellScriptLoader(scriptName), _triggerId(triggerId), _triggerFlags(TRIGGERED_FULL_MASK)
+{
+}
+
+spell_trigger_spell_from_caster::spell_trigger_spell_from_caster(char const* scriptName, uint32 triggerId, TriggerCastFlags triggerFlags)
+ : SpellScriptLoader(scriptName), _triggerId(triggerId), _triggerFlags(triggerFlags)
+{
+}
+
+SpellScript* spell_trigger_spell_from_caster::GetSpellScript() const
+{
+ return new spell_trigger_spell_from_caster_SpellScript(_triggerId, _triggerFlags);
+}
+
class at_icc_saurfang_portal : public AreaTriggerScript
{
public:
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h
index 955eb88428f..80160966cd3 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h
+++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h
@@ -18,9 +18,11 @@
#ifndef ICECROWN_CITADEL_H_
#define ICECROWN_CITADEL_H_
-#include "InstanceScript.h"
+#include "CreatureAIImpl.h"
#include "ScriptMgr.h"
-#include "SpellScript.h"
+
+struct Position;
+enum TriggerCastFlags : uint32;
#define ICCScriptName "instance_icecrown_citadel"
#define DataHeader "IC"
@@ -529,49 +531,16 @@ enum ICAreaIds
class spell_trigger_spell_from_caster : public SpellScriptLoader
{
public:
- spell_trigger_spell_from_caster(char const* scriptName, uint32 triggerId, TriggerCastFlags triggerFlags = TRIGGERED_FULL_MASK)
- : SpellScriptLoader(scriptName), _triggerId(triggerId), _triggerFlags(triggerFlags) { }
-
- class spell_trigger_spell_from_caster_SpellScript : public SpellScript
- {
- PrepareSpellScript(spell_trigger_spell_from_caster_SpellScript);
-
- public:
- spell_trigger_spell_from_caster_SpellScript(uint32 triggerId, TriggerCastFlags triggerFlags)
- : SpellScript(), _triggerId(triggerId), _triggerFlags(triggerFlags) { }
-
- bool Validate(SpellInfo const* /*spell*/) override
- {
- if (!sSpellMgr->GetSpellInfo(_triggerId))
- return false;
- return true;
- }
-
- void HandleTrigger()
- {
- GetCaster()->CastSpell(GetHitUnit(), _triggerId, _triggerFlags);
- }
-
- void Register() override
- {
- AfterHit += SpellHitFn(spell_trigger_spell_from_caster_SpellScript::HandleTrigger);
- }
-
- uint32 _triggerId;
- TriggerCastFlags _triggerFlags;
- };
-
- SpellScript* GetSpellScript() const override
- {
- return new spell_trigger_spell_from_caster_SpellScript(_triggerId, _triggerFlags);
- }
+ spell_trigger_spell_from_caster(char const* scriptName, uint32 triggerId);
+ spell_trigger_spell_from_caster(char const* scriptName, uint32 triggerId, TriggerCastFlags triggerFlags);
+ SpellScript* GetSpellScript() const override;
private:
uint32 _triggerId;
TriggerCastFlags _triggerFlags;
};
-template<class AI, class T>
+template<typename AI, typename T>
inline AI* GetIcecrownCitadelAI(T* obj)
{
return GetInstanceAI<AI>(obj, ICCScriptName);
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel_teleport.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel_teleport.cpp
index 09ba74b57be..c730b9b22a2 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel_teleport.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel_teleport.cpp
@@ -15,14 +15,15 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptMgr.h"
+#include "icecrown_citadel.h"
+#include "GameObject.h"
#include "GameObjectAI.h"
#include "InstanceScript.h"
#include "Player.h"
#include "ScriptedGossip.h"
#include "Spell.h"
-#include "icecrown_citadel.h"
#include "SpellInfo.h"
+#include "SpellMgr.h"
static std::vector<uint32> const TeleportSpells =
{
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp
index c4475ca53e7..df0ea941f64 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp
@@ -15,17 +15,21 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "AccountMgr.h"
+#include "icecrown_citadel.h"
+#include "AreaBoundary.h"
+#include "Creature.h"
+#include "CreatureAI.h"
+#include "EventMap.h"
+#include "GameObject.h"
#include "InstanceScript.h"
+#include "Map.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "PoolMgr.h"
-#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "TemporarySummon.h"
#include "Transport.h"
#include "TransportMgr.h"
-#include "WorldPacket.h"
-#include "icecrown_citadel.h"
+#include "WorldStatePackets.h"
enum EventIds
{
@@ -1300,7 +1304,7 @@ class instance_icecrown_citadel : public InstanceMapScript
teleporter->SetGoState(GO_STATE_ACTIVE);
std::list<Creature*> stalkers;
- GetCreatureListWithEntryInGrid(stalkers, teleporter, NPC_INVISIBLE_STALKER, 100.0f);
+ teleporter->GetCreatureListWithEntryInGrid(stalkers, NPC_INVISIBLE_STALKER, 100.0f);
if (stalkers.empty())
return;
@@ -1446,7 +1450,7 @@ class instance_icecrown_citadel : public InstanceMapScript
{
terenas->AI()->DoAction(ACTION_FROSTMOURNE_INTRO);
std::list<Creature*> triggers;
- GetCreatureListWithEntryInGrid(triggers, terenas, NPC_WORLD_TRIGGER_INFINITE_AOI, 100.0f);
+ terenas->GetCreatureListWithEntryInGrid(triggers, NPC_WORLD_TRIGGER_INFINITE_AOI, 100.0f);
if (!triggers.empty())
{
triggers.sort(Trinity::ObjectDistanceOrderPred(terenas, false));
diff --git a/src/server/scripts/Northrend/IsleOfConquest/boss_ioc_horde_alliance.cpp b/src/server/scripts/Northrend/IsleOfConquest/boss_ioc_horde_alliance.cpp
index 71d90da21a1..52644be07a6 100644
--- a/src/server/scripts/Northrend/IsleOfConquest/boss_ioc_horde_alliance.cpp
+++ b/src/server/scripts/Northrend/IsleOfConquest/boss_ioc_horde_alliance.cpp
@@ -16,8 +16,8 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "BattlegroundIC.h"
+#include "ScriptedCreature.h"
enum BossSpells
{
diff --git a/src/server/scripts/Northrend/IsleOfConquest/isle_of_conquest.cpp b/src/server/scripts/Northrend/IsleOfConquest/isle_of_conquest.cpp
index ba6f75152c8..7db8e4d30c3 100644
--- a/src/server/scripts/Northrend/IsleOfConquest/isle_of_conquest.cpp
+++ b/src/server/scripts/Northrend/IsleOfConquest/isle_of_conquest.cpp
@@ -16,13 +16,15 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "PassiveAI.h"
#include "BattlegroundIC.h"
+#include "GameObject.h"
+#include "ObjectAccessor.h"
+#include "PassiveAI.h"
#include "Player.h"
-#include "Vehicle.h"
-#include "SpellScript.h"
+#include "ScriptedCreature.h"
#include "SpellInfo.h"
+#include "SpellScript.h"
+#include "Vehicle.h"
// TO-DO: This should be done with SmartAI, but yet it does not correctly support vehicles's AIs.
// Even adding ReactState Passive we still have issues using SmartAI.
@@ -278,9 +280,7 @@ class spell_ioc_seaforium_blast_credit : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_A_BOMB_INABLE_CREDIT) || !sSpellMgr->GetSpellInfo(SPELL_A_BOMB_INATION_CREDIT))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_A_BOMB_INABLE_CREDIT, SPELL_A_BOMB_INATION_CREDIT });
}
void HandleAchievementCredit(SpellEffIndex /*effIndex*/)
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp b/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp
index 197480720e4..2f7d2d9c505 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp
@@ -16,9 +16,11 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "Player.h"
+#include "InstanceScript.h"
#include "naxxramas.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
+#include "ScriptedCreature.h"
enum AnubSays
{
@@ -79,7 +81,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_anubrekhanAI>(creature);
+ return GetNaxxramasAI<boss_anubrekhanAI>(creature);
}
struct boss_anubrekhanAI : public BossAI
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp b/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp
index e59ccea6059..0c6aef37d3c 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp
@@ -16,9 +16,11 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "InstanceScript.h"
#include "naxxramas.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "ScriptedCreature.h"
#include "SpellAuras.h"
#include "SpellInfo.h"
@@ -190,7 +192,7 @@ class boss_faerlina : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_faerlinaAI(creature);
+ return GetNaxxramasAI<boss_faerlinaAI>(creature);
}
};
@@ -244,7 +246,7 @@ class npc_faerlina_add : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_faerlina_addAI>(creature);
+ return GetNaxxramasAI<npc_faerlina_addAI>(creature);
}
};
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp
index 864e4d85438..75d1452cef5 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp
@@ -15,13 +15,16 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "Log.h"
+#include "Map.h"
#include "naxxramas.h"
+#include "ObjectAccessor.h"
#include "Player.h"
-#include "ScriptMgr.h"
#include "ScriptedCreature.h"
+#include "SpellInfo.h"
#include "SpellScript.h"
-#include "SpellAuraEffects.h"
enum Horseman
{
@@ -462,7 +465,7 @@ class boss_four_horsemen_baron : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_four_horsemen_baronAI>(creature);
+ return GetNaxxramasAI<boss_four_horsemen_baronAI>(creature);
}
};
@@ -544,7 +547,7 @@ class boss_four_horsemen_thane : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_four_horsemen_thaneAI>(creature);
+ return GetNaxxramasAI<boss_four_horsemen_thaneAI>(creature);
}
};
@@ -614,7 +617,7 @@ class boss_four_horsemen_lady : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_four_horsemen_ladyAI>(creature);
+ return GetNaxxramasAI<boss_four_horsemen_ladyAI>(creature);
}
};
@@ -696,7 +699,7 @@ class boss_four_horsemen_sir : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_four_horsemen_sirAI>(creature);
+ return GetNaxxramasAI<boss_four_horsemen_sirAI>(creature);
}
};
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp
index 1d2dd84f119..4e8344ef583 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp
@@ -16,10 +16,11 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "InstanceScript.h"
#include "naxxramas.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
#include "SpellScript.h"
-#include <math.h>
enum Texts
{
@@ -94,7 +95,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_gluthAI>(creature);
+ return GetNaxxramasAI<boss_gluthAI>(creature);
}
struct boss_gluthAI : public BossAI
@@ -326,7 +327,7 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- return (sSpellMgr->GetSpellInfo(SPELL_DECIMATE_DMG) != nullptr);
+ return ValidateSpellInfo({ SPELL_DECIMATE_DMG });
}
void Register() override
@@ -473,7 +474,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_zombie_chowAI>(creature);
+ return GetNaxxramasAI<npc_zombie_chowAI>(creature);
}
};
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp
index 2e945af729d..9d97b10f38e 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp
@@ -556,7 +556,7 @@ class boss_gothik : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_gothikAI>(creature);
+ return GetNaxxramasAI<boss_gothikAI>(creature);
}
};
@@ -663,7 +663,7 @@ class npc_gothik_minion_livingtrainee : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_gothik_minion_livingtraineeAI>(creature);
+ return GetNaxxramasAI<npc_gothik_minion_livingtraineeAI>(creature);
}
};
@@ -692,7 +692,7 @@ class npc_gothik_minion_livingknight : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_gothik_minion_livingknightAI>(creature);
+ return GetNaxxramasAI<npc_gothik_minion_livingknightAI>(creature);
}
};
@@ -722,7 +722,7 @@ class npc_gothik_minion_livingrider : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_gothik_minion_livingriderAI>(creature);
+ return GetNaxxramasAI<npc_gothik_minion_livingriderAI>(creature);
}
};
@@ -751,7 +751,7 @@ class npc_gothik_minion_spectraltrainee : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_gothik_minion_spectraltraineeAI>(creature);
+ return GetNaxxramasAI<npc_gothik_minion_spectraltraineeAI>(creature);
}
};
@@ -780,7 +780,7 @@ class npc_gothik_minion_spectralknight : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_gothik_minion_spectralknightAI>(creature);
+ return GetNaxxramasAI<npc_gothik_minion_spectralknightAI>(creature);
}
};
@@ -845,7 +845,7 @@ class npc_gothik_minion_spectralrider : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_gothik_minion_spectralriderAI>(creature);
+ return GetNaxxramasAI<npc_gothik_minion_spectralriderAI>(creature);
}
};
@@ -874,7 +874,7 @@ class npc_gothik_minion_spectralhorse : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_gothik_minion_spectralhorseAI>(creature);
+ return GetNaxxramasAI<npc_gothik_minion_spectralhorseAI>(creature);
}
};
@@ -885,7 +885,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_gothik_triggerAI>(creature);
+ return GetNaxxramasAI<npc_gothik_triggerAI>(creature);
}
struct npc_gothik_triggerAI : public ScriptedAI
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp b/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp
index c0f12918812..be4ee0ffbd1 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp
@@ -16,10 +16,12 @@
*/
#include "ScriptMgr.h"
+#include "naxxramas.h"
#include "ScriptedCreature.h"
-#include "SpellScript.h"
#include "SpellAuraEffects.h"
-#include "naxxramas.h"
+#include "SpellAuras.h"
+#include "SpellInfo.h"
+#include "SpellScript.h"
enum Spells
{
@@ -107,7 +109,7 @@ class boss_grobbulus : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_grobbulusAI(creature);
+ return GetNaxxramasAI<boss_grobbulusAI>(creature);
}
};
@@ -135,7 +137,7 @@ class npc_grobbulus_poison_cloud : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_grobbulus_poison_cloudAI(creature);
+ return GetNaxxramasAI<npc_grobbulus_poison_cloudAI>(creature);
}
};
@@ -151,10 +153,7 @@ class spell_grobbulus_mutating_injection : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_MUTATING_EXPLOSION)
- || !sSpellMgr->GetSpellInfo(SPELL_POISON_CLOUD))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_MUTATING_EXPLOSION, SPELL_POISON_CLOUD });
}
void HandleRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
@@ -194,9 +193,8 @@ class spell_grobbulus_poison_cloud : public SpellScriptLoader
bool Validate(SpellInfo const* spellInfo) override
{
- if (!sSpellMgr->GetSpellInfo(spellInfo->GetEffect(EFFECT_0)->TriggerSpell))
- return false;
- return true;
+ SpellEffectInfo const* effect0 = spellInfo->GetEffect(EFFECT_0);
+ return effect0 && ValidateSpellInfo({ effect0->TriggerSpell });
}
void PeriodicTick(AuraEffect const* aurEff)
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp b/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp
index 02a5bc0e671..3d2529de200 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp
@@ -16,10 +16,13 @@
*/
#include "ScriptMgr.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "naxxramas.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
-#include "naxxramas.h"
-#include "Player.h"
enum Spells
{
@@ -77,7 +80,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_heiganAI>(creature);
+ return GetNaxxramasAI<boss_heiganAI>(creature);
}
struct boss_heiganAI : public BossAI
@@ -233,10 +236,10 @@ class spell_heigan_eruption : public SpellScriptLoader
if (!caster || !GetHitPlayer())
return;
- if (GetHitDamage() >= int32(GetHitPlayer()->GetHealth()))
+ if (GetHitDamage() >= int32(GetHitUnit()->GetHealth()))
if (InstanceScript* instance = caster->GetInstanceScript())
if (Creature* Heigan = ObjectAccessor::GetCreature(*caster, instance->GetGuidData(DATA_HEIGAN)))
- Heigan->AI()->KilledUnit(GetHitPlayer());
+ Heigan->AI()->KilledUnit(GetHitUnit());
}
void Register() override
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp
index f7686c21a5c..26d17fc5f11 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp
@@ -19,9 +19,9 @@
#include "GameObject.h"
#include "InstanceScript.h"
#include "naxxramas.h"
+#include "ObjectAccessor.h"
#include "Player.h"
#include "PlayerAI.h"
-#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
#include "SpellAuraEffects.h"
#include "SpellScript.h"
@@ -573,7 +573,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_kelthuzadAI>(creature);
+ return GetNaxxramasAI<boss_kelthuzadAI>(creature);
}
};
@@ -704,7 +704,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_kelthuzad_skeletonAI>(creature);
+ return GetNaxxramasAI<npc_kelthuzad_skeletonAI>(creature);
}
};
@@ -730,7 +730,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_kelthuzad_bansheeAI>(creature);
+ return GetNaxxramasAI<npc_kelthuzad_bansheeAI>(creature);
}
};
@@ -773,7 +773,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_kelthuzad_abominationAI>(creature);
+ return GetNaxxramasAI<npc_kelthuzad_abominationAI>(creature);
}
};
@@ -867,7 +867,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_kelthuzad_guardianAI>(creature);
+ return GetNaxxramasAI<npc_kelthuzad_guardianAI>(creature);
}
};
@@ -920,9 +920,7 @@ public:
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_MANA_DETONATION_DAMAGE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_MANA_DETONATION_DAMAGE });
}
void HandleScript(AuraEffect const* aurEff)
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_loatheb.cpp b/src/server/scripts/Northrend/Naxxramas/boss_loatheb.cpp
index 0506d85faa3..57f3e06a90a 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_loatheb.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_loatheb.cpp
@@ -16,10 +16,11 @@
*/
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "naxxramas.h"
#include "ScriptedCreature.h"
+#include "SpellAuras.h"
#include "SpellScript.h"
-#include "SpellAuraEffects.h"
-#include "naxxramas.h"
enum Spells
{
@@ -146,7 +147,7 @@ class boss_loatheb : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_loathebAI(creature);
+ return GetNaxxramasAI<boss_loathebAI>(creature);
}
};
@@ -172,9 +173,7 @@ class spell_loatheb_deathbloom : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DEATHBLOOM_FINAL_DAMAGE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DEATHBLOOM_FINAL_DAMAGE });
}
void AfterRemove(AuraEffect const* eff, AuraEffectHandleModes /*mode*/)
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp b/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp
index 15ff3abc49d..fa26ecba402 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp
@@ -16,10 +16,12 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "InstanceScript.h"
+#include "naxxramas.h"
+#include "ObjectAccessor.h"
#include "PassiveAI.h"
+#include "ScriptedCreature.h"
#include "SpellScript.h"
-#include "naxxramas.h"
enum Spells
{
@@ -94,7 +96,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_maexxnaAI(creature);
+ return GetNaxxramasAI<boss_maexxnaAI>(creature);
}
struct boss_maexxnaAI : public BossAI
@@ -195,7 +197,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_webwrapAI(creature);
+ return GetNaxxramasAI<npc_webwrapAI>(creature);
}
struct npc_webwrapAI : public NullCreatureAI
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp b/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp
index b57611df227..e78788dc04b 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp
@@ -16,8 +16,8 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "naxxramas.h"
+#include "ScriptedCreature.h"
enum Phases
{
@@ -334,7 +334,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_nothAI>(creature);
+ return GetNaxxramasAI<boss_nothAI>(creature);
}
};
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp b/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp
index acf37ad4d10..cb3d8e7647a 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp
@@ -16,8 +16,9 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "InstanceScript.h"
#include "naxxramas.h"
+#include "ScriptedCreature.h"
enum Spells
{
@@ -61,7 +62,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_patchwerkAI>(creature);
+ return GetNaxxramasAI<boss_patchwerkAI>(creature);
}
struct boss_patchwerkAI : public BossAI
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp b/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp
index 51eb68b6eed..0e6e8f09ccd 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp
@@ -16,9 +16,11 @@
*/
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "naxxramas.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
#include "SpellInfo.h"
-#include "naxxramas.h"
enum Yells
{
@@ -60,7 +62,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_razuviousAI(creature);
+ return GetNaxxramasAI<boss_razuviousAI>(creature);
}
struct boss_razuviousAI : public BossAI
@@ -240,7 +242,7 @@ class npc_dk_understudy : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_dk_understudyAI>(creature);
+ return GetNaxxramasAI<npc_dk_understudyAI>(creature);
}
};
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp
index 81c2d2d4624..5c2a1ea1016 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp
@@ -16,12 +16,16 @@
*/
#include "ScriptMgr.h"
+#include "GameObject.h"
#include "GameObjectAI.h"
-#include "ScriptedCreature.h"
-#include "SpellScript.h"
+#include "InstanceScript.h"
+#include "naxxramas.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "ScriptedCreature.h"
#include "SpellInfo.h"
-#include "naxxramas.h"
+#include "SpellScript.h"
+#include "TemporarySummon.h"
enum Yells
{
@@ -307,8 +311,7 @@ class boss_sapphiron : public CreatureScript
std::list<Unit*> targets;
SelectTargetList(targets, RAID_MODE(2, 3), SELECT_TARGET_RANDOM, 200.0f, true);
for (Unit* target : targets)
- if (target)
- _iceboltTargets.push_back(target->GetGUID());
+ _iceboltTargets.push_back(target->GetGUID());
return;
}
case EVENT_ICEBOLT:
@@ -375,7 +378,7 @@ class boss_sapphiron : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_sapphironAI(creature);
+ return GetNaxxramasAI<boss_sapphironAI>(creature);
}
};
@@ -411,11 +414,10 @@ class go_sapphiron_birth : public GameObjectScript
GameObjectAI* GetAI(GameObject* go) const override
{
- return GetInstanceAI<go_sapphiron_birthAI>(go);
+ return GetNaxxramasAI<go_sapphiron_birthAI>(go);
}
};
-
class spell_sapphiron_change_blizzard_target : public SpellScriptLoader
{
public:
@@ -485,7 +487,7 @@ class spell_sapphiron_icebolt : public SpellScriptLoader
return;
float x, y, z;
GetTarget()->GetPosition(x, y, z);
- if (GameObject* block = GetTarget()->SummonGameObject(GO_ICEBLOCK, x, y, z, 0.f, G3D::Quat(), 25))
+ if (GameObject* block = GetTarget()->SummonGameObject(GO_ICEBLOCK, x, y, z, 0.f, QuaternionData(), 25))
_block = block->GetGUID();
}
@@ -521,7 +523,7 @@ class spell_sapphiron_frost_breath : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- return !!sSpellMgr->GetSpellInfo(SPELL_FROST_BREATH);
+ return ValidateSpellInfo({ SPELL_FROST_BREATH });
}
void HandleTargets(std::list<WorldObject*>& targetList)
@@ -591,7 +593,7 @@ class spell_sapphiron_summon_blizzard : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- return !!sSpellMgr->GetSpellInfo(SPELL_SUMMON_BLIZZARD);
+ return ValidateSpellInfo({ SPELL_SUMMON_BLIZZARD });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp b/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp
index f4df1ab367f..7bddb692a98 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp
@@ -24,7 +24,6 @@
#include "Player.h"
#include "ScriptedCreature.h"
#include "SpellInfo.h"
-#include "SpellMgr.h"
#include "SpellScript.h"
enum Phases
@@ -168,7 +167,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_thaddiusAI>(creature);
+ return GetNaxxramasAI<boss_thaddiusAI>(creature);
}
struct boss_thaddiusAI : public BossAI
@@ -484,7 +483,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_stalaggAI>(creature);
+ return GetNaxxramasAI<npc_stalaggAI>(creature);
}
struct npc_stalaggAI : public ScriptedAI
@@ -752,7 +751,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_feugenAI>(creature);
+ return GetNaxxramasAI<npc_feugenAI>(creature);
}
struct npc_feugenAI : public ScriptedAI
@@ -1023,7 +1022,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_teslaAI>(creature);
+ return GetNaxxramasAI<npc_teslaAI>(creature);
}
struct npc_teslaAI : public ScriptedAI
@@ -1048,15 +1047,16 @@ class spell_thaddius_polarity_charge : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- return (
- sSpellMgr->GetSpellInfo(SPELL_POLARITY_SHIFT) &&
- sSpellMgr->GetSpellInfo(SPELL_POSITIVE_CHARGE_APPLY) &&
- sSpellMgr->GetSpellInfo(SPELL_POSITIVE_CHARGE_TICK) &&
- sSpellMgr->GetSpellInfo(SPELL_POSITIVE_CHARGE_AMP) &&
- sSpellMgr->GetSpellInfo(SPELL_NEGATIVE_CHARGE_APPLY) &&
- sSpellMgr->GetSpellInfo(SPELL_NEGATIVE_CHARGE_TICK) &&
- sSpellMgr->GetSpellInfo(SPELL_NEGATIVE_CHARGE_AMP)
- );
+ return ValidateSpellInfo(
+ {
+ SPELL_POLARITY_SHIFT,
+ SPELL_POSITIVE_CHARGE_APPLY,
+ SPELL_POSITIVE_CHARGE_TICK,
+ SPELL_POSITIVE_CHARGE_AMP,
+ SPELL_NEGATIVE_CHARGE_APPLY,
+ SPELL_NEGATIVE_CHARGE_TICK,
+ SPELL_NEGATIVE_CHARGE_AMP
+ });
}
void HandleTargets(std::list<WorldObject*>& targetList)
@@ -1146,15 +1146,16 @@ class spell_thaddius_polarity_shift : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- return (
- sSpellMgr->GetSpellInfo(SPELL_POLARITY_SHIFT) &&
- sSpellMgr->GetSpellInfo(SPELL_POSITIVE_CHARGE_APPLY) &&
- sSpellMgr->GetSpellInfo(SPELL_POSITIVE_CHARGE_TICK) &&
- sSpellMgr->GetSpellInfo(SPELL_POSITIVE_CHARGE_AMP) &&
- sSpellMgr->GetSpellInfo(SPELL_NEGATIVE_CHARGE_APPLY) &&
- sSpellMgr->GetSpellInfo(SPELL_NEGATIVE_CHARGE_TICK) &&
- sSpellMgr->GetSpellInfo(SPELL_NEGATIVE_CHARGE_AMP)
- );
+ return ValidateSpellInfo(
+ {
+ SPELL_POLARITY_SHIFT,
+ SPELL_POSITIVE_CHARGE_APPLY,
+ SPELL_POSITIVE_CHARGE_TICK,
+ SPELL_POSITIVE_CHARGE_AMP,
+ SPELL_NEGATIVE_CHARGE_APPLY,
+ SPELL_NEGATIVE_CHARGE_TICK,
+ SPELL_NEGATIVE_CHARGE_AMP
+ });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -1198,7 +1199,7 @@ class spell_thaddius_magnetic_pull : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- return sSpellMgr->GetSpellInfo(SPELL_MAGNETIC_PULL) ? true : false;
+ return ValidateSpellInfo({ SPELL_MAGNETIC_PULL });
}
void HandleCast() // only feugen ever casts this according to wowhead data
diff --git a/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp b/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp
index 8c3eb42979f..891b8fd76be 100644
--- a/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp
@@ -16,9 +16,15 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "AreaBoundary.h"
+#include "Creature.h"
+#include "CreatureAI.h"
+#include "EventMap.h"
+#include "GameObject.h"
#include "InstanceScript.h"
+#include "Map.h"
#include "naxxramas.h"
+#include "TemporarySummon.h"
BossBoundaryData const boundaries =
{
@@ -104,7 +110,7 @@ ObjectData const objectData[] =
class instance_naxxramas : public InstanceMapScript
{
public:
- instance_naxxramas() : InstanceMapScript("instance_naxxramas", 533) { }
+ instance_naxxramas() : InstanceMapScript(NaxxramasScriptName, 533) { }
struct instance_naxxramas_InstanceMapScript : public InstanceScript
{
diff --git a/src/server/scripts/Northrend/Naxxramas/naxxramas.h b/src/server/scripts/Northrend/Naxxramas/naxxramas.h
index e847179ddeb..3b6d257f7cf 100644
--- a/src/server/scripts/Northrend/Naxxramas/naxxramas.h
+++ b/src/server/scripts/Northrend/Naxxramas/naxxramas.h
@@ -18,6 +18,9 @@
#ifndef DEF_NAXXRAMAS_H
#define DEF_NAXXRAMAS_H
+#include "CreatureAIImpl.h"
+
+#define NaxxramasScriptName "instance_naxxramas"
#define DataHeader "NAX"
uint32 const EncounterCount = 15;
@@ -215,17 +218,10 @@ enum NAXInstanceTexts
SAY_DIALOGUE_SAPPHIRON_LICH_KING2 = 2
};
-/*
-template<class AI>
-CreatureAI* GetNaxxramasAI(Creature* creature)
+template<typename AI, typename T>
+inline AI* GetNaxxramasAI(T* obj)
{
- if (InstanceMap* instance = creature->GetMap()->ToInstanceMap())
- if (instance->GetInstanceScript())
- if (instance->GetScriptId() == sObjectMgr->GetScriptId(NaxxramasScriptName))
- return new AI(creature);
-
- return NULL;
+ return GetInstanceAI<AI>(obj, NaxxramasScriptName);
}
-*/
#endif
diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp
index 67f66aa0e2e..ca0bbefb81a 100644
--- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp
+++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp
@@ -20,16 +20,20 @@ SDName: Boss Malygos
Script Data End */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "SpellScript.h"
-#include "SpellAuraEffects.h"
+#include "CombatAI.h"
#include "eye_of_eternity.h"
+#include "GameObject.h"
+#include "GridNotifiers.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "ScriptedCreature.h"
+#include "Spell.h"
+#include "SpellInfo.h"
+#include "SpellScript.h"
+#include "TemporarySummon.h"
#include "Vehicle.h"
-#include "CombatAI.h"
-#include "GameObjectAI.h"
-#include "CreatureTextMgr.h"
-#include "MoveSplineInit.h"
enum Events
{
@@ -1006,9 +1010,9 @@ public:
if (Creature* alexstraszaGiftBoxBunny = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_GIFT_BOX_BUNNY_GUID)))
{
if (GetDifficulty() == DIFFICULTY_10_N)
- alexstraszaGiftBoxBunny->SummonGameObject(GO_HEART_OF_MAGIC_10, HeartOfMagicSpawnPos, G3D::Quat(), 0);
+ alexstraszaGiftBoxBunny->SummonGameObject(GO_HEART_OF_MAGIC_10, HeartOfMagicSpawnPos, QuaternionData(), 0);
else if (GetDifficulty() == DIFFICULTY_25_N)
- alexstraszaGiftBoxBunny->SummonGameObject(GO_HEART_OF_MAGIC_25, HeartOfMagicSpawnPos, G3D::Quat(), 0);
+ alexstraszaGiftBoxBunny->SummonGameObject(GO_HEART_OF_MAGIC_25, HeartOfMagicSpawnPos, QuaternionData(), 0);
}
me->SummonCreature(NPC_ALEXSTRASZA, AlexstraszaSpawnPos, TEMPSUMMON_MANUAL_DESPAWN);
@@ -1038,7 +1042,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_malygosAI>(creature);
+ return GetEyeOfEternityAI<boss_malygosAI>(creature);
}
};
@@ -1088,7 +1092,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_portal_eoeAI>(creature);
+ return GetEyeOfEternityAI<npc_portal_eoeAI>(creature);
}
};
@@ -1149,7 +1153,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_power_sparkAI>(creature);
+ return GetEyeOfEternityAI<npc_power_sparkAI>(creature);
}
};
@@ -1260,7 +1264,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_melee_hover_diskAI>(creature);
+ return GetEyeOfEternityAI<npc_melee_hover_diskAI>(creature);
}
};
@@ -1323,7 +1327,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_caster_hover_diskAI>(creature);
+ return GetEyeOfEternityAI<npc_caster_hover_diskAI>(creature);
}
};
@@ -1399,7 +1403,7 @@ class npc_nexus_lord : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_nexus_lordAI>(creature);
+ return GetEyeOfEternityAI<npc_nexus_lordAI>(creature);
}
};
@@ -1466,7 +1470,7 @@ class npc_scion_of_eternity : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_scion_of_eternityAI>(creature);
+ return GetEyeOfEternityAI<npc_scion_of_eternityAI>(creature);
}
};
@@ -1520,7 +1524,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_arcane_overloadAI>(creature);
+ return GetEyeOfEternityAI<npc_arcane_overloadAI>(creature);
}
};
@@ -1539,9 +1543,9 @@ public:
void IsSummonedBy(Unit* summoner) override
{
_summoner.Clear();
- if (Player* player = summoner->ToPlayer())
+ if (summoner->GetTypeId() == TYPEID_PLAYER)
{
- _summoner = player->GetGUID();
+ _summoner = summoner->GetGUID();
_events.ScheduleEvent(EVENT_CAST_RIDE_SPELL, 2*IN_MILLISECONDS);
}
}
@@ -1585,7 +1589,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_wyrmrest_skytalonAI(creature);
+ return GetEyeOfEternityAI<npc_wyrmrest_skytalonAI>(creature);
}
};
@@ -1611,7 +1615,7 @@ class npc_static_field : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_static_fieldAI(creature);
+ return GetEyeOfEternityAI<npc_static_fieldAI>(creature);
}
};
@@ -1631,10 +1635,7 @@ class spell_malygos_portal_beam : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PORTAL_OPENED))
- return false;
-
- return true;
+ return ValidateSpellInfo({ SPELL_PORTAL_OPENED });
}
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -1734,10 +1735,7 @@ class spell_malygos_arcane_storm : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_ARCANE_STORM_EXTRA_VISUAL))
- return false;
-
- return true;
+ return ValidateSpellInfo({ SPELL_ARCANE_STORM_EXTRA_VISUAL });
}
void FilterTargets(std::list<WorldObject*>& targets)
@@ -1831,10 +1829,7 @@ class spell_malygos_vortex_visual : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_VORTEX_1) || !sSpellMgr->GetSpellInfo(SPELL_VORTEX_6))
- return false;
-
- return true;
+ return ValidateSpellInfo({ SPELL_VORTEX_1, SPELL_VORTEX_6 });
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -2074,10 +2069,7 @@ class spell_malygos_destroy_platform_channel : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DESTROY_PLATFORM_BOOM_VISUAL))
- return false;
-
- return true;
+ return ValidateSpellInfo({ SPELL_DESTROY_PLATFORM_BOOM_VISUAL });
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -2116,10 +2108,7 @@ class spell_alexstrasza_bunny_destroy_platform_boom_visual : public SpellScriptL
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DESTROY_PLATFORM_EVENT))
- return false;
-
- return true;
+ return ValidateSpellInfo({ SPELL_DESTROY_PLATFORM_EVENT });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -2262,10 +2251,7 @@ class spell_malygos_surge_of_power_warning_selector_25 : public SpellScriptLoade
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SURGE_OF_POWER_PHASE_3_25))
- return false;
-
- return true;
+ return ValidateSpellInfo({ SPELL_SURGE_OF_POWER_PHASE_3_25 });
}
void SendThreeTargets(std::list<WorldObject*>& targets)
@@ -2379,10 +2365,7 @@ class spell_alexstrasza_gift_beam : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_ALEXSTRASZAS_GIFT_BEAM_VISUAL))
- return false;
-
- return true;
+ return ValidateSpellInfo({ SPELL_ALEXSTRASZAS_GIFT_BEAM_VISUAL });
}
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -2436,9 +2419,9 @@ class spell_alexstrasza_gift_beam_visual : public SpellScriptLoader
if (Creature* target = GetTarget()->ToCreature())
{
if (target->GetMap()->GetDifficultyID() == DIFFICULTY_10_N)
- _alexstraszaGift = target->SummonGameObject(GO_ALEXSTRASZA_S_GIFT_10, *target, G3D::Quat(), 0);
+ _alexstraszaGift = target->SummonGameObject(GO_ALEXSTRASZA_S_GIFT_10, *target, QuaternionData(), 0);
else if (target->GetMap()->GetDifficultyID() == DIFFICULTY_25_N)
- _alexstraszaGift = target->SummonGameObject(GO_ALEXSTRASZA_S_GIFT_25, *target, G3D::Quat(), 0);
+ _alexstraszaGift = target->SummonGameObject(GO_ALEXSTRASZA_S_GIFT_25, *target, QuaternionData(), 0);
}
}
diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/eye_of_eternity.h b/src/server/scripts/Northrend/Nexus/EyeOfEternity/eye_of_eternity.h
index e06b5c1023e..9f1f7d35db1 100644
--- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/eye_of_eternity.h
+++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/eye_of_eternity.h
@@ -18,6 +18,9 @@
#ifndef DEF_EYE_OF_ETERNITY_H
#define DEF_EYE_OF_ETERNITY_H
+#include "CreatureAIImpl.h"
+
+#define EoEScriptName "instance_eye_of_eternity"
#define DataHeader "EOE"
enum InstanceData
@@ -84,4 +87,10 @@ enum InstanceSpells
SPELL_SUMMOM_RED_DRAGON_BUDDY = 56070
};
+template<typename AI>
+inline AI* GetEyeOfEternityAI(Creature* creature)
+{
+ return GetInstanceAI<AI>(creature, EoEScriptName);
+}
+
#endif
diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp
index 31fb657dc80..3c0cf809fae 100644
--- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp
+++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp
@@ -16,9 +16,13 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "InstanceScript.h"
+#include "AreaBoundary.h"
+#include "Creature.h"
+#include "CreatureAI.h"
#include "eye_of_eternity.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "Map.h"
#include "Player.h"
BossBoundaryData const boundaries =
@@ -29,7 +33,7 @@ BossBoundaryData const boundaries =
class instance_eye_of_eternity : public InstanceMapScript
{
public:
- instance_eye_of_eternity() : InstanceMapScript("instance_eye_of_eternity", 616) { }
+ instance_eye_of_eternity() : InstanceMapScript(EoEScriptName, 616) { }
InstanceScript* GetInstanceScript(InstanceMap* map) const override
{
@@ -60,9 +64,9 @@ public:
{
if (state == FAIL)
{
- for (GuidList::const_iterator itr_trigger = portalTriggers.begin(); itr_trigger != portalTriggers.end(); ++itr_trigger)
+ for (ObjectGuid const& portalTriggerGuid : portalTriggers)
{
- if (Creature* trigger = instance->GetCreature(*itr_trigger))
+ if (Creature* trigger = instance->GetCreature(portalTriggerGuid))
{
// just in case
trigger->RemoveAllAuras();
@@ -86,7 +90,7 @@ public:
void SpawnGameObject(uint32 entry, Position const& pos)
{
GameObject* go = new GameObject();
- if (!go->Create(entry, instance, PHASEMASK_NORMAL, pos, G3D::Quat(), 255, GO_STATE_READY))
+ if (!go->Create(entry, instance, PHASEMASK_NORMAL, pos, QuaternionData(), 255, GO_STATE_READY))
{
delete go;
return;
diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp
index 3f2060b2f0b..dfafa3222ef 100644
--- a/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp
+++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp
@@ -17,8 +17,11 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "InstanceScript.h"
#include "nexus.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
+#include "TemporarySummon.h"
enum Spells
{
@@ -189,7 +192,7 @@ class boss_anomalus : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_anomalusAI>(creature);
+ return GetNexusAI<boss_anomalusAI>(creature);
}
};
@@ -263,7 +266,7 @@ class npc_chaotic_rift : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_chaotic_riftAI>(creature);
+ return GetNexusAI<npc_chaotic_riftAI>(creature);
}
};
diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp
index 3f5e8fac6d6..79543f63e40 100644
--- a/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp
+++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp
@@ -16,11 +16,13 @@
*/
#include "ScriptMgr.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "nexus.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
-#include "SpellAuraEffects.h"
-#include "Player.h"
-#include "nexus.h"
enum Spells
{
@@ -209,7 +211,7 @@ class boss_keristrasza : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_keristraszaAI>(creature);
+ return GetNexusAI<boss_keristraszaAI>(creature);
}
};
@@ -245,9 +247,9 @@ class spell_intense_cold : public SpellScriptLoader
{
PrepareAuraScript(spell_intense_cold_AuraScript);
- void HandlePeriodicTick(AuraEffect const* aurEff)
+ void HandlePeriodicTick(AuraEffect const* /*aurEff*/)
{
- if (aurEff->GetBase()->GetStackAmount() < 2)
+ if (GetStackAmount() < 2)
return;
Unit* caster = GetCaster();
/// @todo the caster should be boss but not the player
@@ -280,7 +282,7 @@ class achievement_intense_cold : public AchievementCriteriaScript
if (!target)
return false;
- GuidList const& _intenseColdList = ENSURE_AI(boss_keristrasza::boss_keristraszaAI, target->ToCreature()->AI())->_intenseColdList;
+ GuidList const& _intenseColdList = ENSURE_AI(boss_keristrasza::boss_keristraszaAI, target->GetAI())->_intenseColdList;
if (!_intenseColdList.empty())
for (GuidList::const_iterator itr = _intenseColdList.begin(); itr != _intenseColdList.end(); ++itr)
if (player->GetGUID() == *itr)
diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp
index d72fe969e77..f1e3484a971 100644
--- a/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp
+++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp
@@ -17,9 +17,12 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "nexus.h"
#include "GameEventMgr.h"
+#include "InstanceScript.h"
+#include "nexus.h"
+#include "ScriptedCreature.h"
+#include "TemporarySummon.h"
+#include "World.h"
enum Spells
{
@@ -70,7 +73,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_magus_telestraAI>(creature);
+ return GetNexusAI<boss_magus_telestraAI>(creature);
}
struct boss_magus_telestraAI : public ScriptedAI
diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_nexus_commanders.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_nexus_commanders.cpp
index 935d309eb02..630806bdcec 100644
--- a/src/server/scripts/Northrend/Nexus/Nexus/boss_nexus_commanders.cpp
+++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_nexus_commanders.cpp
@@ -16,8 +16,8 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "nexus.h"
+#include "ScriptedCreature.h"
enum Spells
{
@@ -100,7 +100,7 @@ class boss_nexus_commanders : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_nexus_commandersAI>(creature);
+ return GetNexusAI<boss_nexus_commandersAI>(creature);
}
};
diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp
index 950ba5d91f7..95651b032b6 100644
--- a/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp
+++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp
@@ -17,8 +17,9 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "GameObject.h"
#include "nexus.h"
+#include "ScriptedCreature.h"
#include "SpellScript.h"
enum Spells
@@ -170,7 +171,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_ormorokAI>(creature);
+ return GetNexusAI<boss_ormorokAI>(creature);
}
};
@@ -258,7 +259,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_crystal_spike_triggerAI(creature);
+ return GetNexusAI<npc_crystal_spike_triggerAI>(creature);
}
};
diff --git a/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp b/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp
index bc28c610e87..680c508fe6c 100644
--- a/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp
+++ b/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp
@@ -17,9 +17,12 @@
*/
#include "ScriptMgr.h"
+#include "Creature.h"
+#include "GameObject.h"
#include "InstanceScript.h"
-#include "Player.h"
+#include "Map.h"
#include "nexus.h"
+#include "Player.h"
enum Factions
{
diff --git a/src/server/scripts/Northrend/Nexus/Nexus/nexus.h b/src/server/scripts/Northrend/Nexus/Nexus/nexus.h
index c4b07c78c3b..b7859963fca 100644
--- a/src/server/scripts/Northrend/Nexus/Nexus/nexus.h
+++ b/src/server/scripts/Northrend/Nexus/Nexus/nexus.h
@@ -18,6 +18,8 @@
#ifndef DEF_NEXUS_H
#define DEF_NEXUS_H
+#include "CreatureAIImpl.h"
+
#define NexusScriptName "instance_nexus"
#define DataHeader "NEX"
@@ -63,4 +65,10 @@ enum NEXGameObjectIds
GO_TELESTRAS_CONTAINMET_SPHERE = 188526
};
+template<typename AI>
+inline AI* GetNexusAI(Creature* obj)
+{
+ return GetInstanceAI<AI>(obj, NexusScriptName);
+}
+
#endif
diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp
index 2de00fdb6d0..fcf9992159c 100644
--- a/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp
+++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp
@@ -16,8 +16,9 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "InstanceScript.h"
#include "oculus.h"
+#include "ScriptedCreature.h"
enum Spells
{
@@ -201,7 +202,7 @@ class npc_unstable_sphere : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_unstable_sphereAI(creature);
+ return GetOculusAI<npc_unstable_sphereAI>(creature);
}
};
diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp
index c5a1a95b2f8..dafe692ee75 100644
--- a/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp
+++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp
@@ -16,10 +16,9 @@
*/
#include "ScriptMgr.h"
+#include "oculus.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
-#include "SpellAuraEffects.h"
-#include "oculus.h"
// Types of drake mounts: Ruby (Tank), Amber (DPS), Emerald (Healer)
// Two Repeating phases
@@ -258,7 +257,7 @@ class boss_eregos : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_eregosAI(creature);
+ return GetOculusAI<boss_eregosAI>(creature);
}
};
@@ -273,8 +272,7 @@ class spell_eregos_planar_shift : public SpellScriptLoader
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
- if (Creature* creature = GetTarget()->ToCreature())
- creature->AI()->DoAction(ACTION_SET_NORMAL_EVENTS);
+ GetTarget()->GetAI()->DoAction(ACTION_SET_NORMAL_EVENTS);
}
void Register() override
diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp
index b07c0f22169..92fdea2576d 100644
--- a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp
+++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp
@@ -23,8 +23,8 @@ SDCategory: Instance Script
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "oculus.h"
+#include "ScriptedCreature.h"
#include "SpellInfo.h"
enum Spells
diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp
index 7865ffaec8d..d476c7aa115 100644
--- a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp
+++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp
@@ -16,10 +16,12 @@
*/
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
+#include "oculus.h"
#include "ScriptedCreature.h"
+#include "SpellInfo.h"
#include "SpellScript.h"
-#include "SpellAuraEffects.h"
-#include "oculus.h"
enum Says
{
@@ -255,7 +257,7 @@ class npc_azure_ring_captain : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_azure_ring_captainAI>(creature);
+ return GetOculusAI<npc_azure_ring_captainAI>(creature);
}
};
@@ -271,7 +273,7 @@ class spell_varos_centrifuge_shield : public SpellScriptLoader
bool Load() override
{
Unit* caster = GetCaster();
- return (caster && caster->ToCreature());
+ return caster && caster->GetTypeId() == TYPEID_UNIT;
}
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
diff --git a/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp b/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp
index b372dd8cc51..8f038a632b6 100644
--- a/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp
+++ b/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp
@@ -16,10 +16,15 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "Creature.h"
+#include "CreatureAI.h"
+#include "EventMap.h"
+#include "GameObject.h"
#include "InstanceScript.h"
-#include "WorldPacket.h"
+#include "Map.h"
#include "oculus.h"
+#include "TemporarySummon.h"
+#include "WorldStatePackets.h"
DoorData const doorData[] =
{
diff --git a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp
index 78f2d7cca4d..739bb84b128 100644
--- a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp
+++ b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp
@@ -25,10 +25,9 @@
#include "ScriptedGossip.h"
#include "Spell.h"
#include "SpellAuraEffects.h"
+#include "SpellAuras.h"
#include "SpellInfo.h"
-#include "SpellMgr.h"
#include "SpellScript.h"
-#include "Vehicle.h"
enum GossipNPCs
{
@@ -188,7 +187,7 @@ class npc_verdisa_beglaristrasz_eternos : public CreatureScript
default:
return;
}
- player->PlayerTalkClass->SendCloseGossip();
+ CloseGossipMenuFor(player);
}
void MovementInform(uint32 /*type*/, uint32 id) override
@@ -481,9 +480,7 @@ class spell_oculus_evasive_maneuvers : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_RUBY_EVASIVE_CHARGES))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_RUBY_EVASIVE_CHARGES });
}
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& /*eventInfo*/)
@@ -518,9 +515,7 @@ class spell_oculus_shock_lance : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_AMBER_SHOCK_CHARGE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_AMBER_SHOCK_CHARGE });
}
void CalcDamage()
@@ -560,9 +555,7 @@ class spell_oculus_stop_time : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_AMBER_SHOCK_CHARGE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_AMBER_SHOCK_CHARGE });
}
void Apply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -600,9 +593,7 @@ class spell_oculus_temporal_rift : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_AMBER_SHOCK_CHARGE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_AMBER_SHOCK_CHARGE });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
diff --git a/src/server/scripts/Northrend/Nexus/Oculus/oculus.h b/src/server/scripts/Northrend/Nexus/Oculus/oculus.h
index 94931e9dae0..d1535a8b948 100644
--- a/src/server/scripts/Northrend/Nexus/Oculus/oculus.h
+++ b/src/server/scripts/Northrend/Nexus/Oculus/oculus.h
@@ -18,6 +18,8 @@
#ifndef OCULUS_H_
#define OCULUS_H_
+#include "CreatureAIImpl.h"
+
#define OculusScriptName "instance_oculus"
#define DataHeader "OC"
@@ -105,8 +107,8 @@ enum OCMisc
POINT_MOVE_OUT = 1
};
-template<class AI>
-AI* GetOculusAI(Creature* creature)
+template<typename AI>
+inline AI* GetOculusAI(Creature* creature)
{
return GetInstanceAI<AI>(creature, OculusScriptName);
}
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp
index 65991267f63..05c6038f714 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp
@@ -24,8 +24,10 @@ SDCategory: Halls of Lightning
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "halls_of_lightning.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
enum Yells
{
@@ -99,7 +101,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_bjarngrimAI>(creature);
+ return GetHallsOfLightningAI<boss_bjarngrimAI>(creature);
}
struct boss_bjarngrimAI : public ScriptedAI
@@ -392,7 +394,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_stormforged_lieutenantAI>(creature);
+ return GetHallsOfLightningAI<npc_stormforged_lieutenantAI>(creature);
}
struct npc_stormforged_lieutenantAI : public ScriptedAI
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp
index aadab9f1d29..ae1202cf522 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp
@@ -21,8 +21,10 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "halls_of_lightning.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
#include "SpellInfo.h"
enum Spells
@@ -69,7 +71,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_ionarAI>(creature);
+ return GetHallsOfLightningAI<boss_ionarAI>(creature);
}
struct boss_ionarAI : public ScriptedAI
@@ -376,7 +378,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_spark_of_ionarAI>(creature);
+ return GetHallsOfLightningAI<npc_spark_of_ionarAI>(creature);
}
};
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp
index 151dde28176..fb6531dc222 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp
@@ -24,9 +24,10 @@ SDCategory: Halls of Lightning
EndScriptData */
#include "ScriptMgr.h"
+#include "halls_of_lightning.h"
+#include "InstanceScript.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
-#include "halls_of_lightning.h"
enum Texts
{
@@ -205,7 +206,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_lokenAI>(creature);
+ return GetHallsOfLightningAI<boss_lokenAI>(creature);
}
};
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp
index eb15bc4a02b..9b3f00c7c44 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp
@@ -24,9 +24,9 @@ SDCategory: Halls of Lightning
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "halls_of_lightning.h"
-#include "Player.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
#include "SpellInfo.h"
enum Texts
@@ -365,9 +365,8 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_volkhanAI>(creature);
+ return GetHallsOfLightningAI<boss_volkhanAI>(creature);
}
-
};
/*######
@@ -381,7 +380,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_molten_golemAI(creature);
+ return GetHallsOfLightningAI<npc_molten_golemAI>(creature);
}
struct npc_molten_golemAI : public ScriptedAI
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/halls_of_lightning.h b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/halls_of_lightning.h
index 2cbbd8556b6..5a380e15bd7 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/halls_of_lightning.h
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/halls_of_lightning.h
@@ -18,6 +18,8 @@
#ifndef HALLS_OF_LIGHTNING_H_
#define HALLS_OF_LIGHTNING_H_
+#include "CreatureAIImpl.h"
+
#define HoLScriptName "instance_halls_of_lightning"
#define DataHeader "HOL"
@@ -49,8 +51,8 @@ enum HOLGameObjectIds
GO_LOKEN_THRONE = 192654
};
-template<class AI>
-AI* GetHallsOfLightningAI(Creature* creature)
+template<typename AI>
+inline AI* GetHallsOfLightningAI(Creature* creature)
{
return GetInstanceAI<AI>(creature, HoLScriptName);
}
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp
index 0782a552bc4..97027d7933e 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp
@@ -16,8 +16,11 @@
*/
#include "ScriptMgr.h"
-#include "InstanceScript.h"
+#include "Creature.h"
+#include "GameObject.h"
#include "halls_of_lightning.h"
+#include "InstanceScript.h"
+#include "Map.h"
DoorData const doorData[] =
{
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp
index 3369879e138..8ff1741608c 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp
@@ -16,10 +16,10 @@
*/
#include "ScriptMgr.h"
+#include "halls_of_stone.h"
#include "ScriptedCreature.h"
#include "SpellInfo.h"
#include "SpellScript.h"
-#include "halls_of_stone.h"
enum Spells
{
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_maiden_of_grief.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_maiden_of_grief.cpp
index fc671a2b0bc..516c83b6be7 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_maiden_of_grief.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_maiden_of_grief.cpp
@@ -16,8 +16,9 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "halls_of_stone.h"
+#include "InstanceScript.h"
+#include "ScriptedCreature.h"
enum Yells
{
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp
index 47fc35d6207..435000665cb 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp
@@ -16,8 +16,10 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "halls_of_stone.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
enum Spells
{
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp
index fdb0b539804..b1bfe45970a 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp
@@ -16,11 +16,13 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
-#include "ScriptedEscortAI.h"
#include "halls_of_stone.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "ScriptedGossip.h"
+#include "ScriptedEscortAI.h"
+#include "TemporarySummon.h"
enum Texts
{
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.h b/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.h
index 69042bf18f4..ff887983068 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.h
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.h
@@ -18,6 +18,8 @@
#ifndef HALLS_OF_STONE_H_
#define HALLS_OF_STONE_H_
+#include "CreatureAIImpl.h"
+
#define HoSScriptName "instance_halls_of_stone"
#define DataHeader "HOS"
@@ -67,8 +69,8 @@ enum HOSGameObjectIds
GO_TRIBUNAL_SKY_FLOOR = 191527
};
-template<class AI>
-AI* GetHallsOfStoneAI(Creature* creature)
+template<typename AI>
+inline AI* GetHallsOfStoneAI(Creature* creature)
{
return GetInstanceAI<AI>(creature, HoSScriptName);
}
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp
index 7609a8518c8..197357663fc 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp
@@ -15,10 +15,12 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "InstanceScript.h"
-#include "Player.h"
#include "ScriptMgr.h"
+#include "Creature.h"
+#include "GameObject.h"
#include "halls_of_stone.h"
+#include "InstanceScript.h"
+#include "Map.h"
DoorData const doorData[] =
{
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_assembly_of_iron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_assembly_of_iron.cpp
index e7db34d4ca1..c9cbabd0586 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_assembly_of_iron.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_assembly_of_iron.cpp
@@ -23,9 +23,12 @@ SDCategory: Ulduar - Ulduar
EndScriptData */
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
+#include "SpellAuras.h"
#include "SpellScript.h"
-#include "SpellAuraEffects.h"
+#include "TemporarySummon.h"
#include "ulduar.h"
enum AssemblySpells
@@ -725,9 +728,7 @@ class spell_assembly_rune_of_summoning : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_RUNE_OF_SUMMONING_SUMMON))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_RUNE_OF_SUMMONING_SUMMON });
}
void HandlePeriodic(AuraEffect const* aurEff)
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp
index 472a7080d5f..0114e7cf277 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp
@@ -16,6 +16,8 @@
*/
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
#include "ulduar.h"
@@ -324,7 +326,7 @@ class npc_auriaya_seeping_trigger : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_auriaya_seeping_triggerAI>(creature);
+ return GetUlduarAI<npc_auriaya_seeping_triggerAI>(creature);
}
};
@@ -402,7 +404,7 @@ class npc_sanctum_sentry : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_sanctum_sentryAI>(creature);
+ return GetUlduarAI<npc_sanctum_sentryAI>(creature);
}
};
@@ -481,7 +483,7 @@ class npc_feral_defender : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_feral_defenderAI>(creature);
+ return GetUlduarAI<npc_feral_defenderAI>(creature);
}
};
@@ -534,7 +536,10 @@ class spell_auriaya_sentinel_blast : public SpellScriptLoader
void FilterTargets(std::list<WorldObject*>& unitList)
{
- unitList.remove_if(PlayerOrPetCheck());
+ unitList.remove_if([](WorldObject* target)
+ {
+ return target->GetTypeId() != TYPEID_PLAYER && (target->GetTypeId() != TYPEID_UNIT || !target->ToUnit()->IsPet());
+ });
}
void Register() override
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp
index ab9b636f153..b0af1c7ac11 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp
@@ -23,22 +23,21 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
-#include "ScriptedEscortAI.h"
-#include "Cell.h"
#include "CellImpl.h"
-#include "GridNotifiers.h"
-#include "GridNotifiersImpl.h"
#include "CombatAI.h"
+#include "GameObject.h"
+#include "GridNotifiersImpl.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
#include "PassiveAI.h"
-#include "ObjectMgr.h"
+#include "Player.h"
+#include "ScriptedEscortAI.h"
+#include "ScriptedGossip.h"
+#include "Spell.h"
#include "SpellInfo.h"
#include "SpellScript.h"
-#include "Vehicle.h"
-#include "VehicleDefines.h"
#include "ulduar.h"
-#include "Spell.h"
+#include "Vehicle.h"
enum Spells
{
@@ -636,7 +635,7 @@ class boss_flame_leviathan_seat : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_flame_leviathan_seatAI>(creature);
+ return GetUlduarAI<boss_flame_leviathan_seatAI>(creature);
}
};
@@ -692,7 +691,7 @@ class boss_flame_leviathan_defense_cannon : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_flame_leviathan_defense_cannonAI(creature);
+ return GetUlduarAI<boss_flame_leviathan_defense_cannonAI>(creature);
}
};
@@ -721,7 +720,7 @@ class boss_flame_leviathan_defense_turret : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_flame_leviathan_defense_turretAI(creature);
+ return GetUlduarAI<boss_flame_leviathan_defense_turretAI>(creature);
}
};
@@ -758,7 +757,7 @@ class boss_flame_leviathan_overload_device : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_flame_leviathan_overload_deviceAI(creature);
+ return GetUlduarAI<boss_flame_leviathan_overload_deviceAI>(creature);
}
};
@@ -789,7 +788,7 @@ class boss_flame_leviathan_safety_container : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_flame_leviathan_safety_containerAI(creature);
+ return GetUlduarAI<boss_flame_leviathan_safety_containerAI>(creature);
}
};
@@ -858,7 +857,7 @@ class npc_mechanolift : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_mechanoliftAI(creature);
+ return GetUlduarAI<npc_mechanoliftAI>(creature);
}
};
@@ -892,7 +891,7 @@ class npc_pool_of_tar : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_pool_of_tarAI(creature);
+ return GetUlduarAI<npc_pool_of_tarAI>(creature);
}
};
@@ -927,7 +926,7 @@ class npc_colossus : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_colossusAI>(creature);
+ return GetUlduarAI<npc_colossusAI>(creature);
}
};
@@ -965,7 +964,7 @@ class npc_thorims_hammer : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_thorims_hammerAI(creature);
+ return GetUlduarAI<npc_thorims_hammerAI>(creature);
}
};
@@ -976,7 +975,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_mimirons_infernoAI(creature);
+ return GetUlduarAI<npc_mimirons_infernoAI>(creature);
}
struct npc_mimirons_infernoAI : public npc_escortAI
@@ -1067,7 +1066,7 @@ class npc_hodirs_fury : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_hodirs_furyAI(creature);
+ return GetUlduarAI<npc_hodirs_furyAI>(creature);
}
};
@@ -1116,7 +1115,7 @@ class npc_freyas_ward : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_freyas_wardAI(creature);
+ return GetUlduarAI<npc_freyas_wardAI>(creature);
}
};
@@ -1164,7 +1163,7 @@ class npc_freya_ward_summon : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_freya_ward_summonAI(creature);
+ return GetUlduarAI<npc_freya_ward_summonAI>(creature);
}
};
@@ -1191,7 +1190,7 @@ class npc_brann_bronzebeard_ulduar_intro : public CreatureScript
if (menuId == GOSSIP_MENU_BRANN_BRONZEBEARD && gossipListId == GOSSIP_OPTION_BRANN_BRONZEBEARD)
{
me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
- player->PlayerTalkClass->SendCloseGossip();
+ CloseGossipMenuFor(player);
if (Creature* loreKeeper = _instance->GetCreature(DATA_LORE_KEEPER_OF_NORGANNON))
loreKeeper->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
}
@@ -1244,10 +1243,10 @@ class npc_lorekeeper : public CreatureScript
if (menuId == GOSSIP_MENU_LORE_KEEPER && gossipListId == GOSSIP_OPTION_LORE_KEEPER)
{
me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
- player->PlayerTalkClass->SendCloseGossip();
- _instance->instance->LoadGrid(364, -16); // make sure leviathan is loaded
+ CloseGossipMenuFor(player);
+ me->GetMap()->LoadGrid(364, -16); // make sure leviathan is loaded
- if (Creature* leviathan = _instance->instance->GetCreature(_instance->GetGuidData(BOSS_LEVIATHAN)))
+ if (Creature* leviathan = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(BOSS_LEVIATHAN)))
{
leviathan->AI()->DoAction(ACTION_START_HARD_MODE);
me->SetVisible(false);
@@ -1271,7 +1270,7 @@ class npc_lorekeeper : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_lorekeeperAI(creature);
+ return GetUlduarAI<npc_lorekeeperAI>(creature);
}
};
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp
index 0afc8a8a8d8..e40e584c647 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp
@@ -16,12 +16,16 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "SpellScript.h"
-#include "Cell.h"
#include "CellImpl.h"
-#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
+#include "ScriptedCreature.h"
+#include "SpellAuras.h"
+#include "SpellInfo.h"
+#include "SpellScript.h"
+#include "TemporarySummon.h"
#include "ulduar.h"
enum FreyaYells
@@ -253,7 +257,7 @@ class npc_iron_roots : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_iron_rootsAI(creature);
+ return GetUlduarAI<npc_iron_rootsAI>(creature);
}
};
@@ -1042,7 +1046,7 @@ class npc_detonating_lasher : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_detonating_lasherAI(creature);
+ return GetUlduarAI<npc_detonating_lasherAI>(creature);
}
};
@@ -1110,7 +1114,7 @@ class npc_ancient_water_spirit : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_ancient_water_spiritAI>(creature);
+ return GetUlduarAI<npc_ancient_water_spiritAI>(creature);
}
};
@@ -1185,7 +1189,7 @@ class npc_storm_lasher : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_storm_lasherAI>(creature);
+ return GetUlduarAI<npc_storm_lasherAI>(creature);
}
};
@@ -1232,7 +1236,7 @@ class npc_snaplasher : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_snaplasherAI>(creature);
+ return GetUlduarAI<npc_snaplasherAI>(creature);
}
};
@@ -1309,7 +1313,7 @@ class npc_ancient_conservator : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_ancient_conservatorAI(creature);
+ return GetUlduarAI<npc_ancient_conservatorAI>(creature);
}
};
@@ -1331,7 +1335,7 @@ class npc_sun_beam : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_sun_beamAI(creature);
+ return GetUlduarAI<npc_sun_beamAI>(creature);
}
};
@@ -1371,7 +1375,7 @@ class npc_healthy_spore : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_healthy_sporeAI(creature);
+ return GetUlduarAI<npc_healthy_sporeAI>(creature);
}
};
@@ -1411,7 +1415,7 @@ class npc_eonars_gift : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_eonars_giftAI(creature);
+ return GetUlduarAI<npc_eonars_giftAI>(creature);
}
};
@@ -1453,7 +1457,7 @@ class npc_nature_bomb : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_nature_bombAI(creature);
+ return GetUlduarAI<npc_nature_bombAI>(creature);
}
};
@@ -1502,7 +1506,7 @@ class npc_unstable_sun_beam : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_unstable_sun_beamAI>(creature);
+ return GetUlduarAI<npc_unstable_sun_beamAI>(creature);
}
};
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp
index 76bd8b939ff..e4dd5f41225 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp
@@ -16,11 +16,15 @@
*/
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptedCreature.h"
-#include "SpellScript.h"
#include "SpellAuraEffects.h"
+#include "SpellInfo.h"
+#include "SpellScript.h"
#include "ulduar.h"
-#include "Player.h"
enum VezaxYells
{
@@ -371,7 +375,7 @@ class boss_saronite_animus : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_saronite_animusAI>(creature);
+ return GetUlduarAI<boss_saronite_animusAI>(creature);
}
};
@@ -441,7 +445,7 @@ class npc_saronite_vapors : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_saronite_vaporsAI>(creature);
+ return GetUlduarAI<npc_saronite_vaporsAI>(creature);
}
};
@@ -456,9 +460,7 @@ class spell_general_vezax_mark_of_the_faceless : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_MARK_OF_THE_FACELESS_DAMAGE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_MARK_OF_THE_FACELESS_DAMAGE });
}
void HandleEffectPeriodic(AuraEffect const* aurEff)
@@ -519,9 +521,7 @@ class spell_general_vezax_saronite_vapors : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SARONITE_VAPORS_ENERGIZE) || !sSpellMgr->GetSpellInfo(SPELL_SARONITE_VAPORS_DAMAGE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SARONITE_VAPORS_ENERGIZE, SPELL_SARONITE_VAPORS_DAMAGE });
}
void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp
index 9e495bd6d08..4fcb536d544 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp
@@ -16,13 +16,15 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "SpellScript.h"
-#include "SpellAuraEffects.h"
-#include "Cell.h"
#include "CellImpl.h"
-#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
+#include "SpellAuras.h"
+#include "SpellInfo.h"
+#include "SpellScript.h"
+#include "TemporarySummon.h"
#include "ulduar.h"
/* @todo Achievements
@@ -247,7 +249,7 @@ class npc_flash_freeze : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_flash_freezeAI>(creature);
+ return GetUlduarAI<npc_flash_freezeAI>(creature);
}
};
@@ -310,7 +312,7 @@ class npc_ice_block : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_ice_blockAI>(creature);
+ return GetUlduarAI<npc_ice_blockAI>(creature);
}
};
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp
index 8ddbd6a7425..11b54be8d46 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp
@@ -16,11 +16,14 @@
*/
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
+#include "SpellAuras.h"
#include "SpellScript.h"
-#include "SpellAuraEffects.h"
#include "ulduar.h"
#include "Vehicle.h"
+#include "World.h"
enum Yells
{
@@ -453,10 +456,7 @@ class spell_ignis_slag_pot : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SLAG_POT_DAMAGE)
- || !sSpellMgr->GetSpellInfo(SPELL_SLAG_IMBUED))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SLAG_POT_DAMAGE, SPELL_SLAG_IMBUED });
}
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp
index d562df2cfd3..eddbae6041a 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp
@@ -16,12 +16,16 @@
*/
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
-#include "SpellScript.h"
#include "SpellAuraEffects.h"
+#include "SpellAuras.h"
+#include "SpellInfo.h"
+#include "SpellScript.h"
#include "ulduar.h"
#include "Vehicle.h"
-#include "Player.h"
/* ScriptData
SDName: boss_kologarn
@@ -489,7 +493,7 @@ class spell_ulduar_squeezed_lifeless : public SpellScriptLoader
void HandleInstaKill(SpellEffIndex /*effIndex*/)
{
- if (!GetHitPlayer() || !GetHitPlayer()->GetVehicle())
+ if (GetHitUnit()->GetTypeId() != TYPEID_PLAYER || !GetHitUnit()->GetVehicle())
return;
//! Proper exit position does not work currently,
@@ -499,9 +503,9 @@ class spell_ulduar_squeezed_lifeless : public SpellScriptLoader
pos.m_positionY = -8.3f + irand(-3, 3);
pos.m_positionZ = 448.8f;
pos.SetOrientation(float(M_PI));
- GetHitPlayer()->DestroyForNearbyPlayers();
- GetHitPlayer()->ExitVehicle(&pos);
- GetHitPlayer()->UpdateObjectVisibility(false);
+ GetHitUnit()->DestroyForNearbyPlayers();
+ GetHitUnit()->ExitVehicle(&pos);
+ GetHitUnit()->UpdateObjectVisibility(false);
}
void Register() override
@@ -532,7 +536,7 @@ class spell_ulduar_stone_grip_absorb : public SpellScriptLoader
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_ENEMY_SPELL)
return;
- if (!GetOwner()->ToCreature())
+ if (GetOwner()->GetTypeId() != TYPEID_UNIT)
return;
uint32 rubbleStalkerEntry = (GetOwner()->GetMap()->GetDifficultyID() == DIFFICULTY_NORMAL ? 33809 : 33942);
@@ -564,8 +568,7 @@ class spell_ulduar_stone_grip : public SpellScriptLoader
void OnRemoveStun(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
- if (Player* owner = GetOwner()->ToPlayer())
- owner->RemoveAurasDueToSpell(aurEff->GetAmount());
+ GetUnitOwner()->RemoveAurasDueToSpell(aurEff->GetAmount());
}
void OnRemoveVehicle(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -617,7 +620,10 @@ class spell_kologarn_stone_shout : public SpellScriptLoader
void FilterTargets(std::list<WorldObject*>& unitList)
{
- unitList.remove_if(PlayerOrPetCheck());
+ unitList.remove_if([](WorldObject* target)
+ {
+ return target->GetTypeId() != TYPEID_PLAYER && (target->GetTypeId() != TYPEID_UNIT || !target->ToUnit()->IsPet());
+ });
}
void Register() override
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp
index b15c3a66fd0..0c13e519be0 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp
@@ -15,14 +15,15 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "Cell.h"
-#include "CellImpl.h"
-#include "GridNotifiers.h"
-#include "GridNotifiersImpl.h"
#include "ScriptMgr.h"
+#include "GameObject.h"
+#include "GridNotifiers.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
-#include "SpellScript.h"
#include "SpellAuraEffects.h"
+#include "SpellScript.h"
+#include "TemporarySummon.h"
#include "ulduar.h"
#include "Vehicle.h"
@@ -644,10 +645,10 @@ class boss_mimiron : public CreatureScript
{
if (Creature* computer = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_COMPUTER)))
computer->AI()->DoAction(DO_DEACTIVATE_COMPUTER);
- me->SummonGameObject(RAID_MODE(GO_CACHE_OF_INNOVATION_FIREFIGHTER, GO_CACHE_OF_INNOVATION_FIREFIGHTER_HERO), 2744.040f, 2569.352f, 364.3135f, 3.124123f, G3D::Quat(0.f, 0.f, 0.9999619f, 0.008734641f), 604800);
+ me->SummonGameObject(RAID_MODE(GO_CACHE_OF_INNOVATION_FIREFIGHTER, GO_CACHE_OF_INNOVATION_FIREFIGHTER_HERO), 2744.040f, 2569.352f, 364.3135f, 3.124123f, QuaternionData(0.f, 0.f, 0.9999619f, 0.008734641f), 604800);
}
else
- me->SummonGameObject(RAID_MODE(GO_CACHE_OF_INNOVATION, GO_CACHE_OF_INNOVATION_HERO), 2744.040f, 2569.352f, 364.3135f, 3.124123f, G3D::Quat(0.f, 0.f, 0.9999619f, 0.008734641f), 604800);
+ me->SummonGameObject(RAID_MODE(GO_CACHE_OF_INNOVATION, GO_CACHE_OF_INNOVATION_HERO), 2744.040f, 2569.352f, 364.3135f, 3.124123f, QuaternionData(0.f, 0.f, 0.9999619f, 0.008734641f), 604800);
events.ScheduleEvent(EVENT_OUTTRO_3, 11000);
break;
case EVENT_OUTTRO_3:
@@ -1779,9 +1780,7 @@ class spell_mimiron_fire_search : public SpellScriptLoader
private:
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_WATER_SPRAY))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_WATER_SPRAY });
}
void FilterTargets(std::list<WorldObject*>& targets)
@@ -1870,9 +1869,7 @@ class spell_mimiron_magnetic_core : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_MAGNETIC_CORE_VISUAL))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_MAGNETIC_CORE_VISUAL });
}
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -1925,9 +1922,7 @@ class spell_mimiron_napalm_shell : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_NAPALM_SHELL))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_NAPALM_SHELL });
}
void FilterTargets(std::list<WorldObject*>& targets)
@@ -1976,9 +1971,7 @@ class spell_mimiron_plasma_blast : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PLASMA_BLAST))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_PLASMA_BLAST });
}
bool Load() override
@@ -2052,9 +2045,7 @@ class spell_mimiron_proximity_mines : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_PROXIMITY_MINE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SUMMON_PROXIMITY_MINE });
}
void HandleScript(SpellEffIndex /*effIndex*/)
@@ -2087,9 +2078,7 @@ class spell_mimiron_proximity_trigger : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PROXIMITY_MINE_EXPLOSION))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_PROXIMITY_MINE_EXPLOSION });
}
void FilterTargets(std::list<WorldObject*>& targets)
@@ -2130,9 +2119,7 @@ class spell_mimiron_rapid_burst : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_RAPID_BURST_LEFT) || !sSpellMgr->GetSpellInfo(SPELL_RAPID_BURST_RIGHT))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_RAPID_BURST_LEFT, SPELL_RAPID_BURST_RIGHT });
}
void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -2172,9 +2159,7 @@ class spell_mimiron_rocket_strike : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SCRIPT_EFFECT_ROCKET_STRIKE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SCRIPT_EFFECT_ROCKET_STRIKE });
}
void FilterTargets(std::list<WorldObject*>& targets)
@@ -2182,12 +2167,14 @@ class spell_mimiron_rocket_strike : public SpellScriptLoader
if (targets.empty())
return;
- if (m_scriptSpellId == SPELL_ROCKET_STRIKE_SINGLE && GetCaster()->IsVehicle())
+ if (GetSpellInfo()->Id == SPELL_ROCKET_STRIKE_SINGLE && GetCaster()->IsVehicle())
+ {
if (WorldObject* target = GetCaster()->GetVehicleKit()->GetPassenger(RAND(ROCKET_SEAT_LEFT, ROCKET_SEAT_RIGHT)))
{
targets.clear();
targets.push_back(target);
}
+ }
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -2220,9 +2207,7 @@ class spell_mimiron_rocket_strike_damage : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_NOT_SO_FRIENDLY_FIRE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_NOT_SO_FRIENDLY_FIRE });
}
void HandleAfterCast()
@@ -2270,9 +2255,7 @@ class spell_mimiron_rocket_strike_target_select : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_ROCKET_STRIKE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SUMMON_ROCKET_STRIKE });
}
void FilterTargets(std::list<WorldObject*>& targets)
@@ -2351,9 +2334,7 @@ class spell_mimiron_summon_assault_bot : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_ASSAULT_BOT))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SUMMON_ASSAULT_BOT });
}
void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
@@ -2388,9 +2369,7 @@ class spell_mimiron_summon_assault_bot_target : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_ASSAULT_BOT_DUMMY))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SUMMON_ASSAULT_BOT_DUMMY });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -2422,10 +2401,7 @@ class spell_mimiron_summon_fire_bot : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_FIRE_BOT))
- return false;
-
- return true;
+ return ValidateSpellInfo({ SPELL_SUMMON_FIRE_BOT });
}
void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
@@ -2460,9 +2436,7 @@ class spell_mimiron_summon_fire_bot_target : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_FIRE_BOT_DUMMY))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SUMMON_FIRE_BOT_DUMMY });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -2531,9 +2505,7 @@ class spell_mimiron_summon_flames_spread : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_FLAMES_SPREAD))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SUMMON_FLAMES_SPREAD });
}
void HandleTick(AuraEffect const* /*aurEff*/)
@@ -2568,9 +2540,7 @@ class spell_mimiron_summon_frost_bomb_target : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_FROST_BOMB))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SUMMON_FROST_BOMB });
}
void FilterTargets(std::list<WorldObject*>& targets)
@@ -2619,9 +2589,7 @@ class spell_mimiron_summon_junk_bot : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_JUNK_BOT))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SUMMON_JUNK_BOT });
}
void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
@@ -2656,9 +2624,7 @@ class spell_mimiron_summon_junk_bot_target : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_JUNK_BOT_DUMMY))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SUMMON_JUNK_BOT_DUMMY });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp
index b07e29e70ec..1a1dc732a59 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp
@@ -18,12 +18,15 @@
/// @todo Harpoon chain from 62505 should not get removed when other chain is applied
#include "ScriptMgr.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
+#include "SpellInfo.h"
#include "SpellScript.h"
+#include "TemporarySummon.h"
#include "ulduar.h"
-#include "SpellInfo.h"
-#include "Player.h"
enum Says
{
@@ -237,12 +240,12 @@ class boss_razorscale_controller : public CreatureScript
{
case ACTION_HARPOON_BUILD:
events.ScheduleEvent(EVENT_BUILD_HARPOON_1, 50000);
- if (me->GetMap()->GetSpawnMode() == DIFFICULTY_25_N)
+ if (Is25ManRaid())
events.ScheduleEvent(EVENT_BUILD_HARPOON_3, 90000);
break;
case ACTION_PLACE_BROKEN_HARPOON:
for (uint8 n = 0; n < RAID_MODE(2, 4); n++)
- me->SummonGameObject(GO_RAZOR_BROKEN_HARPOON, PosHarpoon[n].GetPositionX(), PosHarpoon[n].GetPositionY(), PosHarpoon[n].GetPositionZ(), 2.286f, G3D::Quat(), 180);
+ me->SummonGameObject(GO_RAZOR_BROKEN_HARPOON, PosHarpoon[n].GetPositionX(), PosHarpoon[n].GetPositionY(), PosHarpoon[n].GetPositionZ(), 2.286f, QuaternionData(), 180);
break;
}
}
@@ -257,7 +260,7 @@ class boss_razorscale_controller : public CreatureScript
{
case EVENT_BUILD_HARPOON_1:
Talk(EMOTE_HARPOON);
- if (GameObject* Harpoon = me->SummonGameObject(GO_RAZOR_HARPOON_1, PosHarpoon[0].GetPositionX(), PosHarpoon[0].GetPositionY(), PosHarpoon[0].GetPositionZ(), 4.790f, G3D::Quat(), uint32(me->GetRespawnTime())))
+ if (GameObject* Harpoon = me->SummonGameObject(GO_RAZOR_HARPOON_1, PosHarpoon[0].GetPositionX(), PosHarpoon[0].GetPositionY(), PosHarpoon[0].GetPositionZ(), 4.790f, QuaternionData(), uint32(me->GetRespawnTime())))
{
if (GameObject* BrokenHarpoon = Harpoon->FindNearestGameObject(GO_RAZOR_BROKEN_HARPOON, 5.0f)) //only nearest broken harpoon
BrokenHarpoon->RemoveFromWorld();
@@ -267,7 +270,7 @@ class boss_razorscale_controller : public CreatureScript
return;
case EVENT_BUILD_HARPOON_2:
Talk(EMOTE_HARPOON);
- if (GameObject* Harpoon = me->SummonGameObject(GO_RAZOR_HARPOON_2, PosHarpoon[1].GetPositionX(), PosHarpoon[1].GetPositionY(), PosHarpoon[1].GetPositionZ(), 4.659f, G3D::Quat(), uint32(me->GetRespawnTime())))
+ if (GameObject* Harpoon = me->SummonGameObject(GO_RAZOR_HARPOON_2, PosHarpoon[1].GetPositionX(), PosHarpoon[1].GetPositionY(), PosHarpoon[1].GetPositionZ(), 4.659f, QuaternionData(), uint32(me->GetRespawnTime())))
{
if (GameObject* BrokenHarpoon = Harpoon->FindNearestGameObject(GO_RAZOR_BROKEN_HARPOON, 5.0f))
BrokenHarpoon->RemoveFromWorld();
@@ -276,7 +279,7 @@ class boss_razorscale_controller : public CreatureScript
return;
case EVENT_BUILD_HARPOON_3:
Talk(EMOTE_HARPOON);
- if (GameObject* Harpoon = me->SummonGameObject(GO_RAZOR_HARPOON_3, PosHarpoon[2].GetPositionX(), PosHarpoon[2].GetPositionY(), PosHarpoon[2].GetPositionZ(), 5.382f, G3D::Quat(), uint32(me->GetRespawnTime())))
+ if (GameObject* Harpoon = me->SummonGameObject(GO_RAZOR_HARPOON_3, PosHarpoon[2].GetPositionX(), PosHarpoon[2].GetPositionY(), PosHarpoon[2].GetPositionZ(), 5.382f, QuaternionData(), uint32(me->GetRespawnTime())))
{
if (GameObject* BrokenHarpoon = Harpoon->FindNearestGameObject(GO_RAZOR_BROKEN_HARPOON, 5.0f))
BrokenHarpoon->RemoveFromWorld();
@@ -286,7 +289,7 @@ class boss_razorscale_controller : public CreatureScript
return;
case EVENT_BUILD_HARPOON_4:
Talk(EMOTE_HARPOON);
- if (GameObject* Harpoon = me->SummonGameObject(GO_RAZOR_HARPOON_4, PosHarpoon[3].GetPositionX(), PosHarpoon[3].GetPositionY(), PosHarpoon[3].GetPositionZ(), 4.266f, G3D::Quat(), uint32(me->GetRespawnTime())))
+ if (GameObject* Harpoon = me->SummonGameObject(GO_RAZOR_HARPOON_4, PosHarpoon[3].GetPositionX(), PosHarpoon[3].GetPositionY(), PosHarpoon[3].GetPositionZ(), 4.266f, QuaternionData(), uint32(me->GetRespawnTime())))
{
if (GameObject* BrokenHarpoon = Harpoon->FindNearestGameObject(GO_RAZOR_BROKEN_HARPOON, 5.0f))
BrokenHarpoon->RemoveFromWorld();
@@ -300,7 +303,7 @@ class boss_razorscale_controller : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_razorscale_controllerAI>(creature);
+ return GetUlduarAI<boss_razorscale_controllerAI>(creature);
}
};
@@ -747,8 +750,6 @@ class npc_expedition_commander : public CreatureScript
InstanceScript* instance = creature->GetInstanceScript();
if (instance && instance->GetBossState(BOSS_RAZORSCALE) == NOT_STARTED)
{
- player->PrepareGossipMenu(creature);
-
AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_ITEM_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
SendGossipMenuFor(player, 13853, creature->GetGUID());
}
@@ -760,7 +761,7 @@ class npc_expedition_commander : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_expedition_commanderAI>(creature);
+ return GetUlduarAI<npc_expedition_commanderAI>(creature);
}
};
@@ -846,7 +847,7 @@ class npc_mole_machine_trigger : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_mole_machine_triggerAI(creature);
+ return GetUlduarAI<npc_mole_machine_triggerAI>(creature);
}
};
@@ -871,7 +872,7 @@ class npc_devouring_flame : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_devouring_flameAI(creature);
+ return GetUlduarAI<npc_devouring_flameAI>(creature);
}
};
@@ -928,7 +929,7 @@ class npc_darkrune_watcher : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_darkrune_watcherAI(creature);
+ return GetUlduarAI<npc_darkrune_watcherAI>(creature);
}
};
@@ -991,7 +992,7 @@ class npc_darkrune_guardian : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_darkrune_guardianAI(creature);
+ return GetUlduarAI<npc_darkrune_guardianAI>(creature);
}
};
@@ -1058,7 +1059,7 @@ class npc_darkrune_sentinel : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_darkrune_sentinelAI(creature);
+ return GetUlduarAI<npc_darkrune_sentinelAI>(creature);
}
};
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp
index 782bbe1073c..6e845a35faf 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp
@@ -22,15 +22,16 @@
*/
#include "ScriptMgr.h"
+#include "CombatLogPackets.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
+#include "PassiveAI.h"
#include "ScriptedCreature.h"
-#include "SpellScript.h"
+#include "Spell.h"
#include "SpellAuraEffects.h"
+#include "SpellScript.h"
#include "ulduar.h"
#include "Vehicle.h"
-#include "Player.h"
-#include "WorldPacket.h"
-#include "Opcodes.h"
-#include "PassiveAI.h"
enum Spells
{
@@ -472,7 +473,7 @@ class npc_xt002_heart : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_xt002_heartAI>(creature);
+ return GetUlduarAI<npc_xt002_heartAI>(creature);
}
};
@@ -488,7 +489,7 @@ class npc_scrapbot : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_scrapbotAI>(creature);
+ return GetUlduarAI<npc_scrapbotAI>(creature);
}
struct npc_scrapbotAI : public ScriptedAI
@@ -551,7 +552,7 @@ class npc_pummeller : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_pummellerAI>(creature);
+ return GetUlduarAI<npc_pummellerAI>(creature);
}
struct npc_pummellerAI : public ScriptedAI
@@ -658,7 +659,7 @@ class npc_boombot : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_boombotAI>(creature);
+ return GetUlduarAI<npc_boombotAI>(creature);
}
struct npc_boombotAI : public ScriptedAI
@@ -697,11 +698,11 @@ class npc_boombot : public CreatureScript
{
_boomed = true; // Prevent recursive calls
- WorldPacket data(SMSG_SPELL_INSTAKILL_LOG, 8+8+4);
- data << me->GetGUID();
- data << me->GetGUID();
- data << uint32(SPELL_BOOM);
- me->SendMessageToSet(&data, false);
+ WorldPackets::CombatLog::SpellInstakillLog instakill;
+ instakill.Caster = me->GetGUID();
+ instakill.Target = me->GetGUID();
+ instakill.SpellID = SPELL_BOOM;
+ me->SendMessageToSet(instakill.Write(), false);
me->DealDamage(me, me->GetHealth(), nullptr, NODAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
@@ -738,7 +739,7 @@ class npc_life_spark : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_life_sparkAI(creature);
+ return GetUlduarAI<npc_life_sparkAI>(creature);
}
struct npc_life_sparkAI : public ScriptedAI
@@ -809,7 +810,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_xt_void_zoneAI(creature);
+ return GetUlduarAI<npc_xt_void_zoneAI>(creature);
}
};
@@ -825,17 +826,15 @@ class spell_xt002_searing_light_spawn_life_spark : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_LIFE_SPARK))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SUMMON_LIFE_SPARK });
}
void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
- if (Player* player = GetOwner()->ToPlayer())
+ if (GetOwner()->GetTypeId() == TYPEID_PLAYER)
if (Unit* xt002 = GetCaster())
if (xt002->HasAura(aurEff->GetAmount())) // Heartbreak aura indicating hard mode
- xt002->CastSpell(player, SPELL_SUMMON_LIFE_SPARK, true);
+ xt002->CastSpell(GetUnitOwner(), SPELL_SUMMON_LIFE_SPARK, true);
}
void Register() override
@@ -861,17 +860,15 @@ class spell_xt002_gravity_bomb_aura : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_VOID_ZONE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SUMMON_VOID_ZONE });
}
void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
- if (Player* player = GetOwner()->ToPlayer())
+ if (GetOwner()->GetTypeId() == TYPEID_PLAYER)
if (Unit* xt002 = GetCaster())
if (xt002->HasAura(aurEff->GetAmount())) // Heartbreak aura indicating hard mode
- xt002->CastSpell(player, SPELL_SUMMON_VOID_ZONE, true);
+ xt002->CastSpell(GetUnitOwner(), SPELL_SUMMON_VOID_ZONE, true);
}
void OnPeriodic(AuraEffect const* aurEff)
@@ -945,19 +942,13 @@ class spell_xt002_heart_overload_periodic : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_ENERGY_ORB))
- return false;
-
- if (!sSpellMgr->GetSpellInfo(SPELL_RECHARGE_BOOMBOT))
- return false;
-
- if (!sSpellMgr->GetSpellInfo(SPELL_RECHARGE_PUMMELER))
- return false;
-
- if (!sSpellMgr->GetSpellInfo(SPELL_RECHARGE_SCRAPBOT))
- return false;
-
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_ENERGY_ORB,
+ SPELL_RECHARGE_BOOMBOT,
+ SPELL_RECHARGE_PUMMELER,
+ SPELL_RECHARGE_SCRAPBOT
+ });
}
void HandleScript(SpellEffIndex /*effIndex*/)
@@ -1012,7 +1003,10 @@ class spell_xt002_tympanic_tantrum : public SpellScriptLoader
void FilterTargets(std::list<WorldObject*>& targets)
{
- targets.remove_if(PlayerOrPetCheck());
+ targets.remove_if([](WorldObject* target)
+ {
+ return target->GetTypeId() != TYPEID_PLAYER && (target->GetTypeId() != TYPEID_UNIT || !target->ToUnit()->IsPet());
+ });
}
void RecalculateDamage()
@@ -1076,9 +1070,7 @@ class spell_xt002_321_boombot_aura : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_ACHIEVEMENT_CREDIT_NERF_SCRAPBOTS))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_ACHIEVEMENT_CREDIT_NERF_SCRAPBOTS });
}
bool CheckProc(ProcEventInfo& eventInfo)
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp
index 56719833e03..fccfe5ff56b 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp
@@ -16,12 +16,20 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "CreatureTextMgr.h"
+#include "GridNotifiers.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "ObjectAccessor.h"
#include "PassiveAI.h"
-#include "SpellScript.h"
+#include "Player.h"
+#include "ScriptedCreature.h"
+#include "Spell.h"
#include "SpellAuraEffects.h"
-#include "MoveSplineInit.h"
-#include "CreatureTextMgr.h"
+#include "SpellAuras.h"
+#include "SpellInfo.h"
+#include "SpellScript.h"
+#include "TemporarySummon.h"
#include "ulduar.h"
enum Yells
@@ -2060,9 +2068,7 @@ class spell_yogg_saron_malady_of_the_mind : public SpellScriptLoader // 63830
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_MALADY_OF_THE_MIND_JUMP))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_MALADY_OF_THE_MIND_JUMP });
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -2132,11 +2138,7 @@ class spell_yogg_saron_brain_link : public SpellScriptLoader // 63802
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_BRAIN_LINK_DAMAGE))
- return false;
- if (!sSpellMgr->GetSpellInfo(SPELL_BRAIN_LINK_NO_DAMAGE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_BRAIN_LINK_DAMAGE, SPELL_BRAIN_LINK_NO_DAMAGE });
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -2230,9 +2232,7 @@ class spell_yogg_saron_boil_ominously : public SpellScriptLoader // 63030
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_GUARDIAN_1))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SUMMON_GUARDIAN_1 });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -2331,9 +2331,7 @@ class spell_yogg_saron_empowering_shadows_missile : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_EMPOWERING_SHADOWS))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_EMPOWERING_SHADOWS });
}
void HandleScript(SpellEffIndex /*effIndex*/)
@@ -2366,9 +2364,7 @@ class spell_yogg_saron_constrictor_tentacle : public SpellScriptLoader // 64
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_CONSTRICTOR_TENTACLE_SUMMON))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_CONSTRICTOR_TENTACLE_SUMMON });
}
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -2399,9 +2395,7 @@ class spell_yogg_saron_lunge : public SpellScriptLoader // 64131
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SQUEEZE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SQUEEZE });
}
void HandleScript(SpellEffIndex /*effIndex*/)
@@ -2494,11 +2488,7 @@ class spell_yogg_saron_empowered : public SpellScriptLoader // 64161
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_EMPOWERED_BUFF))
- return false;
- if (!sSpellMgr->GetSpellInfo(SPELL_WEAKENED))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_EMPOWERED_BUFF, SPELL_WEAKENED });
}
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -2599,11 +2589,7 @@ class spell_yogg_saron_death_ray_warning_visual : public SpellScriptLoader /
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DEATH_RAY_PERIODIC))
- return false;
- if (!sSpellMgr->GetSpellInfo(SPELL_DEATH_RAY_DAMAGE_VISUAL))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DEATH_RAY_PERIODIC, SPELL_DEATH_RAY_DAMAGE_VISUAL });
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -2640,9 +2626,7 @@ class spell_yogg_saron_cancel_illusion_room_aura : public SpellScriptLoader /
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_TELEPORT_BACK_TO_MAIN_ROOM))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_TELEPORT_BACK_TO_MAIN_ROOM });
}
void HandleScript(SpellEffIndex /*effIndex*/)
@@ -2703,11 +2687,7 @@ class spell_yogg_saron_revealed_tentacle : public SpellScriptLoader // 64012
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_TENTACLE_VOID_ZONE))
- return false;
- if (!sSpellMgr->GetSpellInfo(SPELL_GRIM_REPRISAL))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_TENTACLE_VOID_ZONE, SPELL_GRIM_REPRISAL });
}
void HandleScript(SpellEffIndex /*effIndex*/)
@@ -2743,9 +2723,7 @@ class spell_yogg_saron_grim_reprisal : public SpellScriptLoader // 63305
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_GRIM_REPRISAL_DAMAGE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_GRIM_REPRISAL_DAMAGE });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -2778,11 +2756,7 @@ class spell_yogg_saron_induce_madness : public SpellScriptLoader // 64059
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_TELEPORT_BACK_TO_MAIN_ROOM))
- return false;
- if (!sSpellMgr->GetSpellInfo(SPELL_SHATTERED_ILLUSION_REMOVE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_TELEPORT_BACK_TO_MAIN_ROOM, SPELL_SHATTERED_ILLUSION_REMOVE });
}
void HandleScript(SpellEffIndex /*effIndex*/)
@@ -2845,11 +2819,7 @@ class spell_yogg_saron_sanity : public SpellScriptLoader // 63050
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_LOW_SANITY_SCREEN_EFFECT))
- return false;
- if (!sSpellMgr->GetSpellInfo(SPELL_INSANE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_LOW_SANITY_SCREEN_EFFECT, SPELL_INSANE, SPELL_SANITY_WELL, SPELL_BRAIN_LINK });
}
void DummyTick(AuraEffect const* /*aurEff*/)
@@ -2904,9 +2874,7 @@ class spell_yogg_saron_insane : public SpellScriptLoader // 63120
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_INSANE_VISUAL))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_INSANE_VISUAL });
}
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -3142,9 +3110,7 @@ class spell_yogg_saron_hodirs_protective_gaze : public SpellScriptLoader //
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_FLASH_FREEZE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_FLASH_FREEZE });
}
bool CanApply(Unit* target)
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h
index 55df3aa86ce..f320682f1f1 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h
@@ -18,6 +18,10 @@
#ifndef DEF_ULDUAR_H
#define DEF_ULDUAR_H
+#include "CreatureAIImpl.h"
+
+struct Position;
+
#define UlduarScriptName "instance_ulduar"
#define DataHeader "UU"
@@ -441,25 +445,10 @@ enum YoggSaronIllusions
STORMWIND_ILLUSION = 2,
};
-template<class AI, class T>
-AI* GetUlduarAI(T* obj)
+template<typename AI, typename T>
+inline AI* GetUlduarAI(T* obj)
{
- return GetInstanceAI<AI, T>(obj, UlduarScriptName);
+ return GetInstanceAI<AI>(obj, UlduarScriptName);
}
-class PlayerOrPetCheck
-{
- public:
- bool operator()(WorldObject* object) const
- {
- if (object->GetTypeId() == TYPEID_PLAYER)
- return false;
-
- if (Creature* creature = object->ToCreature())
- return !creature->IsPet();
-
- return true;
- }
-};
-
#endif
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp
index 5a5673817fb..f67779fb154 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp
@@ -29,7 +29,6 @@ EndScriptData */
#include "Spell.h"
#include "SpellAuraEffects.h"
#include "SpellInfo.h"
-#include "SpellMgr.h"
#include "SpellScript.h"
#include "utgarde_keep.h"
@@ -411,7 +410,7 @@ class npc_ingvar_throw_dummy : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_ingvar_throw_dummyAI(creature);
+ return GetUtgardeKeepAI<npc_ingvar_throw_dummyAI>(creature);
}
};
@@ -454,9 +453,7 @@ class spell_ingvar_woe_strike : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_WOE_STRIKE_EFFECT))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_WOE_STRIKE_EFFECT });
}
bool CheckProc(ProcEventInfo& eventInfo)
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp
index 7e732e9bc60..fc92c2490c5 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp
@@ -23,9 +23,11 @@ SDCategory: Utgarde Keep
EndScriptData */
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
+#include "SpellAuras.h"
#include "SpellScript.h"
-#include "SpellAuraEffects.h"
#include "utgarde_keep.h"
enum KelsethEncounter
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp
index d14763e6290..42e775796de 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp
@@ -23,6 +23,8 @@ SDCategory: Utgarde Keep
EndScriptData */
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
#include "utgarde_keep.h"
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp
index ed8f349edd6..e40912c78c5 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp
@@ -16,7 +16,10 @@
*/
#include "ScriptMgr.h"
+#include "Creature.h"
+#include "GameObject.h"
#include "InstanceScript.h"
+#include "Map.h"
#include "utgarde_keep.h"
DoorData const doorData[] =
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp
index 11060b4c983..f4c68ad36e7 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp
@@ -16,10 +16,12 @@
*/
#include "ScriptMgr.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
#include "ScriptedCreature.h"
-#include "utgarde_keep.h"
+#include "SpellInfo.h"
#include "SpellScript.h"
-#include "SpellAuraEffects.h"
+#include "utgarde_keep.h"
uint32 ForgeSearch[3] =
{
@@ -130,9 +132,7 @@ class spell_ticking_time_bomb : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_TICKING_TIME_BOMB_EXPLODE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_TICKING_TIME_BOMB_EXPLODE });
}
void HandleOnEffectRemove(AuraEffect const* /* aurEff */, AuraEffectHandleModes /* mode */)
@@ -169,9 +169,7 @@ class spell_fixate : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_FIXATE_TRIGGER))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_FIXATE_TRIGGER });
}
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
@@ -208,9 +206,7 @@ class spell_uk_second_wind : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SECOND_WIND_TRIGGER))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SECOND_WIND_TRIGGER });
}
bool CheckProc(ProcEventInfo& eventInfo)
@@ -342,7 +338,7 @@ class npc_enslaved_proto_drake : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_enslaved_proto_drakeAI(creature);
+ return GetUtgardeKeepAI<npc_enslaved_proto_drakeAI>(creature);
}
};
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.h b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.h
index 81a357e4cff..e2852a9d9ed 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.h
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.h
@@ -18,6 +18,8 @@
#ifndef UTGARDE_KEEP_H_
#define UTGARDE_KEEP_H_
+#include "CreatureAIImpl.h"
+
#define UKScriptName "instance_utgarde_keep"
#define DataHeader "UK"
@@ -85,8 +87,8 @@ struct ForgeInfo
uint32 Event;
};
-template<class AI>
-AI* GetUtgardeKeepAI(Creature* creature)
+template<typename AI>
+inline AI* GetUtgardeKeepAI(Creature* creature)
{
return GetInstanceAI<AI>(creature, UKScriptName);
}
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp
index 1b864ec4b43..735ef2f087b 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp
@@ -23,9 +23,12 @@ SDComment:
SDCategory:
Script Data End */
-#include <algorithm>
#include "ScriptMgr.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
+#include "TemporarySummon.h"
#include "utgarde_pinnacle.h"
enum Spells
@@ -261,7 +264,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_ravenous_furbolgAI>(creature);
+ return GetUtgardePinnacleAI<npc_ravenous_furbolgAI>(creature);
}
struct npc_ravenous_furbolgAI : public ScriptedAI
@@ -375,7 +378,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_frenzied_worgenAI>(creature);
+ return GetUtgardePinnacleAI<npc_frenzied_worgenAI>(creature);
}
struct npc_frenzied_worgenAI : public ScriptedAI
@@ -491,7 +494,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_ferocious_rhinoAI>(creature);
+ return GetUtgardePinnacleAI<npc_ferocious_rhinoAI>(creature);
}
struct npc_ferocious_rhinoAI : public ScriptedAI
@@ -612,7 +615,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_massive_jormungarAI>(creature);
+ return GetUtgardePinnacleAI<npc_massive_jormungarAI>(creature);
}
struct npc_massive_jormungarAI : public ScriptedAI
@@ -719,7 +722,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_palehoof_orbAI>(creature);
+ return GetUtgardePinnacleAI<npc_palehoof_orbAI>(creature);
}
struct npc_palehoof_orbAI : public ScriptedAI
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp
index 12b0a16523d..7e31ccd5d35 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp
@@ -16,13 +16,16 @@
*/
#include "ScriptMgr.h"
+#include "GridNotifiers.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptedCreature.h"
#include "SpellAuras.h"
+#include "SpellInfo.h"
#include "SpellScript.h"
+#include "TemporarySummon.h"
#include "utgarde_pinnacle.h"
-#include "GridNotifiers.h"
-#include "Player.h"
-#include "MoveSplineInit.h"
enum Spells
{
@@ -322,7 +325,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_skadiAI>(creature);
+ return GetUtgardePinnacleAI<boss_skadiAI>(creature);
}
};
@@ -464,7 +467,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_graufAI>(creature);
+ return GetUtgardePinnacleAI<npc_graufAI>(creature);
}
};
@@ -560,7 +563,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_ymirjar_warriorAI>(creature);
+ return GetUtgardePinnacleAI<npc_ymirjar_warriorAI>(creature);
}
};
@@ -591,7 +594,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_ymirjar_witch_doctorAI>(creature);
+ return GetUtgardePinnacleAI<npc_ymirjar_witch_doctorAI>(creature);
}
};
@@ -628,7 +631,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_ymirjar_harpoonerAI>(creature);
+ return GetUtgardePinnacleAI<npc_ymirjar_harpoonerAI>(creature);
}
};
@@ -643,9 +646,7 @@ public:
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_FREEZING_CLOUD))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_FREEZING_CLOUD });
}
void FilterTargets(std::list<WorldObject*>& targets)
@@ -682,9 +683,7 @@ public:
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_FREEZING_CLOUD))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_FREEZING_CLOUD });
}
void FilterTargets(std::list<WorldObject*>& targets)
@@ -830,9 +829,7 @@ class spell_skadi_poisoned_spear : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_POISONED_SPEAR_PERIODIC))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_POISONED_SPEAR_PERIODIC });
}
void HandleScript(SpellEffIndex /*effIndex*/)
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp
index cd4ba9b249e..85c21ffb9eb 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp
@@ -16,9 +16,13 @@
*/
#include "ScriptMgr.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
+#include "SpellInfo.h"
#include "SpellScript.h"
-#include "SpellAuraEffects.h"
+#include "TemporarySummon.h"
#include "utgarde_pinnacle.h"
enum Spells
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp
index 5e06f933406..622cc8fdc1c 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp
@@ -16,10 +16,12 @@
*/
#include "ScriptMgr.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
-#include "utgarde_pinnacle.h"
#include "SpellInfo.h"
#include "SpellScript.h"
+#include "TemporarySummon.h"
+#include "utgarde_pinnacle.h"
enum Spells
{
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_utgarde_pinnacle.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_utgarde_pinnacle.cpp
index bc94bda10a1..8a18ea56dd9 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_utgarde_pinnacle.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_utgarde_pinnacle.cpp
@@ -16,7 +16,11 @@
*/
#include "ScriptMgr.h"
+#include "AreaBoundary.h"
+#include "Creature.h"
+#include "GameObject.h"
#include "InstanceScript.h"
+#include "Map.h"
#include "utgarde_pinnacle.h"
BossBoundaryData const boundaries =
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/utgarde_pinnacle.h b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/utgarde_pinnacle.h
index 39e009095f9..cd6e13c3206 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/utgarde_pinnacle.h
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/utgarde_pinnacle.h
@@ -18,6 +18,8 @@
#ifndef UTGARDE_PINNACLE_H_
#define UTGARDE_PINNACLE_H_
+#include "CreatureAIImpl.h"
+
#define UPScriptName "instance_utgarde_pinnacle"
#define DataHeader "UP"
@@ -93,8 +95,8 @@ enum UPGameObjectIds
GO_KING_YMIRON_DOOR = 192174
};
-template<class AI>
-AI* GetUtgardePinnacleAI(Creature* creature)
+template<typename AI>
+inline AI* GetUtgardePinnacleAI(Creature* creature)
{
return GetInstanceAI<AI>(creature, UPScriptName);
}
diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_archavon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_archavon.cpp
index 71ee6285074..84c5fbf0c2c 100644
--- a/src/server/scripts/Northrend/VaultOfArchavon/boss_archavon.cpp
+++ b/src/server/scripts/Northrend/VaultOfArchavon/boss_archavon.cpp
@@ -138,7 +138,7 @@ class boss_archavon : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_archavonAI(creature);
+ return GetVaultOfArchavonAI<boss_archavonAI>(creature);
}
};
@@ -212,7 +212,7 @@ class npc_archavon_warder : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_archavon_warderAI(creature);
+ return GetVaultOfArchavonAI<npc_archavon_warderAI>(creature);
}
};
@@ -228,12 +228,13 @@ class spell_archavon_rock_shards : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_ROCK_SHARDS_VISUAL_L)
- || !sSpellMgr->GetSpellInfo(SPELL_ROCK_SHARDS_VISUAL_R)
- || !sSpellMgr->GetSpellInfo(SPELL_ROCK_SHARDS_DAMAGE_L)
- || !sSpellMgr->GetSpellInfo(SPELL_ROCK_SHARDS_DAMAGE_R))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_ROCK_SHARDS_VISUAL_L,
+ SPELL_ROCK_SHARDS_VISUAL_R,
+ SPELL_ROCK_SHARDS_DAMAGE_L,
+ SPELL_ROCK_SHARDS_DAMAGE_R
+ });
}
void HandleScript(SpellEffIndex /*effIndex*/)
diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp
index 20a86e2c8f7..b226d82d300 100644
--- a/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp
+++ b/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp
@@ -16,6 +16,8 @@
*/
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
#include "SpellAuras.h"
#include "vault_of_archavon.h"
@@ -171,7 +173,7 @@ class boss_emalon : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_emalonAI(creature);
+ return GetVaultOfArchavonAI<boss_emalonAI>(creature);
}
};
@@ -277,7 +279,7 @@ class npc_tempest_minion : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_tempest_minionAI>(creature);
+ return GetVaultOfArchavonAI<npc_tempest_minionAI>(creature);
}
};
diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_koralon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_koralon.cpp
index 6141c2167d4..29cde098f9c 100644
--- a/src/server/scripts/Northrend/VaultOfArchavon/boss_koralon.cpp
+++ b/src/server/scripts/Northrend/VaultOfArchavon/boss_koralon.cpp
@@ -17,7 +17,6 @@
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
-#include "SpellAuraEffects.h"
#include "SpellScript.h"
#include "vault_of_archavon.h"
@@ -117,7 +116,7 @@ class boss_koralon : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_koralonAI(creature);
+ return GetVaultOfArchavonAI<boss_koralonAI>(creature);
}
};
@@ -181,7 +180,7 @@ class npc_flame_warder : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_flame_warderAI(creature);
+ return GetVaultOfArchavonAI<npc_flame_warderAI>(creature);
}
};
@@ -196,9 +195,7 @@ class spell_koralon_meteor_fists : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_METEOR_FISTS_DAMAGE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_METEOR_FISTS_DAMAGE });
}
void TriggerFists(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -273,9 +270,7 @@ class spell_flame_warder_meteor_fists : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_FW_METEOR_FISTS_DAMAGE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_FW_METEOR_FISTS_DAMAGE });
}
void TriggerFists(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp
index 9d80dc64a1a..9ee67f4d3ad 100644
--- a/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp
+++ b/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp
@@ -16,6 +16,8 @@
*/
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
#include "vault_of_archavon.h"
@@ -117,7 +119,7 @@ class boss_toravon : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_toravonAI(creature);
+ return GetVaultOfArchavonAI<boss_toravonAI>(creature);
}
};
@@ -172,7 +174,7 @@ class npc_frost_warder : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_frost_warderAI(creature);
+ return GetVaultOfArchavonAI<npc_frost_warderAI>(creature);
}
};
@@ -233,7 +235,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_frozen_orbAI(creature);
+ return GetVaultOfArchavonAI<npc_frozen_orbAI>(creature);
}
};
@@ -287,7 +289,7 @@ class npc_frozen_orb_stalker : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_frozen_orb_stalkerAI>(creature);
+ return GetVaultOfArchavonAI<npc_frozen_orb_stalkerAI>(creature);
}
};
diff --git a/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp
index a3bac4f39dd..1e370f064a4 100644
--- a/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp
+++ b/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp
@@ -16,7 +16,9 @@
*/
#include "ScriptMgr.h"
+#include "Creature.h"
#include "InstanceScript.h"
+#include "Map.h"
#include "vault_of_archavon.h"
/* Vault of Archavon encounters:
@@ -29,7 +31,7 @@
class instance_vault_of_archavon : public InstanceMapScript
{
public:
- instance_vault_of_archavon() : InstanceMapScript("instance_vault_of_archavon", 624) { }
+ instance_vault_of_archavon() : InstanceMapScript(VoAScriptName, 624) { }
struct instance_vault_of_archavon_InstanceMapScript : public InstanceScript
{
diff --git a/src/server/scripts/Northrend/VaultOfArchavon/vault_of_archavon.h b/src/server/scripts/Northrend/VaultOfArchavon/vault_of_archavon.h
index 3af77979c68..9541dafead6 100644
--- a/src/server/scripts/Northrend/VaultOfArchavon/vault_of_archavon.h
+++ b/src/server/scripts/Northrend/VaultOfArchavon/vault_of_archavon.h
@@ -18,6 +18,9 @@
#ifndef DEF_ARCHAVON_H
#define DEF_ARCHAVON_H
+#include "CreatureAIImpl.h"
+
+#define VoAScriptName "instance_vault_of_archavon"
#define DataHeader "VA"
uint32 const EncounterCount = 4;
@@ -49,4 +52,10 @@ enum VAAchievementSpells
SPELL_EARTH_WIND_FIRE_ACHIEVEMENT_CHECK = 68308,
};
+template<typename AI>
+inline AI* GetVaultOfArchavonAI(Creature* creature)
+{
+ return GetInstanceAI<AI>(creature, VoAScriptName);
+}
+
#endif
diff --git a/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp b/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp
index ebcc48f5ed8..bb7239d2cc5 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp
@@ -16,6 +16,7 @@
*/
#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "SpellScript.h"
#include "ScriptedCreature.h"
#include "violet_hold.h"
@@ -154,9 +155,7 @@ class spell_cyanigosa_arcane_vacuum : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_PLAYER))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SUMMON_PLAYER });
}
void HandleScript(SpellEffIndex /*effIndex*/)
diff --git a/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp b/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp
index 2ece5ec85b7..f9f99999eeb 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp
@@ -16,6 +16,8 @@
*/
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
#include "violet_hold.h"
diff --git a/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp b/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp
index 6054b5d4573..831a9abd6c2 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp
@@ -16,8 +16,10 @@
*/
#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "ScriptedCreature.h"
-#include "SpellAuraEffects.h"
+#include "SpellAuras.h"
+#include "SpellInfo.h"
#include "SpellScript.h"
#include "violet_hold.h"
@@ -344,9 +346,7 @@ class spell_ichoron_merge : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SHRINK))
- return false;
- return true;
+ return !ValidateSpellInfo({ SPELL_SHRINK });
}
void HandleScript(SpellEffIndex /*effIndex*/)
@@ -419,14 +419,15 @@ class spell_ichoron_splatter : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_WATER_GLOBULE_SUMMON_1)
- || !sSpellMgr->GetSpellInfo(SPELL_WATER_GLOBULE_SUMMON_2)
- || !sSpellMgr->GetSpellInfo(SPELL_WATER_GLOBULE_SUMMON_3)
- || !sSpellMgr->GetSpellInfo(SPELL_WATER_GLOBULE_SUMMON_4)
- || !sSpellMgr->GetSpellInfo(SPELL_WATER_GLOBULE_SUMMON_5)
- || !sSpellMgr->GetSpellInfo(SPELL_SHRINK))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_WATER_GLOBULE_SUMMON_1,
+ SPELL_WATER_GLOBULE_SUMMON_2,
+ SPELL_WATER_GLOBULE_SUMMON_3,
+ SPELL_WATER_GLOBULE_SUMMON_4,
+ SPELL_WATER_GLOBULE_SUMMON_5,
+ SPELL_SHRINK
+ });
}
void PeriodicTick(AuraEffect const* /*aurEff*/)
diff --git a/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp b/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp
index 1a25a0b69fe..0a13ee4b744 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp
@@ -16,6 +16,7 @@
*/
#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "ScriptedCreature.h"
#include "violet_hold.h"
@@ -36,27 +37,12 @@ class boss_lavanthor : public CreatureScript
{
boss_lavanthorAI(Creature* creature) : BossAI(creature, DATA_LAVANTHOR) { }
- void Reset() override
- {
- BossAI::Reset();
- }
-
- void EnterCombat(Unit* who) override
- {
- BossAI::EnterCombat(who);
- }
-
void JustReachedHome() override
{
BossAI::JustReachedHome();
instance->SetData(DATA_HANDLE_CELLS, DATA_LAVANTHOR);
}
- void JustDied(Unit* killer) override
- {
- BossAI::JustDied(killer);
- }
-
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
diff --git a/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp b/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp
index 2f7645dfe94..6827a587aa4 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp
@@ -16,9 +16,11 @@
*/
#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "ScriptedCreature.h"
-#include "SpellScript.h"
#include "SpellAuraEffects.h"
+#include "SpellInfo.h"
+#include "SpellScript.h"
#include "violet_hold.h"
enum Spells
@@ -45,27 +47,12 @@ class boss_moragg : public CreatureScript
{
boss_moraggAI(Creature* creature) : BossAI(creature, DATA_MORAGG) { }
- void Reset() override
- {
- BossAI::Reset();
- }
-
- void EnterCombat(Unit* who) override
- {
- BossAI::EnterCombat(who);
- }
-
void JustReachedHome() override
{
BossAI::JustReachedHome();
instance->SetData(DATA_HANDLE_CELLS, DATA_MORAGG);
}
- void JustDied(Unit* killer) override
- {
- BossAI::JustDied(killer);
- }
-
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
@@ -148,6 +135,16 @@ public:
{
PrepareAuraScript(spell_moragg_optic_link_AuraScript);
+ bool Validate(SpellInfo const* /*spellInfo*/) override
+ {
+ return ValidateSpellInfo(
+ {
+ SPELL_OPTIC_LINK_LEVEL_3,
+ SPELL_OPTIC_LINK_LEVEL_2,
+ SPELL_OPTIC_LINK_LEVEL_1
+ });
+ }
+
void OnPeriodic(AuraEffect const* aurEff)
{
if (Unit* caster = GetCaster())
diff --git a/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp b/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp
index 322cb600f58..bd1a11164c8 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp
@@ -16,10 +16,10 @@
*/
#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "ScriptedCreature.h"
#include "SpellInfo.h"
#include "SpellScript.h"
-#include "Player.h"
#include "violet_hold.h"
/*
@@ -262,9 +262,7 @@ class spell_xevozz_summon_players : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_MAGIC_PULL))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_MAGIC_PULL });
}
void HandleScript(SpellEffIndex /*effIndex*/)
diff --git a/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp b/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp
index f26ca430538..7fe9068d684 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp
@@ -16,6 +16,7 @@
*/
#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "ScriptedCreature.h"
#include "violet_hold.h"
diff --git a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp
index 4ef2e4c9c7d..3c8764836b7 100644
--- a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp
+++ b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp
@@ -16,11 +16,16 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "Creature.h"
+#include "CreatureAI.h"
+#include "GameObject.h"
#include "InstanceScript.h"
+#include "Map.h"
+#include "Player.h"
+#include "TaskScheduler.h"
+#include "TemporarySummon.h"
#include "WorldStatePackets.h"
#include "violet_hold.h"
-#include "Player.h"
/*
* TODO:
@@ -330,11 +335,11 @@ class instance_violet_hold : public InstanceMapScript
{
case DATA_1ST_BOSS:
if (state == DONE)
- UpdateEncounterState(ENCOUNTER_CREDIT_KILL_CREATURE, NPC_EREKEM, nullptr);
+ UpdateEncounterStateForKilledCreature(NPC_EREKEM, nullptr);
break;
case DATA_2ND_BOSS:
if (state == DONE)
- UpdateEncounterState(ENCOUNTER_CREDIT_KILL_CREATURE, NPC_MORAGG, nullptr);
+ UpdateEncounterStateForKilledCreature(NPC_MORAGG, nullptr);
break;
case DATA_CYANIGOSA:
if (state == DONE)
diff --git a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp
index b2061ea6369..174e417155e 100644
--- a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp
+++ b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp
@@ -15,13 +15,15 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "Player.h"
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "Player.h"
#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
#include "SpellAuraEffects.h"
#include "SpellScript.h"
+#include "TemporarySummon.h"
#include "violet_hold.h"
/*
@@ -1395,9 +1397,7 @@ class spell_violet_hold_teleport_player : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_TELEPORT_PLAYER_EFFECT))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_TELEPORT_PLAYER_EFFECT });
}
void HandleScript(SpellEffIndex /*effIndex*/)
diff --git a/src/server/scripts/Northrend/VioletHold/violet_hold.h b/src/server/scripts/Northrend/VioletHold/violet_hold.h
index 537c5d51b1e..6bb318e30f6 100644
--- a/src/server/scripts/Northrend/VioletHold/violet_hold.h
+++ b/src/server/scripts/Northrend/VioletHold/violet_hold.h
@@ -18,6 +18,10 @@
#ifndef VIOLET_HOLD_H_
#define VIOLET_HOLD_H_
+#include "CreatureAIImpl.h"
+
+struct Position;
+
#define VioletHoldScriptName "instance_violet_hold"
#define DataHeader "VH"
@@ -25,7 +29,7 @@ uint32 const EncounterCount = 3 + 6;
// Defined in instance_violet_hold.cpp
extern Position const DefenseSystemLocation;
-uint8 const PortalIntroCount = 3;
+uint8 constexpr PortalIntroCount = 3;
extern Position const PortalIntroPositions[];
/*
@@ -151,7 +155,7 @@ enum VHInstanceMisc
POINT_INTRO = 1
};
-template<class AI>
+template<typename AI>
inline AI* GetVioletHoldAI(Creature* creature)
{
return GetInstanceAI<AI>(creature, VioletHoldScriptName);
diff --git a/src/server/scripts/Northrend/zone_borean_tundra.cpp b/src/server/scripts/Northrend/zone_borean_tundra.cpp
index e3a797219a1..635c653fe8d 100644
--- a/src/server/scripts/Northrend/zone_borean_tundra.cpp
+++ b/src/server/scripts/Northrend/zone_borean_tundra.cpp
@@ -35,14 +35,16 @@ npc_nexus_drake_hatchling
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
+#include "GameObject.h"
+#include "ObjectAccessor.h"
+#include "ObjectMgr.h"
+#include "Player.h"
#include "ScriptedEscortAI.h"
#include "ScriptedFollowerAI.h"
-#include "Player.h"
+#include "ScriptedGossip.h"
#include "SpellInfo.h"
-#include "WorldSession.h"
#include "SpellScript.h"
+#include "TemporarySummon.h"
/*######
## npc_sinkhole_kill_credit
diff --git a/src/server/scripts/Northrend/zone_crystalsong_forest.cpp b/src/server/scripts/Northrend/zone_crystalsong_forest.cpp
index 4dadebb1cda..3b7c5328247 100644
--- a/src/server/scripts/Northrend/zone_crystalsong_forest.cpp
+++ b/src/server/scripts/Northrend/zone_crystalsong_forest.cpp
@@ -24,8 +24,8 @@ SDCategory: CrystalsongForest
Script Data End */
#include "ScriptMgr.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
-#include "Player.h"
/*******************************************************
* npc_warmage_violetstand
@@ -68,32 +68,27 @@ public:
if (me->IsNonMeleeSpellCast(false))
return;
- if (me->GetEntry() == NPC_WARMAGE_SARINA)
- {
if (!targetGUID)
{
- std::list<Creature*> orbList;
- GetCreatureListWithEntryInGrid(orbList, me, NPC_TRANSITUS_SHIELD_DUMMY, 32.0f);
- if (!orbList.empty())
+ if (me->GetEntry() == NPC_WARMAGE_SARINA)
{
- for (Creature* orb : orbList)
+ std::list<Creature*> orbList;
+ GetCreatureListWithEntryInGrid(orbList, me, NPC_TRANSITUS_SHIELD_DUMMY, 32.0f);
+ if (!orbList.empty())
{
- if (orb->GetPositionY() < 1000)
+ for (Creature* orb : orbList)
{
- targetGUID = orb->GetGUID();
- break;
+ if (orb->GetPositionY() < 1000)
+ {
+ targetGUID = orb->GetGUID();
+ break;
+ }
}
}
}
- }
- }
- else
- {
- if (!targetGUID)
- if (Creature* pOrb = GetClosestCreatureWithEntry(me, NPC_TRANSITUS_SHIELD_DUMMY, 32.0f))
+ else if (Creature* pOrb = GetClosestCreatureWithEntry(me, NPC_TRANSITUS_SHIELD_DUMMY, 32.0f))
targetGUID = pOrb->GetGUID();
-
- }
+ }
if (Creature* pOrb = ObjectAccessor::GetCreature(*me, targetGUID))
DoCast(pOrb, SPELL_TRANSITUS_SHIELD_BEAM);
@@ -109,5 +104,5 @@ public:
void AddSC_crystalsong_forest()
{
- new npc_warmage_violetstand;
+ new npc_warmage_violetstand();
}
diff --git a/src/server/scripts/Northrend/zone_dalaran.cpp b/src/server/scripts/Northrend/zone_dalaran.cpp
index 37777af0e57..5a043d3438c 100644
--- a/src/server/scripts/Northrend/zone_dalaran.cpp
+++ b/src/server/scripts/Northrend/zone_dalaran.cpp
@@ -23,12 +23,12 @@ SDComment: For what is 63990+63991? Same function but don't work correct...
SDCategory: Dalaran
Script Data End */
-#include "DatabaseEnv.h"
#include "ScriptMgr.h"
+#include "DatabaseEnv.h"
+#include "Mail.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
#include "Player.h"
-#include "WorldSession.h"
/*******************************************************
* npc_mageguard_dalaran
@@ -166,7 +166,7 @@ class npc_minigob_manabonk : public CreatureScript
Player* SelectTargetInDalaran()
{
- std::list<Player*> PlayerInDalaranList;
+ std::vector<Player*> PlayerInDalaranList;
PlayerInDalaranList.clear();
Map::PlayerList const &players = me->GetMap()->GetPlayers();
diff --git a/src/server/scripts/Northrend/zone_dragonblight.cpp b/src/server/scripts/Northrend/zone_dragonblight.cpp
index bac80342e74..2cda3eb3cba 100644
--- a/src/server/scripts/Northrend/zone_dragonblight.cpp
+++ b/src/server/scripts/Northrend/zone_dragonblight.cpp
@@ -27,14 +27,14 @@ EndScriptData */
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "CombatAI.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
+#include "ScriptedEscortAI.h"
#include "ScriptedGossip.h"
-#include "SpellScript.h"
#include "SpellAuraEffects.h"
-#include "ScriptedEscortAI.h"
+#include "SpellScript.h"
#include "Vehicle.h"
-#include "CombatAI.h"
-#include "Player.h"
/*#####
# npc_commander_eligor_dawnbringer
diff --git a/src/server/scripts/Northrend/zone_grizzly_hills.cpp b/src/server/scripts/Northrend/zone_grizzly_hills.cpp
index cdc0fa36714..1d17b2ec113 100644
--- a/src/server/scripts/Northrend/zone_grizzly_hills.cpp
+++ b/src/server/scripts/Northrend/zone_grizzly_hills.cpp
@@ -955,9 +955,12 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_WARHEAD_Z_CHECK) || !sSpellMgr->GetSpellInfo(SPELL_WARHEAD_SEEKING_LUMBERSHIP) || !sSpellMgr->GetSpellInfo(SPELL_WARHEAD_FUSE))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_WARHEAD_Z_CHECK,
+ SPELL_WARHEAD_SEEKING_LUMBERSHIP,
+ SPELL_WARHEAD_FUSE
+ });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -999,9 +1002,7 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PARACHUTE) || !sSpellMgr->GetSpellInfo(SPELL_TORPEDO_EXPLOSION))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_PARACHUTE, SPELL_TORPEDO_EXPLOSION });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
diff --git a/src/server/scripts/Northrend/zone_howling_fjord.cpp b/src/server/scripts/Northrend/zone_howling_fjord.cpp
index 4217087e0b6..598a2fd2745 100644
--- a/src/server/scripts/Northrend/zone_howling_fjord.cpp
+++ b/src/server/scripts/Northrend/zone_howling_fjord.cpp
@@ -28,12 +28,13 @@ npc_apothecary_hanes
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
-#include "ScriptedEscortAI.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "ScriptedEscortAI.h"
+#include "ScriptedGossip.h"
#include "SpellInfo.h"
#include "SpellScript.h"
+#include "TemporarySummon.h"
/*######
## npc_apothecary_hanes
@@ -555,9 +556,7 @@ class spell_mindless_abomination_explosion_fx_master : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_RANDOM_CIRCUMFERENCE_POINT_POISON) || !sSpellMgr->GetSpellInfo(SPELL_COSMETIC_BLOOD_EXPLOSION_GREEN_LARGE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_RANDOM_CIRCUMFERENCE_POINT_POISON, SPELL_COSMETIC_BLOOD_EXPLOSION_GREEN_LARGE });
}
void HandleScript(SpellEffIndex /*eff*/)
diff --git a/src/server/scripts/Northrend/zone_icecrown.cpp b/src/server/scripts/Northrend/zone_icecrown.cpp
index 18858474478..5834b90f3c6 100644
--- a/src/server/scripts/Northrend/zone_icecrown.cpp
+++ b/src/server/scripts/Northrend/zone_icecrown.cpp
@@ -17,12 +17,13 @@
*/
#include "ScriptMgr.h"
+#include "CombatAI.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
#include "SpellAuras.h"
-#include "Player.h"
#include "TemporarySummon.h"
-#include "CombatAI.h"
/*######
## npc_argent_valiant
diff --git a/src/server/scripts/Northrend/zone_sholazar_basin.cpp b/src/server/scripts/Northrend/zone_sholazar_basin.cpp
index 6208b555d1f..5a0c42a77be 100644
--- a/src/server/scripts/Northrend/zone_sholazar_basin.cpp
+++ b/src/server/scripts/Northrend/zone_sholazar_basin.cpp
@@ -29,14 +29,16 @@ npc_haiphoon (Quest: "Song of Wind and Water")
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
+#include "CombatAI.h"
+#include "ObjectAccessor.h"
+#include "ObjectMgr.h"
+#include "Player.h"
#include "ScriptedEscortAI.h"
-#include "SpellScript.h"
+#include "ScriptedGossip.h"
#include "SpellAuras.h"
+#include "SpellScript.h"
+#include "TemporarySummon.h"
#include "Vehicle.h"
-#include "CombatAI.h"
-#include "Player.h"
/*######
## npc_vekjik
@@ -253,7 +255,7 @@ public:
case 1:
Talk(SAY_WP_3);
me->CastSpell(5918.33f, 5372.91f, -98.770f, SPELL_EXPLODE_CRYSTAL, true);
- me->SummonGameObject(184743, 5918.33f, 5372.91f, -98.770f, 0, G3D::Quat(), TEMPSUMMON_MANUAL_DESPAWN); //approx 3 to 4 seconds
+ me->SummonGameObject(184743, 5918.33f, 5372.91f, -98.770f, 0, QuaternionData(), TEMPSUMMON_MANUAL_DESPAWN); //approx 3 to 4 seconds
me->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH);
break;
case 2:
@@ -264,7 +266,7 @@ public:
break;
case 8:
me->CastSpell(5887.37f, 5379.39f, -91.289f, SPELL_EXPLODE_CRYSTAL, true);
- me->SummonGameObject(184743, 5887.37f, 5379.39f, -91.289f, 0, G3D::Quat(), TEMPSUMMON_MANUAL_DESPAWN); //approx 3 to 4 seconds
+ me->SummonGameObject(184743, 5887.37f, 5379.39f, -91.289f, 0, QuaternionData(), TEMPSUMMON_MANUAL_DESPAWN); //approx 3 to 4 seconds
me->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH);
break;
case 9:
diff --git a/src/server/scripts/Northrend/zone_storm_peaks.cpp b/src/server/scripts/Northrend/zone_storm_peaks.cpp
index 252ed540c21..0376ecb259f 100644
--- a/src/server/scripts/Northrend/zone_storm_peaks.cpp
+++ b/src/server/scripts/Northrend/zone_storm_peaks.cpp
@@ -16,15 +16,16 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
+#include "CombatAI.h"
+#include "GameObject.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptedEscortAI.h"
-#include "SpellScript.h"
+#include "ScriptedGossip.h"
#include "SpellAuraEffects.h"
+#include "SpellScript.h"
+#include "TemporarySummon.h"
#include "Vehicle.h"
-#include "CombatAI.h"
-#include "Player.h"
-#include "WorldSession.h"
/////////////////////
///npc_injured_goblin
@@ -515,7 +516,7 @@ public:
if (Player* player = ObjectAccessor::GetPlayer(*me, playerGUID))
voice->AI()->Talk(SAY_VOICE_1, player);
}
- if (GameObject* go = me->SummonGameObject(OBJECT_TOL_SIGNAL_1, 7860.273f, -1383.622f, 1538.302f, -1.658062f, G3D::Quat(0.f, 0.f, -0.737277f, 0.6755905f), 0))
+ if (GameObject* go = me->SummonGameObject(OBJECT_TOL_SIGNAL_1, 7860.273f, -1383.622f, 1538.302f, -1.658062f, QuaternionData(0.f, 0.f, -0.737277f, 0.6755905f), 0))
objectGUID[objectCounter++] = go->GetGUID();
events.ScheduleEvent(EVENT_SCRIPT_5, 6000);
break;
@@ -523,7 +524,7 @@ public:
if (Player* player = ObjectAccessor::GetPlayer(*me, playerGUID))
if (Creature* voice = ObjectAccessor::GetCreature(*me, voiceGUID))
voice->AI()->Talk(SAY_VOICE_2, player);
- if (GameObject* go = me->SummonGameObject(OBJECT_TOL_SIGNAL_2, 7875.67f, -1387.266f, 1538.323f, -2.373644f, G3D::Quat(0.f, 0.f, -0.9271832f, 0.3746083f), 0))
+ if (GameObject* go = me->SummonGameObject(OBJECT_TOL_SIGNAL_2, 7875.67f, -1387.266f, 1538.323f, -2.373644f, QuaternionData(0.f, 0.f, -0.9271832f, 0.3746083f), 0))
objectGUID[objectCounter++] = go->GetGUID();
events.ScheduleEvent(EVENT_SCRIPT_6, 6000);
break;
@@ -531,7 +532,7 @@ public:
if (Player* player = ObjectAccessor::GetPlayer(*me, playerGUID))
if (Creature* voice = ObjectAccessor::GetCreature(*me, voiceGUID))
voice->AI()->Talk(SAY_VOICE_3, player);
- if (GameObject* go = me->SummonGameObject(OBJECT_TOL_SIGNAL_3, 7879.212f, -1401.175f, 1538.279f, 2.967041f, G3D::Quat(0.f, 0.f, 0.9961939f, 0.08716504f), 0))
+ if (GameObject* go = me->SummonGameObject(OBJECT_TOL_SIGNAL_3, 7879.212f, -1401.175f, 1538.279f, 2.967041f, QuaternionData(0.f, 0.f, 0.9961939f, 0.08716504f), 0))
objectGUID[objectCounter++] = go->GetGUID();
events.ScheduleEvent(EVENT_SCRIPT_7, 6000);
break;
@@ -539,7 +540,7 @@ public:
if (Player* player = ObjectAccessor::GetPlayer(*me, playerGUID))
if (Creature* voice = ObjectAccessor::GetCreature(*me, voiceGUID))
voice->AI()->Talk(SAY_VOICE_4, player);
- if (GameObject* go = me->SummonGameObject(OBJECT_TOL_SIGNAL_4, 7868.944f, -1411.18f, 1538.213f, 2.111848f, G3D::Quat(0.f, 0.f, 0.8703556f, 0.4924237f), 0))
+ if (GameObject* go = me->SummonGameObject(OBJECT_TOL_SIGNAL_4, 7868.944f, -1411.18f, 1538.213f, 2.111848f, QuaternionData(0.f, 0.f, 0.8703556f, 0.4924237f), 0))
objectGUID[objectCounter++] = go->GetGUID();
events.ScheduleEvent(EVENT_SCRIPT_8, 6000);
break;
@@ -547,7 +548,7 @@ public:
if (Player* player = ObjectAccessor::GetPlayer(*me, playerGUID))
if (Creature* voice = ObjectAccessor::GetCreature(*me, voiceGUID))
voice->AI()->Talk(SAY_VOICE_5, player);
- if (GameObject* go = me->SummonGameObject(OBJECT_TOL_SIGNAL_5, 7855.11f, -1406.839f, 1538.42f, 1.151916f, G3D::Quat(0.f, 0.f, 0.5446386f, 0.8386708f), 0))
+ if (GameObject* go = me->SummonGameObject(OBJECT_TOL_SIGNAL_5, 7855.11f, -1406.839f, 1538.42f, 1.151916f, QuaternionData(0.f, 0.f, 0.5446386f, 0.8386708f), 0))
objectGUID[objectCounter] = go->GetGUID();
events.ScheduleEvent(EVENT_SCRIPT_9, 6000);
break;
@@ -742,9 +743,7 @@ class spell_jokkum_scriptcast : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_JOKKUM_SUMMON))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_JOKKUM_SUMMON });
}
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -775,9 +774,7 @@ class spell_veranus_summon : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_VERANUS_AND_THORIM))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SUMMON_VERANUS_AND_THORIM });
}
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -821,7 +818,7 @@ class spell_close_rift : public SpellScriptLoader
private:
bool Validate(SpellInfo const* /*spell*/) override
{
- return sSpellMgr->GetSpellInfo(SPELL_DESPAWN_RIFT) != nullptr;
+ return ValidateSpellInfo({ SPELL_DESPAWN_RIFT });
}
void HandlePeriodic(AuraEffect const* /* aurEff */)
diff --git a/src/server/scripts/Northrend/zone_wintergrasp.cpp b/src/server/scripts/Northrend/zone_wintergrasp.cpp
index ac145753f3c..aecda636c2d 100644
--- a/src/server/scripts/Northrend/zone_wintergrasp.cpp
+++ b/src/server/scripts/Northrend/zone_wintergrasp.cpp
@@ -501,12 +501,13 @@ class spell_wintergrasp_force_building : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_BUILD_CATAPULT_FORCE)
- || !sSpellMgr->GetSpellInfo(SPELL_BUILD_DEMOLISHER_FORCE)
- || !sSpellMgr->GetSpellInfo(SPELL_BUILD_SIEGE_VEHICLE_FORCE_HORDE)
- || !sSpellMgr->GetSpellInfo(SPELL_BUILD_SIEGE_VEHICLE_FORCE_ALLIANCE))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_BUILD_CATAPULT_FORCE,
+ SPELL_BUILD_DEMOLISHER_FORCE,
+ SPELL_BUILD_SIEGE_VEHICLE_FORCE_HORDE,
+ SPELL_BUILD_SIEGE_VEHICLE_FORCE_ALLIANCE
+ });
}
void HandleScript(SpellEffIndex effIndex)
diff --git a/src/server/scripts/Northrend/zone_zuldrak.cpp b/src/server/scripts/Northrend/zone_zuldrak.cpp
index 26b521a95c7..fc7999ed4fd 100644
--- a/src/server/scripts/Northrend/zone_zuldrak.cpp
+++ b/src/server/scripts/Northrend/zone_zuldrak.cpp
@@ -16,14 +16,16 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
-#include "ScriptedEscortAI.h"
+#include "GameObject.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "ScriptedEscortAI.h"
+#include "ScriptedGossip.h"
+#include "SpellAuraEffects.h"
+#include "SpellAuras.h"
#include "SpellInfo.h"
#include "SpellScript.h"
-#include "SpellAuras.h"
-#include "SpellAuraEffects.h"
+#include "TemporarySummon.h"
#include "Vehicle.h"
/*####
@@ -624,9 +626,12 @@ class spell_random_ingredient_aura : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_RANDOM_INGREDIENT_EASY) || !sSpellMgr->GetSpellInfo(SPELL_RANDOM_INGREDIENT_MEDIUM) || !sSpellMgr->GetSpellInfo(SPELL_RANDOM_INGREDIENT_HARD))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_RANDOM_INGREDIENT_EASY,
+ SPELL_RANDOM_INGREDIENT_MEDIUM,
+ SPELL_RANDOM_INGREDIENT_HARD,
+ });
}
void PeriodicTick(AuraEffect const* /*aurEff*/)
@@ -671,15 +676,30 @@ class spell_random_ingredient : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_FETCH_KNOTROOT) || !sSpellMgr->GetSpellInfo(SPELL_FETCH_PICKLED_EAGLE_EGG) || !sSpellMgr->GetSpellInfo(SPELL_FETCH_SPECKLED_GUANO) ||
- !sSpellMgr->GetSpellInfo(SPELL_FETCH_WITHERED_BATWING) || !sSpellMgr->GetSpellInfo(SPELL_FETCH_SEASONED_SLIDER_CIDER) || !sSpellMgr->GetSpellInfo(SPELL_FETCH_PULVERIZED_GARGOYLE_TEETH) ||
- !sSpellMgr->GetSpellInfo(SPELL_FETCH_MUDDY_MIRE_MAGGOT) || !sSpellMgr->GetSpellInfo(SPELL_FETCH_SPIKY_SPIDER_EGG) || !sSpellMgr->GetSpellInfo(SPELL_FETCH_HAIRY_HERRING_HEAD) ||
- !sSpellMgr->GetSpellInfo(SPELL_FETCH_PUTRID_PIRATE_PERSPIRATION) || !sSpellMgr->GetSpellInfo(SPELL_FETCH_ICECROWN_BOTTLED_WATER) || !sSpellMgr->GetSpellInfo(SPELL_FETCH_WASPS_WINGS) ||
- !sSpellMgr->GetSpellInfo(SPELL_FETCH_PRISMATIC_MOJO) || !sSpellMgr->GetSpellInfo(SPELL_FETCH_RAPTOR_CLAW) || !sSpellMgr->GetSpellInfo(SPELL_FETCH_AMBERSEED) ||
- !sSpellMgr->GetSpellInfo(SPELL_FETCH_SHRUNKEN_DRAGONS_CLAW) || !sSpellMgr->GetSpellInfo(SPELL_FETCH_CHILLED_SERPENT_MUCUS) || !sSpellMgr->GetSpellInfo(SPELL_FETCH_CRYSTALLIZED_HOGSNOT) ||
- !sSpellMgr->GetSpellInfo(SPELL_FETCH_CRUSHED_BASILISK_CRYSTALS) || !sSpellMgr->GetSpellInfo(SPELL_FETCH_TROLLBANE) || !sSpellMgr->GetSpellInfo(SPELL_FETCH_FROZEN_SPIDER_ICHOR))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_FETCH_KNOTROOT, SPELL_HAVE_KNOTROOT,
+ SPELL_FETCH_PICKLED_EAGLE_EGG, SPELL_HAVE_PICKLED_EAGLE_EGG,
+ SPELL_FETCH_SPECKLED_GUANO, SPELL_HAVE_SPECKLED_GUANO,
+ SPELL_FETCH_WITHERED_BATWING, SPELL_HAVE_WITHERED_BATWING,
+ SPELL_FETCH_SEASONED_SLIDER_CIDER, SPELL_HAVE_SEASONED_SLIDER_CIDER,
+ SPELL_FETCH_PULVERIZED_GARGOYLE_TEETH, SPELL_HAVE_PULVERIZED_GARGOYLE_TEETH,
+ SPELL_FETCH_MUDDY_MIRE_MAGGOT, SPELL_HAVE_MUDDY_MIRE_MAGGOT,
+ SPELL_FETCH_SPIKY_SPIDER_EGG, SPELL_HAVE_SPIKY_SPIDER_EGG,
+ SPELL_FETCH_HAIRY_HERRING_HEAD, SPELL_HAVE_HAIRY_HERRING_HEAD,
+ SPELL_FETCH_PUTRID_PIRATE_PERSPIRATION, SPELL_HAVE_PUTRID_PIRATE_PERSPIRATION,
+ SPELL_FETCH_ICECROWN_BOTTLED_WATER, SPELL_HAVE_ICECROWN_BOTTLED_WATER,
+ SPELL_FETCH_WASPS_WINGS, SPELL_HAVE_WASPS_WINGS,
+ SPELL_FETCH_PRISMATIC_MOJO, SPELL_HAVE_PRISMATIC_MOJO,
+ SPELL_FETCH_RAPTOR_CLAW, SPELL_HAVE_RAPTOR_CLAW,
+ SPELL_FETCH_AMBERSEED, SPELL_HAVE_AMBERSEED,
+ SPELL_FETCH_SHRUNKEN_DRAGONS_CLAW, SPELL_HAVE_SHRUNKEN_DRAGONS_CLAW,
+ SPELL_FETCH_CHILLED_SERPENT_MUCUS, SPELL_HAVE_CHILLED_SERPENT_MUCUS,
+ SPELL_FETCH_CRYSTALLIZED_HOGSNOT, SPELL_HAVE_CRYSTALLIZED_HOGSNOT,
+ SPELL_FETCH_CRUSHED_BASILISK_CRYSTALS, SPELL_HAVE_CRUSHED_BASILISK_CRYSTALS,
+ SPELL_FETCH_TROLLBANE, SPELL_HAVE_TROLLBANE,
+ SPELL_FETCH_FROZEN_SPIDER_ICHOR, SPELL_HAVE_FROZEN_SPIDER_ICHOR
+ });
}
void HandleScriptEffect(SpellEffIndex /* effIndex */)
@@ -735,22 +755,30 @@ class spell_pot_check : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_FETCH_KNOTROOT) || !sSpellMgr->GetSpellInfo(SPELL_FETCH_PICKLED_EAGLE_EGG) || !sSpellMgr->GetSpellInfo(SPELL_FETCH_SPECKLED_GUANO) ||
- !sSpellMgr->GetSpellInfo(SPELL_FETCH_WITHERED_BATWING) || !sSpellMgr->GetSpellInfo(SPELL_FETCH_SEASONED_SLIDER_CIDER) || !sSpellMgr->GetSpellInfo(SPELL_FETCH_PULVERIZED_GARGOYLE_TEETH) ||
- !sSpellMgr->GetSpellInfo(SPELL_FETCH_MUDDY_MIRE_MAGGOT) || !sSpellMgr->GetSpellInfo(SPELL_FETCH_SPIKY_SPIDER_EGG) || !sSpellMgr->GetSpellInfo(SPELL_FETCH_HAIRY_HERRING_HEAD) ||
- !sSpellMgr->GetSpellInfo(SPELL_FETCH_PUTRID_PIRATE_PERSPIRATION) || !sSpellMgr->GetSpellInfo(SPELL_FETCH_ICECROWN_BOTTLED_WATER) || !sSpellMgr->GetSpellInfo(SPELL_FETCH_WASPS_WINGS) ||
- !sSpellMgr->GetSpellInfo(SPELL_FETCH_PRISMATIC_MOJO) || !sSpellMgr->GetSpellInfo(SPELL_FETCH_RAPTOR_CLAW) || !sSpellMgr->GetSpellInfo(SPELL_FETCH_AMBERSEED) ||
- !sSpellMgr->GetSpellInfo(SPELL_FETCH_SHRUNKEN_DRAGONS_CLAW) || !sSpellMgr->GetSpellInfo(SPELL_FETCH_CHILLED_SERPENT_MUCUS) || !sSpellMgr->GetSpellInfo(SPELL_FETCH_CRYSTALLIZED_HOGSNOT) ||
- !sSpellMgr->GetSpellInfo(SPELL_FETCH_CRUSHED_BASILISK_CRYSTALS) || !sSpellMgr->GetSpellInfo(SPELL_FETCH_TROLLBANE) || !sSpellMgr->GetSpellInfo(SPELL_FETCH_FROZEN_SPIDER_ICHOR) ||
- !sSpellMgr->GetSpellInfo(SPELL_HAVE_KNOTROOT) || !sSpellMgr->GetSpellInfo(SPELL_HAVE_PICKLED_EAGLE_EGG) || !sSpellMgr->GetSpellInfo(SPELL_HAVE_SPECKLED_GUANO) ||
- !sSpellMgr->GetSpellInfo(SPELL_HAVE_WITHERED_BATWING) || !sSpellMgr->GetSpellInfo(SPELL_HAVE_SEASONED_SLIDER_CIDER) || !sSpellMgr->GetSpellInfo(SPELL_HAVE_PULVERIZED_GARGOYLE_TEETH) ||
- !sSpellMgr->GetSpellInfo(SPELL_HAVE_MUDDY_MIRE_MAGGOT) || !sSpellMgr->GetSpellInfo(SPELL_HAVE_SPIKY_SPIDER_EGG) || !sSpellMgr->GetSpellInfo(SPELL_HAVE_HAIRY_HERRING_HEAD) ||
- !sSpellMgr->GetSpellInfo(SPELL_HAVE_PUTRID_PIRATE_PERSPIRATION) || !sSpellMgr->GetSpellInfo(SPELL_HAVE_ICECROWN_BOTTLED_WATER) || !sSpellMgr->GetSpellInfo(SPELL_HAVE_WASPS_WINGS) ||
- !sSpellMgr->GetSpellInfo(SPELL_HAVE_PRISMATIC_MOJO) || !sSpellMgr->GetSpellInfo(SPELL_HAVE_RAPTOR_CLAW) || !sSpellMgr->GetSpellInfo(SPELL_HAVE_AMBERSEED) ||
- !sSpellMgr->GetSpellInfo(SPELL_HAVE_SHRUNKEN_DRAGONS_CLAW) || !sSpellMgr->GetSpellInfo(SPELL_HAVE_CHILLED_SERPENT_MUCUS) || !sSpellMgr->GetSpellInfo(SPELL_HAVE_CRYSTALLIZED_HOGSNOT) ||
- !sSpellMgr->GetSpellInfo(SPELL_HAVE_CRUSHED_BASILISK_CRYSTALS) || !sSpellMgr->GetSpellInfo(SPELL_HAVE_TROLLBANE) || !sSpellMgr->GetSpellInfo(SPELL_HAVE_FROZEN_SPIDER_ICHOR))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_FETCH_KNOTROOT, SPELL_HAVE_KNOTROOT,
+ SPELL_FETCH_PICKLED_EAGLE_EGG, SPELL_HAVE_PICKLED_EAGLE_EGG,
+ SPELL_FETCH_SPECKLED_GUANO, SPELL_HAVE_SPECKLED_GUANO,
+ SPELL_FETCH_WITHERED_BATWING, SPELL_HAVE_WITHERED_BATWING,
+ SPELL_FETCH_SEASONED_SLIDER_CIDER, SPELL_HAVE_SEASONED_SLIDER_CIDER,
+ SPELL_FETCH_PULVERIZED_GARGOYLE_TEETH, SPELL_HAVE_PULVERIZED_GARGOYLE_TEETH,
+ SPELL_FETCH_MUDDY_MIRE_MAGGOT, SPELL_HAVE_MUDDY_MIRE_MAGGOT,
+ SPELL_FETCH_SPIKY_SPIDER_EGG, SPELL_HAVE_SPIKY_SPIDER_EGG,
+ SPELL_FETCH_HAIRY_HERRING_HEAD, SPELL_HAVE_HAIRY_HERRING_HEAD,
+ SPELL_FETCH_PUTRID_PIRATE_PERSPIRATION, SPELL_HAVE_PUTRID_PIRATE_PERSPIRATION,
+ SPELL_FETCH_ICECROWN_BOTTLED_WATER, SPELL_HAVE_ICECROWN_BOTTLED_WATER,
+ SPELL_FETCH_WASPS_WINGS, SPELL_HAVE_WASPS_WINGS,
+ SPELL_FETCH_PRISMATIC_MOJO, SPELL_HAVE_PRISMATIC_MOJO,
+ SPELL_FETCH_RAPTOR_CLAW, SPELL_HAVE_RAPTOR_CLAW,
+ SPELL_FETCH_AMBERSEED, SPELL_HAVE_AMBERSEED,
+ SPELL_FETCH_SHRUNKEN_DRAGONS_CLAW, SPELL_HAVE_SHRUNKEN_DRAGONS_CLAW,
+ SPELL_FETCH_CHILLED_SERPENT_MUCUS, SPELL_HAVE_CHILLED_SERPENT_MUCUS,
+ SPELL_FETCH_CRYSTALLIZED_HOGSNOT, SPELL_HAVE_CRYSTALLIZED_HOGSNOT,
+ SPELL_FETCH_CRUSHED_BASILISK_CRYSTALS, SPELL_HAVE_CRUSHED_BASILISK_CRYSTALS,
+ SPELL_FETCH_TROLLBANE, SPELL_HAVE_TROLLBANE,
+ SPELL_FETCH_FROZEN_SPIDER_ICHOR, SPELL_HAVE_FROZEN_SPIDER_ICHOR
+ });
}
void HandleScriptEffect(SpellEffIndex /* effIndex */)
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp
index 9283b870a71..0ed60fc8956 100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp
@@ -15,14 +15,11 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "MapManager.h"
#include "ScriptMgr.h"
+#include "GameObject.h"
+#include "MapManager.h"
#include "OutdoorPvPHP.h"
-#include "OutdoorPvP.h"
-#include "OutdoorPvPMgr.h"
#include "Player.h"
-#include "ObjectMgr.h"
-#include "WorldPacket.h"
#include "WorldStatePackets.h"
const uint32 HP_LANG_CAPTURE_A[HP_TOWER_NUM] = { TEXT_BROKEN_HILL_TAKEN_ALLIANCE, TEXT_OVERLOOK_TAKEN_ALLIANCE, TEXT_STADIUM_TAKEN_ALLIANCE };
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp
index 6f821514bb4..997ef36406b 100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp
@@ -15,13 +15,12 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "MapManager.h"
#include "ScriptMgr.h"
+#include "Creature.h"
+#include "MapManager.h"
+#include "ObjectMgr.h"
#include "OutdoorPvPNA.h"
#include "Player.h"
-#include "ObjectMgr.h"
-#include "OutdoorPvPMgr.h"
-#include "WorldPacket.h"
#include "WorldStatePackets.h"
OutdoorPvPNA::OutdoorPvPNA()
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp
index efceec2482e..07dfe8f00f8 100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp
@@ -16,15 +16,13 @@
*/
#include "ScriptMgr.h"
-#include "OutdoorPvPSI.h"
-#include "WorldPacket.h"
-#include "Player.h"
+#include "DB2Stores.h"
#include "GameObject.h"
-#include "MapManager.h"
+#include "Language.h"
#include "ObjectMgr.h"
-#include "OutdoorPvPMgr.h"
+#include "OutdoorPvPSI.h"
+#include "Player.h"
#include "ReputationMgr.h"
-#include "Language.h"
#include "World.h"
#include "WorldStatePackets.h"
@@ -164,7 +162,7 @@ bool OutdoorPvPSI::HandleDropFlag(Player* player, uint32 spellId)
GameObject* go = new GameObject;
Map* map = player->GetMap();
- if (!go->Create(SI_SILITHYST_MOUND, map, player->GetPhaseMask(), *player, G3D::Quat(), 255, GO_STATE_READY))
+ if (!go->Create(SI_SILITHYST_MOUND, map, player->GetPhaseMask(), *player, QuaternionData(), 255, GO_STATE_READY))
{
delete go;
return true;
@@ -195,7 +193,7 @@ bool OutdoorPvPSI::HandleDropFlag(Player* player, uint32 spellId)
GameObject* go = new GameObject;
Map* map = player->GetMap();
- if (!go->Create(SI_SILITHYST_MOUND, map, player->GetPhaseMask(), *player, G3D::Quat(), 255, GO_STATE_READY))
+ if (!go->Create(SI_SILITHYST_MOUND, map, player->GetPhaseMask(), *player, QuaternionData(), 255, GO_STATE_READY))
{
delete go;
return true;
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp
index c273e3c26db..2a7170ec2b5 100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp
@@ -15,14 +15,12 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "MapManager.h"
#include "ScriptMgr.h"
+#include "GameObject.h"
+#include "MapManager.h"
+#include "ObjectAccessor.h"
#include "OutdoorPvPTF.h"
-#include "OutdoorPvPMgr.h"
-#include "OutdoorPvP.h"
-#include "WorldPacket.h"
#include "Player.h"
-#include "ObjectMgr.h"
#include "WorldStatePackets.h"
OutdoorPvPTF::OutdoorPvPTF()
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp
index b6841462139..86ce65369f9 100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp
@@ -15,16 +15,13 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "MapManager.h"
#include "ScriptMgr.h"
-#include "OutdoorPvPZM.h"
-#include "ObjectMgr.h"
-#include "OutdoorPvPMgr.h"
-#include "Player.h"
#include "Creature.h"
-#include "ObjectAccessor.h"
-#include "WorldPacket.h"
#include "GossipDef.h"
+#include "ObjectAccessor.h"
+#include "ObjectMgr.h"
+#include "OutdoorPvPZM.h"
+#include "Player.h"
#include "WorldStatePackets.h"
OPvPCapturePointZM_Beacon::OPvPCapturePointZM_Beacon(OutdoorPvP* pvp, ZM_BeaconType type)
diff --git a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/auchenai_crypts.h b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/auchenai_crypts.h
index 18354890ba9..38aaf35ccf6 100644
--- a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/auchenai_crypts.h
+++ b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/auchenai_crypts.h
@@ -18,6 +18,8 @@
#ifndef AUCHENAI_CRYPTS_H_
#define AUCHENAI_CRYPTS_H_
+#include "CreatureAIImpl.h"
+
#define ACScriptName "instance_auchenai_crypts"
#define DataHeader "AC"
@@ -30,8 +32,8 @@ enum ACDataTypes
DATA_EXARCH_MALADAAR = 1
};
-template<class AI>
-AI* GetAuchenaiCryptsAI(Creature* creature)
+template<typename AI>
+inline AI* GetAuchenaiCryptsAI(Creature* creature)
{
return GetInstanceAI<AI>(creature, ACScriptName);
}
diff --git a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp
index 93d5ce2f556..3d5d7c370dd 100644
--- a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp
+++ b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp
@@ -30,6 +30,8 @@ npc_avatar_of_martyred
EndContentData */
#include "ScriptMgr.h"
+#include "auchenai_crypts.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
enum Spells
@@ -56,7 +58,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_stolen_soulAI(creature);
+ return GetAuchenaiCryptsAI<npc_stolen_soulAI>(creature);
}
struct npc_stolen_soulAI : public ScriptedAI
@@ -163,7 +165,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_exarch_maladaarAI(creature);
+ return GetAuchenaiCryptsAI<boss_exarch_maladaarAI>(creature);
}
struct boss_exarch_maladaarAI : public ScriptedAI
@@ -319,7 +321,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_avatar_of_martyredAI(creature);
+ return GetAuchenaiCryptsAI<npc_avatar_of_martyredAI>(creature);
}
struct npc_avatar_of_martyredAI : public ScriptedAI
diff --git a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp
index 9e4151c808b..93649481db7 100644
--- a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp
+++ b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp
@@ -24,8 +24,11 @@ Category: Auchindoun, Auchenai Crypts
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "auchenai_crypts.h"
+#include "Map.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "ScriptedCreature.h"
enum Spells
{
diff --git a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/instance_auchenai_crypts.cpp b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/instance_auchenai_crypts.cpp
index 9655b20b551..4f88489923c 100644
--- a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/instance_auchenai_crypts.cpp
+++ b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/instance_auchenai_crypts.cpp
@@ -16,8 +16,9 @@
*/
#include "ScriptMgr.h"
-#include "InstanceScript.h"
#include "auchenai_crypts.h"
+#include "InstanceScript.h"
+#include "Map.h"
class instance_auchenai_crypts : public InstanceMapScript
{
diff --git a/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp b/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp
index 7917d40b8f7..e93c0baba2a 100644
--- a/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp
+++ b/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp
@@ -23,8 +23,8 @@ SDCategory: Auchindoun, Mana Tombs
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "mana_tombs.h"
+#include "ScriptedCreature.h"
enum Yells
{
@@ -259,7 +259,7 @@ class npc_ethereal_beacon : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_ethereal_beaconAI(creature);
+ return GetManaTombsAI<npc_ethereal_beaconAI>(creature);
}
};
@@ -324,7 +324,7 @@ class npc_ethereal_apprentice : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_ethereal_apprenticeAI(creature);
+ return GetManaTombsAI<npc_ethereal_apprenticeAI>(creature);
}
};
@@ -380,7 +380,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_yorAI(creature);
+ return GetManaTombsAI<npc_yorAI>(creature);
}
};
diff --git a/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_pandemonius.cpp b/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_pandemonius.cpp
index 0b0dd616311..aa24fbc3e03 100644
--- a/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_pandemonius.cpp
+++ b/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_pandemonius.cpp
@@ -16,8 +16,8 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "mana_tombs.h"
+#include "ScriptedCreature.h"
enum Texts
{
diff --git a/src/server/scripts/Outland/Auchindoun/ManaTombs/instance_mana_tombs.cpp b/src/server/scripts/Outland/Auchindoun/ManaTombs/instance_mana_tombs.cpp
index 7f388b198ae..8ab7c798194 100644
--- a/src/server/scripts/Outland/Auchindoun/ManaTombs/instance_mana_tombs.cpp
+++ b/src/server/scripts/Outland/Auchindoun/ManaTombs/instance_mana_tombs.cpp
@@ -18,6 +18,7 @@
#include "ScriptMgr.h"
#include "InstanceScript.h"
#include "mana_tombs.h"
+#include "Map.h"
class instance_mana_tombs : public InstanceMapScript
{
diff --git a/src/server/scripts/Outland/Auchindoun/ManaTombs/mana_tombs.h b/src/server/scripts/Outland/Auchindoun/ManaTombs/mana_tombs.h
index 707eb89ef9b..5734498cbde 100644
--- a/src/server/scripts/Outland/Auchindoun/ManaTombs/mana_tombs.h
+++ b/src/server/scripts/Outland/Auchindoun/ManaTombs/mana_tombs.h
@@ -18,6 +18,8 @@
#ifndef MANA_TOMBS_H_
#define MANA_TOMBS_H_
+#include "CreatureAIImpl.h"
+
#define MTScriptName "instance_mana_tombs"
#define DataHeader "MT"
@@ -32,8 +34,8 @@ enum MTDataTypes
DATA_YOR = 3
};
-template<class AI>
-AI* GetManaTombsAI(Creature* creature)
+template<typename AI>
+inline AI* GetManaTombsAI(Creature* creature)
{
return GetInstanceAI<AI>(creature, MTScriptName);
}
diff --git a/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_darkweaver_syth.cpp b/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_darkweaver_syth.cpp
index f0bc7a3b537..91a4efc3c62 100644
--- a/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_darkweaver_syth.cpp
+++ b/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_darkweaver_syth.cpp
@@ -257,7 +257,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_syth_fireAI(creature);
+ return GetSethekkHallsAI<npc_syth_fireAI>(creature);
}
};
@@ -316,7 +316,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_syth_arcaneAI(creature);
+ return GetSethekkHallsAI<npc_syth_arcaneAI>(creature);
}
};
@@ -375,7 +375,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_syth_frostAI(creature);
+ return GetSethekkHallsAI<npc_syth_frostAI>(creature);
}
};
@@ -434,7 +434,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_syth_shadowAI(creature);
+ return GetSethekkHallsAI<npc_syth_shadowAI>(creature);
}
};
diff --git a/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_talon_king_ikiss.cpp b/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_talon_king_ikiss.cpp
index 369bce2457e..e51fefab2bb 100644
--- a/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_talon_king_ikiss.cpp
+++ b/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_talon_king_ikiss.cpp
@@ -17,8 +17,8 @@
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
-#include "SpellScript.h"
#include "sethekk_halls.h"
+#include "SpellScript.h"
enum Says
{
@@ -173,9 +173,7 @@ class spell_talon_king_ikiss_blink : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_BLINK_TELEPORT))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_BLINK_TELEPORT });
}
void FilterTargets(std::list<WorldObject*>& targets)
diff --git a/src/server/scripts/Outland/Auchindoun/SethekkHalls/instance_sethekk_halls.cpp b/src/server/scripts/Outland/Auchindoun/SethekkHalls/instance_sethekk_halls.cpp
index 31f874dcb61..b0d6eaab86b 100644
--- a/src/server/scripts/Outland/Auchindoun/SethekkHalls/instance_sethekk_halls.cpp
+++ b/src/server/scripts/Outland/Auchindoun/SethekkHalls/instance_sethekk_halls.cpp
@@ -16,7 +16,10 @@
*/
#include "ScriptMgr.h"
+#include "Creature.h"
+#include "GameObject.h"
#include "InstanceScript.h"
+#include "Map.h"
#include "sethekk_halls.h"
DoorData const doorData[] =
diff --git a/src/server/scripts/Outland/Auchindoun/SethekkHalls/sethekk_halls.h b/src/server/scripts/Outland/Auchindoun/SethekkHalls/sethekk_halls.h
index 3471b23daa2..266c8025701 100644
--- a/src/server/scripts/Outland/Auchindoun/SethekkHalls/sethekk_halls.h
+++ b/src/server/scripts/Outland/Auchindoun/SethekkHalls/sethekk_halls.h
@@ -18,6 +18,8 @@
#ifndef SETHEKK_HALLS_H_
#define SETHEKK_HALLS_H_
+#include "CreatureAIImpl.h"
+
#define SHScriptName "instance_sethekk_halls"
#define DataHeader "SH"
@@ -46,8 +48,8 @@ enum SHGameObjectIds
GO_TALON_KING_COFFER = 187372
};
-template<class AI>
-AI* GetSethekkHallsAI(Creature* creature)
+template<typename AI>
+inline AI* GetSethekkHallsAI(Creature* creature)
{
return GetInstanceAI<AI>(creature, SHScriptName);
}
diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp
index 976f95cfd90..43d90a1c70a 100644
--- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp
+++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp
@@ -24,7 +24,7 @@ SDCategory: Auchindoun, Shadow Labyrinth
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "InstanceScript.h"
#include "ScriptedEscortAI.h"
#include "shadow_labyrinth.h"
diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_blackheart_the_inciter.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_blackheart_the_inciter.cpp
index fa3978840c9..f0a47bd8604 100644
--- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_blackheart_the_inciter.cpp
+++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_blackheart_the_inciter.cpp
@@ -24,6 +24,7 @@ Category: Auchindoun, Shadow Labyrinth
*/
#include "ScriptMgr.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
#include "shadow_labyrinth.h"
diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp
index 0d59d301a5a..6f2563eb82e 100644
--- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp
+++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp
@@ -23,9 +23,13 @@ Category: Auchindoun, Shadow Labyrinth
*/
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptedCreature.h"
#include "shadow_labyrinth.h"
-#include "Player.h"
+#include "TemporarySummon.h"
enum GrandmasterVorpil
{
diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp
index ac9ef77cd82..73fb65992d3 100644
--- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp
+++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp
@@ -24,9 +24,10 @@ SDCategory: Auchindoun, Shadow Labyrinth
EndScriptData */
#include "ScriptMgr.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
-#include "SpellScript.h"
#include "shadow_labyrinth.h"
+#include "SpellScript.h"
enum Murmur
{
@@ -188,9 +189,7 @@ class spell_murmur_sonic_boom : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SONIC_BOOM_EFFECT))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SONIC_BOOM_EFFECT });
}
void HandleEffect(SpellEffIndex /*effIndex*/)
diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp
index 0e75d609195..c5ddb8e6b50 100644
--- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp
+++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp
@@ -16,8 +16,11 @@
*/
#include "ScriptMgr.h"
+#include "Creature.h"
+#include "CreatureAI.h"
+#include "GameObject.h"
#include "InstanceScript.h"
-#include "ScriptedCreature.h"
+#include "Map.h"
#include "shadow_labyrinth.h"
DoorData const doorData[] =
diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/shadow_labyrinth.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/shadow_labyrinth.cpp
index 168a92640ed..8ec7dce4c15 100644
--- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/shadow_labyrinth.cpp
+++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/shadow_labyrinth.cpp
@@ -16,9 +16,8 @@
*/
#include "ScriptMgr.h"
-#include "SpellMgr.h"
#include "SpellScript.h"
-#include "SpellAuraEffects.h"
+#include "Unit.h"
enum Spells
{
@@ -36,16 +35,14 @@ class spell_mark_of_malice : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_MARK_OF_MALICE_TRIGGERED))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_MARK_OF_MALICE_TRIGGERED });
}
- void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/)
+ void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& /*eventInfo*/)
{
PreventDefaultAction();
// just drop charges
- if (aurEff->GetBase()->GetCharges() > 1)
+ if (GetCharges() > 1)
return;
GetTarget()->CastSpell(GetTarget(), SPELL_MARK_OF_MALICE_TRIGGERED, true);
diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/shadow_labyrinth.h b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/shadow_labyrinth.h
index 0558c5e3fa3..6ac8ee4f2bd 100644
--- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/shadow_labyrinth.h
+++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/shadow_labyrinth.h
@@ -18,6 +18,8 @@
#ifndef SHADOW_LABYRINTH_H_
#define SHADOW_LABYRINTH_H_
+#include "CreatureAIImpl.h"
+
#define SLScriptName "instance_shadow_labyrinth"
#define DataHeader "SL"
@@ -54,8 +56,8 @@ enum SLMisc
ACTION_AMBASSADOR_HELLMAW_BANISH = 2,
};
-template<class AI>
-AI* GetShadowLabyrinthAI(Creature* creature)
+template<typename AI>
+inline AI* GetShadowLabyrinthAI(Creature* creature)
{
return GetInstanceAI<AI>(creature, SLScriptName);
}
diff --git a/src/server/scripts/Outland/BlackTemple/black_temple.cpp b/src/server/scripts/Outland/BlackTemple/black_temple.cpp
index df11cb2aadc..0c33325b4e5 100644
--- a/src/server/scripts/Outland/BlackTemple/black_temple.cpp
+++ b/src/server/scripts/Outland/BlackTemple/black_temple.cpp
@@ -16,8 +16,9 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "black_temple.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
enum Spells
{
diff --git a/src/server/scripts/Outland/BlackTemple/black_temple.h b/src/server/scripts/Outland/BlackTemple/black_temple.h
index e5d76475e03..48987283711 100644
--- a/src/server/scripts/Outland/BlackTemple/black_temple.h
+++ b/src/server/scripts/Outland/BlackTemple/black_temple.h
@@ -18,7 +18,7 @@
#ifndef BLACK_TEMPLE_H_
#define BLACK_TEMPLE_H_
-#include "InstanceScript.h"
+#include "CreatureAIImpl.h"
#define BTScriptName "instance_black_temple"
#define DataHeader "BT"
@@ -91,8 +91,8 @@ enum BTGameObjectIds
GO_ILLIDAN_DOOR_L = 186262
};
-template<class AI>
-AI* GetBlackTempleAI(Creature* creature)
+template<typename AI>
+inline AI* GetBlackTempleAI(Creature* creature)
{
return GetInstanceAI<AI>(creature, BTScriptName);
}
diff --git a/src/server/scripts/Outland/BlackTemple/boss_gurtogg_bloodboil.cpp b/src/server/scripts/Outland/BlackTemple/boss_gurtogg_bloodboil.cpp
index 89d6d73a808..ee422c5acd1 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_gurtogg_bloodboil.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_gurtogg_bloodboil.cpp
@@ -23,9 +23,10 @@ Category: Black Temple
EndScriptData */
#include "ScriptMgr.h"
+#include "black_temple.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
-#include "black_temple.h"
enum Bloodboil
{
@@ -61,7 +62,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_gurtogg_bloodboilAI>(creature);
+ return GetBlackTempleAI<boss_gurtogg_bloodboilAI>(creature);
}
struct boss_gurtogg_bloodboilAI : public BossAI
diff --git a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp
index 03a73e0a1cf..25905514ad7 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp
@@ -25,12 +25,15 @@ EndScriptData */
#include "ScriptMgr.h"
#include "black_temple.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
#include "Log.h"
+#include "ObjectAccessor.h"
#include "PassiveAI.h"
-#include "Player.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
#include "SpellInfo.h"
+#include "TemporarySummon.h"
// Other defines
#define CENTER_X 676.740f
@@ -464,7 +467,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new flame_of_azzinothAI(creature);
+ return GetBlackTempleAI<flame_of_azzinothAI>(creature);
}
};
@@ -1141,7 +1144,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_illidan_stormrageAI>(creature);
+ return GetBlackTempleAI<boss_illidan_stormrageAI>(creature);
}
};
@@ -1372,7 +1375,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_maievAI(creature);
+ return GetBlackTempleAI<boss_maievAI>(creature);
}
};
@@ -1805,7 +1808,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_akama_illidanAI>(creature);
+ return GetBlackTempleAI<npc_akama_illidanAI>(creature);
}
};
@@ -2048,7 +2051,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new cage_trap_triggerAI(creature);
+ return GetBlackTempleAI<cage_trap_triggerAI>(creature);
}
};
@@ -2059,9 +2062,6 @@ public:
bool OnGossipHello(Player* player, GameObject* go) override
{
- float x, y, z;
- player->GetPosition(x, y, z);
-
// Grid search for nearest live Creature of entry 23304 within 10 yards
if (Creature* pTrigger = go->FindNearestCreature(23304, 10.0f))
ENSURE_AI(npc_cage_trap_trigger::cage_trap_triggerAI, pTrigger->AI())->Active = true;
@@ -2122,7 +2122,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new shadow_demonAI(creature);
+ return GetBlackTempleAI<shadow_demonAI>(creature);
}
};
@@ -2144,7 +2144,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new blade_of_azzinothAI(creature);
+ return GetBlackTempleAI<blade_of_azzinothAI>(creature);
}
};
@@ -2234,7 +2234,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_parasitic_shadowfiendAI>(creature);
+ return GetBlackTempleAI<npc_parasitic_shadowfiendAI>(creature);
}
};
diff --git a/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp b/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp
index a183b03d650..665eda75aed 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp
@@ -23,8 +23,9 @@ SDCategory: Black Temple
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "black_temple.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
enum Texts
{
diff --git a/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp b/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp
index 461c4c0f66e..76d57cf2e16 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp
@@ -87,7 +87,7 @@ enum ReliquaryOfSouls
NUMBER_ENSLAVED_SOUL = 8
};
-G3D::Vector2 const Coords[]=
+Position const Coords[]=
{
{450.4f, 212.3f},
{542.1f, 212.3f},
@@ -104,7 +104,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_enslaved_soulAI(creature);
+ return GetBlackTempleAI<npc_enslaved_soulAI>(creature);
}
struct npc_enslaved_soulAI : public ScriptedAI
@@ -135,7 +135,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_reliquary_of_soulsAI>(creature);
+ return GetBlackTempleAI<boss_reliquary_of_soulsAI>(creature);
}
struct boss_reliquary_of_soulsAI : public BossAI
@@ -211,11 +211,8 @@ public:
bool SummonSoul()
{
- uint32 random = rand32() % 6;
- float x = Coords[random].x;
- float y = Coords[random].y;
-
- Creature* Soul = me->SummonCreature(CREATURE_ENSLAVED_SOUL, x, y, me->GetPositionZ(), me->GetOrientation(), TEMPSUMMON_CORPSE_DESPAWN, 0);
+ Position const& pos = Trinity::Containers::SelectRandomContainerElement(Coords);
+ Creature* Soul = me->SummonCreature(CREATURE_ENSLAVED_SOUL, pos.GetPositionX(), pos.GetPositionY(), me->GetPositionZ(), me->GetOrientation(), TEMPSUMMON_CORPSE_DESPAWN, 0);
if (!Soul)
return false;
@@ -390,7 +387,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_essence_of_sufferingAI(creature);
+ return GetBlackTempleAI<boss_essence_of_sufferingAI>(creature);
}
struct boss_essence_of_sufferingAI : public ScriptedAI
@@ -517,7 +514,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_essence_of_desireAI(creature);
+ return GetBlackTempleAI<boss_essence_of_desireAI>(creature);
}
struct boss_essence_of_desireAI : public ScriptedAI
@@ -628,7 +625,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_essence_of_angerAI(creature);
+ return GetBlackTempleAI<boss_essence_of_angerAI>(creature);
}
struct boss_essence_of_angerAI : public ScriptedAI
diff --git a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp
index e2fee8d3b73..d4978d249ec 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp
@@ -15,15 +15,19 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ObjectMgr.h"
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "black_temple.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "ObjectAccessor.h"
#include "PassiveAI.h"
+#include "Player.h"
+#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
-#include "GridNotifiers.h"
-#include "black_temple.h"
-#include "SpellScript.h"
#include "SpellAuraEffects.h"
+#include "SpellInfo.h"
+#include "SpellScript.h"
+#include "TemporarySummon.h"
enum Says
{
@@ -351,7 +355,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_shade_of_akamaAI>(creature);
+ return GetBlackTempleAI<boss_shade_of_akamaAI>(creature);
}
};
@@ -567,7 +571,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_akamaAI>(creature);
+ return GetBlackTempleAI<npc_akamaAI>(creature);
}
};
@@ -613,7 +617,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_ashtongue_channelerAI>(creature);
+ return GetBlackTempleAI<npc_ashtongue_channelerAI>(creature);
}
};
@@ -711,7 +715,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_creature_generator_akamaAI>(creature);
+ return GetBlackTempleAI<npc_creature_generator_akamaAI>(creature);
}
};
@@ -819,7 +823,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_ashtongue_sorcererAI>(creature);
+ return GetBlackTempleAI<npc_ashtongue_sorcererAI>(creature);
}
};
@@ -897,7 +901,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_ashtongue_defenderAI>(creature);
+ return GetBlackTempleAI<npc_ashtongue_defenderAI>(creature);
}
};
@@ -966,7 +970,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_ashtongue_rogueAI>(creature);
+ return GetBlackTempleAI<npc_ashtongue_rogueAI>(creature);
}
};
@@ -1035,7 +1039,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_ashtongue_elementalistAI>(creature);
+ return GetBlackTempleAI<npc_ashtongue_elementalistAI>(creature);
}
};
@@ -1136,7 +1140,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_ashtongue_spiritbinderAI>(creature);
+ return GetBlackTempleAI<npc_ashtongue_spiritbinderAI>(creature);
}
};
@@ -1187,7 +1191,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_ashtongue_brokenAI>(creature);
+ return GetBlackTempleAI<npc_ashtongue_brokenAI>(creature);
}
};
@@ -1202,9 +1206,7 @@ public:
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SHADE_SOUL_CHANNEL_2))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SHADE_SOUL_CHANNEL_2 });
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
diff --git a/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp b/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp
index 32449016b28..425d63c0287 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp
@@ -16,9 +16,10 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "PassiveAI.h"
#include "black_temple.h"
+#include "ObjectAccessor.h"
+#include "PassiveAI.h"
+#include "ScriptedCreature.h"
enum Texts
{
@@ -65,7 +66,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new molten_flameAI(creature);
+ return GetBlackTempleAI<molten_flameAI>(creature);
}
struct molten_flameAI : public NullCreatureAI
@@ -264,7 +265,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_volcanoAI(creature);
+ return GetBlackTempleAI<npc_volcanoAI>(creature);
}
};
diff --git a/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp b/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp
index 2a1b9e49ff2..d8cd53916ae 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp
@@ -24,8 +24,11 @@ SDCategory: Black Temple
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "black_temple.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
+#include "TemporarySummon.h"
enum DoomBlossom
{
@@ -58,7 +61,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_doom_blossomAI(creature);
+ return GetBlackTempleAI<npc_doom_blossomAI>(creature);
}
struct npc_doom_blossomAI : public ScriptedAI
@@ -135,7 +138,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_shadowy_constructAI(creature);
+ return GetBlackTempleAI<npc_shadowy_constructAI>(creature);
}
struct npc_shadowy_constructAI : public ScriptedAI
@@ -233,7 +236,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_teron_gorefiendAI>(creature);
+ return GetBlackTempleAI<boss_teron_gorefiendAI>(creature);
}
struct boss_teron_gorefiendAI : public BossAI
@@ -449,7 +452,7 @@ public:
float X = CalculateRandomLocation(target->GetPositionX(), 20);
float Y = CalculateRandomLocation(target->GetPositionY(), 20);
float Z = target->GetPositionZ();
- Z = me->GetMap()->GetHeight(me->GetPhases(), X, Y, Z);
+ me->UpdateGroundPositionZ(X, Y, Z);
Creature* DoomBlossom = me->SummonCreature(CREATURE_DOOM_BLOSSOM, X, Y, Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 20000);
if (DoomBlossom)
{
diff --git a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp
index af64f991b24..585a19a05ea 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp
@@ -16,9 +16,12 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "black_temple.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "ScriptedCreature.h"
#include "SpellInfo.h"
enum Texts
@@ -150,7 +153,7 @@ public:
DoCast(target, SPELL_IMPALING_SPINE, true);
SpineTargetGUID = target->GetGUID();
//must let target summon, otherwise you cannot click the spine
- target->SummonGameObject(GO_NAJENTUS_SPINE, *target, G3D::Quat(), 30);
+ target->SummonGameObject(GO_NAJENTUS_SPINE, *target, QuaternionData(), 30);
Talk(SAY_NEEDLE);
events.DelayEvents(1500, GCD_CAST);
events.DelayEvents(15000, GCD_YELL);
diff --git a/src/server/scripts/Outland/BlackTemple/illidari_council.cpp b/src/server/scripts/Outland/BlackTemple/illidari_council.cpp
index 500ea991238..b3685b3af0a 100644
--- a/src/server/scripts/Outland/BlackTemple/illidari_council.cpp
+++ b/src/server/scripts/Outland/BlackTemple/illidari_council.cpp
@@ -24,10 +24,11 @@ SDCategory: Black Temple
EndScriptData */
#include "ScriptMgr.h"
+#include "black_temple.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
-#include "SpellAuraEffects.h"
-#include "black_temple.h"
enum IllidariCouncil
{
@@ -120,7 +121,7 @@ public:
CreatureAI* GetAI(Creature* c) const override
{
- return new npc_blood_elf_council_voice_triggerAI(c);
+ return GetBlackTempleAI<npc_blood_elf_council_voice_triggerAI>(c);
}
struct npc_blood_elf_council_voice_triggerAI : public ScriptedAI
@@ -220,7 +221,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_illidari_councilAI>(creature);
+ return GetBlackTempleAI<npc_illidari_councilAI>(creature);
}
struct npc_illidari_councilAI : public ScriptedAI
@@ -456,7 +457,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_gathios_the_shattererAI>(creature);
+ return GetBlackTempleAI<boss_gathios_the_shattererAI>(creature);
}
struct boss_gathios_the_shattererAI : public boss_illidari_councilAI
@@ -596,7 +597,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_high_nethermancer_zerevorAI>(creature);
+ return GetBlackTempleAI<boss_high_nethermancer_zerevorAI>(creature);
}
struct boss_high_nethermancer_zerevorAI : public boss_illidari_councilAI
@@ -708,7 +709,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_lady_malandeAI>(creature);
+ return GetBlackTempleAI<boss_lady_malandeAI>(creature);
}
struct boss_lady_malandeAI : public boss_illidari_councilAI
@@ -794,7 +795,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_veras_darkshadowAI>(creature);
+ return GetBlackTempleAI<boss_veras_darkshadowAI>(creature);
}
struct boss_veras_darkshadowAI : public boss_illidari_councilAI
@@ -912,7 +913,7 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- return sSpellMgr->GetSpellInfo(SPELL_REFLECTIVE_SHIELD_T) != nullptr;
+ return ValidateSpellInfo({ SPELL_REFLECTIVE_SHIELD_T });
}
void Trigger(AuraEffect* aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount)
diff --git a/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp b/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp
index 1db95c31478..2e734702b7d 100644
--- a/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp
+++ b/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp
@@ -16,8 +16,12 @@
*/
#include "ScriptMgr.h"
-#include "InstanceScript.h"
+#include "AreaBoundary.h"
#include "black_temple.h"
+#include "Creature.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "Map.h"
DoorData const doorData[] =
{
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp
index 6ed5abef4c2..8d31ebe63e5 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp
@@ -24,9 +24,11 @@ SDCategory: Coilfang Resevoir, Serpent Shrine Cavern
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "serpent_shrine.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
#include "ScriptedEscortAI.h"
+#include "serpent_shrine.h"
+#include "TemporarySummon.h"
enum FathomlordKarathress
{
@@ -104,7 +106,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_fathomlord_karathressAI>(creature);
+ return GetSerpentshrineCavernAI<boss_fathomlord_karathressAI>(creature);
}
struct boss_fathomlord_karathressAI : public ScriptedAI
@@ -308,7 +310,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_fathomguard_sharkkisAI>(creature);
+ return GetSerpentshrineCavernAI<boss_fathomguard_sharkkisAI>(creature);
}
struct boss_fathomguard_sharkkisAI : public ScriptedAI
@@ -452,7 +454,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_fathomguard_tidalvessAI>(creature);
+ return GetSerpentshrineCavernAI<boss_fathomguard_tidalvessAI>(creature);
}
struct boss_fathomguard_tidalvessAI : public ScriptedAI
@@ -574,7 +576,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_fathomguard_caribdisAI>(creature);
+ return GetSerpentshrineCavernAI<boss_fathomguard_caribdisAI>(creature);
}
struct boss_fathomguard_caribdisAI : public ScriptedAI
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp
index 0bce78607d3..341ef499e8f 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp
@@ -24,8 +24,11 @@ SDCategory: Coilfang Resevoir, Serpent Shrine Cavern
EndScriptData */
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
#include "serpent_shrine.h"
+#include "TemporarySummon.h"
enum HydrossTheUnstable
{
@@ -86,7 +89,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_hydross_the_unstableAI>(creature);
+ return GetSerpentshrineCavernAI<boss_hydross_the_unstableAI>(creature);
}
struct boss_hydross_the_unstableAI : public ScriptedAI
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp
index 06bf51ce115..7cb504351cf 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp
@@ -24,11 +24,15 @@ SDCategory: Coilfang Resevoir, Serpent Shrine Cavern
EndScriptData */
#include "ScriptMgr.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptedCreature.h"
-#include "serpent_shrine.h"
#include "Spell.h"
-#include "Player.h"
-#include "WorldSession.h"
+#include "serpent_shrine.h"
+#include "TemporarySummon.h"
enum LadyVashj
{
@@ -70,11 +74,6 @@ enum LadyVashj
#define SPOREBAT_Z 77.176567f
#define SPOREBAT_O 5.223932f
-
-
-#define TEXT_NOT_INITIALIZED "Instance script not initialized"
-#define TEXT_ALREADY_DEACTIVATED "Already deactivated"
-
float ElementPos[8][4] =
{
{8.3f, -835.3f, 21.9f, 5.0f},
@@ -140,7 +139,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_lady_vashjAI>(creature);
+ return GetSerpentshrineCavernAI<boss_lady_vashjAI>(creature);
}
struct boss_lady_vashjAI : public ScriptedAI
@@ -555,7 +554,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_enchanted_elementalAI>(creature);
+ return GetSerpentshrineCavernAI<npc_enchanted_elementalAI>(creature);
}
struct npc_enchanted_elementalAI : public ScriptedAI
@@ -650,7 +649,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_tainted_elementalAI>(creature);
+ return GetSerpentshrineCavernAI<npc_tainted_elementalAI>(creature);
}
struct npc_tainted_elementalAI : public ScriptedAI
@@ -724,7 +723,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_toxic_sporebatAI>(creature);
+ return GetSerpentshrineCavernAI<npc_toxic_sporebatAI>(creature);
}
struct npc_toxic_sporebatAI : public ScriptedAI
@@ -826,7 +825,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_shield_generator_channelAI>(creature);
+ return GetSerpentshrineCavernAI<npc_shield_generator_channelAI>(creature);
}
struct npc_shield_generator_channelAI : public ScriptedAI
@@ -889,10 +888,7 @@ public:
{
InstanceScript* instance = player->GetInstanceScript();
if (!instance)
- {
- player->GetSession()->SendNotification(TEXT_NOT_INITIALIZED);
return true;
- }
Creature* vashj = ObjectAccessor::GetCreature((*player), instance->GetGuidData(DATA_LADYVASHJ));
if (vashj && (ENSURE_AI(boss_lady_vashj::boss_lady_vashjAI, vashj->AI())->Phase == 2))
@@ -924,10 +920,7 @@ public:
}
if (instance->GetData(identifier))
- {
- player->GetSession()->SendNotification(TEXT_ALREADY_DEACTIVATED);
return true;
- }
// get and remove channel
if (Unit* channel = ObjectAccessor::GetCreature(*vashj, ENSURE_AI(boss_lady_vashj::boss_lady_vashjAI, vashj->AI())->ShieldGeneratorChannel[channelIdentifier]))
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp
index 357756414db..d82bd4e38d1 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp
@@ -24,9 +24,13 @@ SDCategory: Coilfang Resevoir, Serpent Shrine Cavern
EndScriptData */
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptedCreature.h"
#include "serpent_shrine.h"
-#include "Player.h"
+#include "TemporarySummon.h"
enum LeotherasTheBlind
{
@@ -76,7 +80,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_inner_demonAI(creature);
+ return GetSerpentshrineCavernAI<npc_inner_demonAI>(creature);
}
struct npc_inner_demonAI : public ScriptedAI
@@ -186,7 +190,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_leotheras_the_blindAI>(creature);
+ return GetSerpentshrineCavernAI<boss_leotheras_the_blindAI>(creature);
}
struct boss_leotheras_the_blindAI : public ScriptedAI
@@ -607,7 +611,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_leotheras_the_blind_demonformAI(creature);
+ return GetSerpentshrineCavernAI<boss_leotheras_the_blind_demonformAI>(creature);
}
struct boss_leotheras_the_blind_demonformAI : public ScriptedAI
@@ -688,7 +692,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_greyheart_spellbinderAI>(creature);
+ return GetSerpentshrineCavernAI<npc_greyheart_spellbinderAI>(creature);
}
struct npc_greyheart_spellbinderAI : public ScriptedAI
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp
index 0d766785627..e2fd8409805 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp
@@ -24,10 +24,13 @@ SDCategory: The Lurker Below
EndScriptData */
#include "ScriptMgr.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "Player.h"
#include "ScriptedCreature.h"
#include "serpent_shrine.h"
-#include "Spell.h"
-#include "Player.h"
+#include "TemporarySummon.h"
enum Spells
{
@@ -83,7 +86,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_the_lurker_belowAI>(creature);
+ return GetSerpentshrineCavernAI<boss_the_lurker_belowAI>(creature);
}
struct boss_the_lurker_belowAI : public ScriptedAI
@@ -370,7 +373,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_coilfang_ambusherAI(creature);
+ return GetSerpentshrineCavernAI<npc_coilfang_ambusherAI>(creature);
}
struct npc_coilfang_ambusherAI : public ScriptedAI
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp
index 1d932a0f94a..142b0a5d65f 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp
@@ -24,8 +24,11 @@ SDCategory: Coilfang Resevoir, Serpent Shrine Cavern
EndScriptData */
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "Map.h"
#include "ScriptedCreature.h"
#include "serpent_shrine.h"
+#include "TemporarySummon.h"
enum Yells
{
@@ -91,7 +94,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_morogrim_tidewalkerAI>(creature);
+ return GetSerpentshrineCavernAI<boss_morogrim_tidewalkerAI>(creature);
}
struct boss_morogrim_tidewalkerAI : public ScriptedAI
@@ -296,7 +299,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_water_globuleAI(creature);
+ return GetSerpentshrineCavernAI<npc_water_globuleAI>(creature);
}
struct npc_water_globuleAI : public ScriptedAI
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp
index 0030b0ddbdd..71423926de0 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp
@@ -24,8 +24,10 @@ SDCategory: Coilfang Resevoir, Serpent Shrine Cavern
EndScriptData */
#include "ScriptMgr.h"
+#include "GameObject.h"
#include "InstanceScript.h"
#include "Log.h"
+#include "Map.h"
#include "Player.h"
#include "serpent_shrine.h"
#include "TemporarySummon.h"
@@ -82,7 +84,7 @@ class go_bridge_console : public GameObjectScript
class instance_serpent_shrine : public InstanceMapScript
{
public:
- instance_serpent_shrine() : InstanceMapScript("instance_serpent_shrine", 548) { }
+ instance_serpent_shrine() : InstanceMapScript(SSCScriptName, 548) { }
struct instance_serpentshrine_cavern_InstanceMapScript : public InstanceScript
{
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/serpent_shrine.h b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/serpent_shrine.h
index 2a37df0ef0f..5b2f5c02ff4 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/serpent_shrine.h
+++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/serpent_shrine.h
@@ -19,6 +19,9 @@
#ifndef DEF_SERPENT_SHRINE_H
#define DEF_SERPENT_SHRINE_H
+#include "CreatureAIImpl.h"
+
+#define SSCScriptName "instance_serpent_shrine"
#define DataHeader "SS"
enum SSWaterEventState
@@ -57,5 +60,10 @@ enum SSDataTypes
DATA_TRASH = 25,
};
-#endif
+template<typename AI>
+inline AI* GetSerpentshrineCavernAI(Creature* creature)
+{
+ return GetInstanceAI<AI>(creature, SSCScriptName);
+}
+#endif
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_hydromancer_thespia.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_hydromancer_thespia.cpp
index f7e9dff38bf..90d3800b965 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_hydromancer_thespia.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_hydromancer_thespia.cpp
@@ -114,7 +114,7 @@ class boss_hydromancer_thespia : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_thespiaAI>(creature);
+ return GetSteamVaultAI<boss_thespiaAI>(creature);
}
};
@@ -175,7 +175,7 @@ class npc_coilfang_waterelemental : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_coilfang_waterelementalAI(creature);
+ return GetSteamVaultAI<npc_coilfang_waterelementalAI>(creature);
}
};
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp
index bd13ab09a67..f0bbe51c31d 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp
@@ -23,6 +23,8 @@ SDCategory: Coilfang Resevoir, The Steamvault
EndScriptData */
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
#include "steam_vault.h"
@@ -57,7 +59,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_mekgineer_steamriggerAI>(creature);
+ return GetSteamVaultAI<boss_mekgineer_steamriggerAI>(creature);
}
struct boss_mekgineer_steamriggerAI : public ScriptedAI
@@ -200,7 +202,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_steamrigger_mechanicAI>(creature);
+ return GetSteamVaultAI<npc_steamrigger_mechanicAI>(creature);
}
struct npc_steamrigger_mechanicAI : public ScriptedAI
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp
index e0aaf89e25d..8071e8f25b6 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp
@@ -23,9 +23,10 @@ SDCategory: Coilfang Resevoir, The Steamvault
EndScriptData */
#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "ScriptedCreature.h"
-#include "steam_vault.h"
#include "SpellInfo.h"
+#include "steam_vault.h"
enum NagaDistiller
{
@@ -50,7 +51,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_naga_distillerAI>(creature);
+ return GetSteamVaultAI<npc_naga_distillerAI>(creature);
}
struct npc_naga_distillerAI : public ScriptedAI
@@ -103,7 +104,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_warlord_kalithreshAI>(creature);
+ return GetSteamVaultAI<boss_warlord_kalithreshAI>(creature);
}
struct boss_warlord_kalithreshAI : public ScriptedAI
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp
index b4b7d0f5fce..7c655082ba9 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp
@@ -16,8 +16,11 @@
*/
#include "ScriptMgr.h"
+#include "Creature.h"
+#include "GameObject.h"
#include "InstanceScript.h"
#include "Log.h"
+#include "Map.h"
#include "steam_vault.h"
class go_main_chambers_access_panel : public GameObjectScript
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/steam_vault.h b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/steam_vault.h
index 30f9f34a5da..d5eaf7d5396 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/steam_vault.h
+++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/steam_vault.h
@@ -18,6 +18,8 @@
#ifndef DEF_STEAM_VAULT_H
#define DEF_STEAM_VAULT_H
+#include "CreatureAIImpl.h"
+
#define SteamVaultScriptName "instance_steam_vault"
#define DataHeader "SV"
@@ -49,8 +51,8 @@ enum SVGameObjectIds
GO_ACCESS_PANEL_MEK = 184126
};
-template<class AI>
-AI* GetSteamVaultAI(Creature* creature)
+template<typename AI>
+inline AI* GetSteamVaultAI(Creature* creature)
{
return GetInstanceAI<AI>(creature, SteamVaultScriptName);
}
diff --git a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_ahune.cpp b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_ahune.cpp
index d2571e9d1d5..db5acbaa61b 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_ahune.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_ahune.cpp
@@ -15,13 +15,21 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "ScriptMgr.h"
#include "CreatureTextMgr.h"
+#include "GameObject.h"
+#include "Group.h"
+#include "InstanceScript.h"
#include "LFGMgr.h"
+#include "Map.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptedGossip.h"
#include "ScriptedCreature.h"
-#include "ScriptMgr.h"
#include "SpellAuraEffects.h"
+#include "SpellInfo.h"
#include "SpellScript.h"
+#include "TemporarySummon.h"
#include "the_slave_pens.h"
enum Spells
@@ -279,7 +287,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_ahuneAI>(creature);
+ return GetSlavePensAI<boss_ahuneAI>(creature);
}
};
@@ -357,7 +365,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_frozen_coreAI>(creature);
+ return GetSlavePensAI<npc_frozen_coreAI>(creature);
}
};
@@ -395,7 +403,7 @@ public:
_summons.DespawnAll();
ResetFlameCallers();
- me->SummonGameObject(GO_ICE_STONE, -69.90455f, -162.2449f, -2.366563f, 2.426008f, G3D::Quat(0.0f, 0.0f, 0.9366722f, 0.3502074f), 0);
+ me->SummonGameObject(GO_ICE_STONE, -69.90455f, -162.2449f, -2.366563f, 2.426008f, QuaternionData(0.0f, 0.0f, 0.9366722f, 0.3502074f), 0);
}
void DoAction(int32 action) override
@@ -509,7 +517,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_ahune_bunnyAI>(creature);
+ return GetSlavePensAI<npc_ahune_bunnyAI>(creature);
}
};
@@ -637,7 +645,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_earthen_ring_flamecallerAI>(creature);
+ return GetSlavePensAI<npc_earthen_ring_flamecallerAI>(creature);
}
};
@@ -680,9 +688,7 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SYNCH_HEALTH))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SYNCH_HEALTH });
}
void HandleScript(SpellEffIndex /*effIndex*/)
@@ -716,9 +722,7 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_FORCE_WHISP_FLIGHT) || !sSpellMgr->GetSpellInfo(SPELL_SUMMONING_RHYME_BONFIRE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_FORCE_WHISP_FLIGHT, SPELL_SUMMONING_RHYME_BONFIRE });
}
void PeriodicTick(AuraEffect const* aurEff)
@@ -771,9 +775,7 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_ICE_SPEAR_GO) || !sSpellMgr->GetSpellInfo(SPELL_ICE_SPEAR_KNOCKBACK))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SUMMON_ICE_SPEAR_GO, SPELL_ICE_SPEAR_KNOCKBACK });
}
void PeriodicTick(AuraEffect const* aurEff)
@@ -824,9 +826,7 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_ICE_SPEAR_TARGET_PICKER))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_ICE_SPEAR_TARGET_PICKER });
}
void PeriodicTick(AuraEffect const* /*aurEff*/)
@@ -859,9 +859,7 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_ICE_SPEAR_BUNNY))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SUMMON_ICE_SPEAR_BUNNY });
}
void FilterTargets(std::list<WorldObject*>& targets)
@@ -904,9 +902,7 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SLIPPERY_FLOOR_SLIP))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SLIPPERY_FLOOR_SLIP });
}
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
@@ -943,9 +939,7 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_COLD_SLAP))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_COLD_SLAP });
}
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
@@ -1005,9 +999,7 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_ICE_BOMBARDMENT))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_ICE_BOMBARDMENT });
}
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
diff --git a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_mennu_the_betrayer.cpp b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_mennu_the_betrayer.cpp
index 7a9fa30b631..0c93b0b1631 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_mennu_the_betrayer.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_mennu_the_betrayer.cpp
@@ -134,7 +134,7 @@ class boss_mennu_the_betrayer : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_mennu_the_betrayerAI(creature);
+ return GetSlavePensAI<boss_mennu_the_betrayerAI>(creature);
}
};
diff --git a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_quagmirran.cpp b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_quagmirran.cpp
index 36400166f09..6d46ef4ac07 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_quagmirran.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_quagmirran.cpp
@@ -117,7 +117,7 @@ class boss_quagmirran : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_quagmirranAI(creature);
+ return GetSlavePensAI<boss_quagmirranAI>(creature);
}
};
diff --git a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_rokmar_the_crackler.cpp b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_rokmar_the_crackler.cpp
index cab61b0f7e9..71e51df4c1c 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_rokmar_the_crackler.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_rokmar_the_crackler.cpp
@@ -128,7 +128,7 @@ class boss_rokmar_the_crackler : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_rokmar_the_cracklerAI(creature);
+ return GetSlavePensAI<boss_rokmar_the_cracklerAI>(creature);
}
};
diff --git a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/instance_the_slave_pens.cpp b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/instance_the_slave_pens.cpp
index 77b438a11c2..b6b17268c14 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/instance_the_slave_pens.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/instance_the_slave_pens.cpp
@@ -15,15 +15,10 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/*
-This placeholder for the instance is needed for dungeon finding to be able
-to give credit after the boss defined in lastEncounterDungeon is killed.
-Without it, the party doing random dungeon won't get satchel of spoils and
-gets instead the deserter debuff.
-*/
-
#include "ScriptMgr.h"
+#include "Creature.h"
#include "InstanceScript.h"
+#include "Map.h"
#include "the_slave_pens.h"
class instance_the_slave_pens : public InstanceMapScript
diff --git a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/the_slave_pens.h b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/the_slave_pens.h
index 9b22d61f4e7..6eff6cd66fc 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/the_slave_pens.h
+++ b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/the_slave_pens.h
@@ -18,6 +18,8 @@
#ifndef SLAVE_PENS_H
#define SLAVE_PENS_H
+#include "CreatureAIImpl.h"
+
uint32 const EncounterCount = 3;
#define SPScriptName "instance_the_slave_pens"
@@ -66,4 +68,10 @@ enum SPGameObjectIds
GO_ICE_STONE = 187882
};
+template<typename AI>
+inline AI* GetSlavePensAI(Creature* creature)
+{
+ return GetInstanceAI<AI>(creature, SPScriptName);
+}
+
#endif // SLAVE_PENS_H
diff --git a/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_hungarfen.cpp b/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_hungarfen.cpp
index ca8c64194ab..3ca97269d19 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_hungarfen.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_hungarfen.cpp
@@ -25,6 +25,7 @@ EndScriptData */
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
+#include "the_underbog.h"
enum Spells
{
@@ -43,7 +44,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_hungarfenAI(creature);
+ return GetTheUnderbogAI<boss_hungarfenAI>(creature);
}
struct boss_hungarfenAI : public ScriptedAI
@@ -117,7 +118,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_underbog_mushroomAI(creature);
+ return GetTheUnderbogAI<npc_underbog_mushroomAI>(creature);
}
struct npc_underbog_mushroomAI : public ScriptedAI
diff --git a/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_the_black_stalker.cpp b/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_the_black_stalker.cpp
index 8ec440d6378..77eeca42595 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_the_black_stalker.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_the_black_stalker.cpp
@@ -24,7 +24,9 @@ SDCategory: Coilfang Resevoir, Underbog
EndScriptData */
#include "ScriptMgr.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
+#include "the_underbog.h"
enum Spells
{
@@ -49,7 +51,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_the_black_stalkerAI(creature);
+ return GetTheUnderbogAI<boss_the_black_stalkerAI>(creature);
}
struct boss_the_black_stalkerAI : public ScriptedAI
diff --git a/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/instance_the_underbog.cpp b/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/instance_the_underbog.cpp
index 7da087cc0b1..6168f57e3f2 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/instance_the_underbog.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/instance_the_underbog.cpp
@@ -24,11 +24,13 @@ gets instead the deserter debuff.
#include "ScriptMgr.h"
#include "InstanceScript.h"
+#include "Map.h"
+#include "the_underbog.h"
class instance_the_underbog : public InstanceMapScript
{
public:
- instance_the_underbog() : InstanceMapScript("instance_the_underbog", 546) { }
+ instance_the_underbog() : InstanceMapScript(TheUndebogScriptName, 546) { }
InstanceScript* GetInstanceScript(InstanceMap* map) const override
{
diff --git a/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/the_underbog.h b/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/the_underbog.h
new file mode 100644
index 00000000000..a36a1c61fc0
--- /dev/null
+++ b/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/the_underbog.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2008-2017 TrinityCore <http://www.trinitycore.org/>
+ *
+ * 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 2 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/>.
+ */
+
+#ifndef the_underbog_h__
+#define the_underbog_h__
+
+#include "CreatureAIImpl.h"
+
+#define TheUndebogScriptName "instance_the_underbog"
+
+template<typename AI>
+inline AI* GetTheUnderbogAI(Creature* creature)
+{
+ return GetInstanceAI<AI>(creature, TheUndebogScriptName);
+}
+
+#endif // the_underbog_h__
diff --git a/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp b/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp
index e3e2d731764..b7dc8b81bb9 100644
--- a/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp
+++ b/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp
@@ -24,11 +24,10 @@ SDCategory: Gruul's Lair
EndScriptData */
#include "ScriptMgr.h"
+#include "gruuls_lair.h"
#include "ScriptedCreature.h"
#include "SpellInfo.h"
-#include "SpellMgr.h"
#include "SpellScript.h"
-#include "gruuls_lair.h"
enum Yells
{
@@ -277,11 +276,7 @@ class spell_gruul_shatter : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_STONED))
- return false;
- if (!sSpellMgr->GetSpellInfo(SPELL_SHATTER_EFFECT))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_STONED, SPELL_SHATTER_EFFECT });
}
void HandleScript(SpellEffIndex /*effIndex*/)
diff --git a/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp b/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp
index fdbff278653..055fc4d6e30 100644
--- a/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp
+++ b/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp
@@ -24,8 +24,10 @@ SDCategory: Gruul's Lair
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "gruuls_lair.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
enum HighKingMaulgar
{
diff --git a/src/server/scripts/Outland/GruulsLair/gruuls_lair.h b/src/server/scripts/Outland/GruulsLair/gruuls_lair.h
index dd9017d780d..1fde2a419a4 100644
--- a/src/server/scripts/Outland/GruulsLair/gruuls_lair.h
+++ b/src/server/scripts/Outland/GruulsLair/gruuls_lair.h
@@ -18,6 +18,8 @@
#ifndef GRUULS_LAIR_H_
#define GRUULS_LAIR_H_
+#include "CreatureAIImpl.h"
+
#define GLScriptName "instance_gruuls_lair"
#define DataHeader "GL"
@@ -45,8 +47,8 @@ enum GLGameObjectIds
GO_GRUUL_DOOR = 184662
};
-template<class AI>
-AI* GetGruulsLairAI(Creature* creature)
+template<typename AI>
+inline AI* GetGruulsLairAI(Creature* creature)
{
return GetInstanceAI<AI>(creature, GLScriptName);
}
diff --git a/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp b/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp
index 2145ebee721..0529e8f727b 100644
--- a/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp
+++ b/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp
@@ -16,8 +16,11 @@
*/
#include "ScriptMgr.h"
-#include "InstanceScript.h"
+#include "Creature.h"
+#include "GameObject.h"
#include "gruuls_lair.h"
+#include "InstanceScript.h"
+#include "Map.h"
DoorData const doorData[] =
{
diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/blood_furnace.h b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/blood_furnace.h
index 6553920f079..8dc3546a5e8 100644
--- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/blood_furnace.h
+++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/blood_furnace.h
@@ -18,6 +18,8 @@
#ifndef BLOOD_FURNACE_H_
#define BLOOD_FURNACE_H_
+#include "CreatureAIImpl.h"
+
#define BFScriptName "instance_blood_furnace"
#define DataHeader "BF"
@@ -80,8 +82,8 @@ enum BFActionIds
ACTION_PREPARE_BROGGOK = 3
};
-template<class AI>
-AI* GetBloodFurnaceAI(Creature* creature)
+template<typename AI>
+inline AI* GetBloodFurnaceAI(Creature* creature)
{
return GetInstanceAI<AI>(creature, BFScriptName);
}
diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp
index f1e4a9786ce..03d72ba343b 100644
--- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp
@@ -16,10 +16,14 @@
*/
#include "ScriptMgr.h"
+#include "blood_furnace.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
-#include "SpellScript.h"
#include "SpellAuraEffects.h"
-#include "blood_furnace.h"
+#include "SpellInfo.h"
+#include "SpellScript.h"
enum Yells
{
@@ -154,9 +158,8 @@ class spell_broggok_poison_cloud : public SpellScriptLoader
bool Validate(SpellInfo const* spellInfo) override
{
- if (!sSpellMgr->GetSpellInfo(spellInfo->GetEffect(EFFECT_0)->TriggerSpell))
- return false;
- return true;
+ SpellEffectInfo const* effect0 = spellInfo->GetEffect(EFFECT_0);
+ return effect0 && ValidateSpellInfo({ effect0->TriggerSpell });
}
void PeriodicTick(AuraEffect const* aurEff)
diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp
index fe30357631d..db5d3a4a49d 100644
--- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp
@@ -17,10 +17,15 @@
*/
#include "ScriptMgr.h"
+#include "blood_furnace.h"
+#include "Map.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
-#include "SpellAuras.h"
#include "Spell.h"
-#include "blood_furnace.h"
+#include "SpellAuras.h"
+#include "SpellMgr.h"
+#include "SpellInfo.h"
+#include "TemporarySummon.h"
enum Kelidan
{
diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp
index 7528a98c650..17090c5bceb 100644
--- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp
@@ -16,8 +16,8 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "blood_furnace.h"
+#include "ScriptedCreature.h"
enum Yells
{
diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp
index 09cd247d89a..fbc7e9290e2 100644
--- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp
@@ -16,9 +16,12 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "InstanceScript.h"
#include "blood_furnace.h"
+#include "Creature.h"
+#include "CreatureAI.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "Map.h"
DoorData const doorData[] =
{
diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp
index f925cdd8515..e30ac62cc0e 100644
--- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp
@@ -24,9 +24,10 @@ SDCategory: Hellfire Citadel, Hellfire Ramparts
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "Player.h"
#include "hellfire_ramparts.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
+#include "ScriptedCreature.h"
enum Says
{
@@ -230,7 +231,7 @@ class boss_omor_the_unscarred : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_omor_the_unscarredAI>(creature);
+ return GetHellfireRampartsAI<boss_omor_the_unscarredAI>(creature);
}
};
diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp
index e88833a36c6..7f28650c9b8 100644
--- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp
@@ -24,9 +24,11 @@ Category: Hellfire Citadel, Hellfire Ramparts
EndScriptData */
#include "ScriptMgr.h"
+#include "hellfire_ramparts.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
#include "SpellInfo.h"
-#include "hellfire_ramparts.h"
+#include "TemporarySummon.h"
enum Says
{
@@ -196,7 +198,7 @@ class boss_nazan : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_nazanAI(creature);
+ return GetHellfireRampartsAI<boss_nazanAI>(creature);
}
};
@@ -282,7 +284,7 @@ class boss_vazruden : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_vazrudenAI(creature);
+ return GetHellfireRampartsAI<boss_vazrudenAI>(creature);
}
};
@@ -454,7 +456,7 @@ class boss_vazruden_the_herald : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_vazruden_the_heraldAI(creature);
+ return GetHellfireRampartsAI<boss_vazruden_the_heraldAI>(creature);
}
};
@@ -511,7 +513,7 @@ class npc_hellfire_sentry : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_hellfire_sentryAI(creature);
+ return GetHellfireRampartsAI<npc_hellfire_sentryAI>(creature);
}
};
void AddSC_boss_vazruden_the_herald()
diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_watchkeeper_gargolmar.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_watchkeeper_gargolmar.cpp
index 0115d3fdd88..dd2e7700d1c 100644
--- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_watchkeeper_gargolmar.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_watchkeeper_gargolmar.cpp
@@ -24,8 +24,8 @@ SDCategory: Hellfire Citadel, Hellfire Ramparts
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "hellfire_ramparts.h"
+#include "ScriptedCreature.h"
enum Says
{
@@ -175,7 +175,7 @@ class boss_watchkeeper_gargolmar : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_watchkeeper_gargolmarAI(creature);
+ return GetHellfireRampartsAI<boss_watchkeeper_gargolmarAI>(creature);
}
};
diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/hellfire_ramparts.h b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/hellfire_ramparts.h
index 620f4018f6d..1b7e09ab99d 100644
--- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/hellfire_ramparts.h
+++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/hellfire_ramparts.h
@@ -19,6 +19,9 @@
#ifndef DEF_RAMPARTS_H
#define DEF_RAMPARTS_H
+#include "CreatureAIImpl.h"
+
+#define HRScriptName "instance_ramparts"
#define DataHeader "HR"
uint32 const EncounterCount = 4;
@@ -46,4 +49,10 @@ enum HRGameobjectIds
GO_FEL_IRON_CHEST_HEROIC = 185169
};
+template<typename AI>
+inline AI* GetHellfireRampartsAI(Creature* creature)
+{
+ return GetInstanceAI<AI>(creature, HRScriptName);
+}
+
#endif
diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp
index 8d6ac51f81a..2de3c155eef 100644
--- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp
@@ -24,13 +24,15 @@ SDCategory: Hellfire Ramparts
EndScriptData */
#include "ScriptMgr.h"
-#include "InstanceScript.h"
+#include "GameObject.h"
#include "hellfire_ramparts.h"
+#include "InstanceScript.h"
+#include "Map.h"
class instance_ramparts : public InstanceMapScript
{
public:
- instance_ramparts() : InstanceMapScript("instance_ramparts", 543) { }
+ instance_ramparts() : InstanceMapScript(HRScriptName, 543) { }
struct instance_ramparts_InstanceMapScript : public InstanceScript
{
diff --git a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp
index 0a6a32b93a1..f988aed128a 100644
--- a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp
@@ -24,10 +24,14 @@ SDCategory: Hellfire Citadel, Magtheridon's lair
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
#include "magtheridons_lair.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "ScriptedCreature.h"
#include "SpellInfo.h"
+#include "TemporarySummon.h"
enum Yells
{
@@ -196,7 +200,7 @@ class npc_abyssal : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_abyssalAI(creature);
+ return GetMagtheridonsLairAI<npc_abyssalAI>(creature);
}
};
@@ -463,7 +467,7 @@ class boss_magtheridon : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_magtheridonAI>(creature);
+ return GetMagtheridonsLairAI<boss_magtheridonAI>(creature);
}
};
@@ -585,7 +589,7 @@ class npc_hellfire_channeler : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_hellfire_channelerAI>(creature);
+ return GetMagtheridonsLairAI<npc_hellfire_channelerAI>(creature);
}
};
diff --git a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp
index 5271d447106..62a53a4c2f3 100644
--- a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp
@@ -24,9 +24,12 @@ SDCategory: Hellfire Citadel, Magtheridon's lair
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "Creature.h"
+#include "CreatureAI.h"
+#include "GameObject.h"
#include "InstanceScript.h"
#include "magtheridons_lair.h"
+#include "Map.h"
enum Spells
{
@@ -45,8 +48,7 @@ enum Spells
class instance_magtheridons_lair : public InstanceMapScript
{
public:
- instance_magtheridons_lair()
- : InstanceMapScript("instance_magtheridons_lair", 544)
+ instance_magtheridons_lair() : InstanceMapScript(MLScriptName, 544)
{
}
diff --git a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/magtheridons_lair.h b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/magtheridons_lair.h
index 270eb892cf2..5bb8ff7977f 100644
--- a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/magtheridons_lair.h
+++ b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/magtheridons_lair.h
@@ -19,6 +19,9 @@
#ifndef DEF_MAGTHERIDONS_LAIR_H
#define DEF_MAGTHERIDONS_LAIR_H
+#define MLScriptName "instance_magtheridons_lair"
+#include "CreatureAIImpl.h"
+
#define DataHeader "ML"
enum MLDataTypes
@@ -30,5 +33,11 @@ enum MLDataTypes
DATA_CHANNELER = 9
};
+template<typename AI>
+inline AI* GetMagtheridonsLairAI(Creature* creature)
+{
+ return GetInstanceAI<AI>(creature, MLScriptName);
+}
+
#endif
diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp
index 0757cc44acf..5d776022279 100644
--- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp
@@ -30,6 +30,8 @@ npc_lesser_shadow_fissure
EndContentData */
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
#include "shattered_halls.h"
@@ -299,7 +301,7 @@ class boss_grand_warlock_nethekurse : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_grand_warlock_nethekurseAI>(creature);
+ return GetShatteredHallsAI<boss_grand_warlock_nethekurseAI>(creature);
}
};
@@ -367,7 +369,7 @@ class npc_fel_orc_convert : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_fel_orc_convertAI>(creature);
+ return GetShatteredHallsAI<npc_fel_orc_convertAI>(creature);
}
};
@@ -392,7 +394,7 @@ class npc_lesser_shadow_fissure : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_lesser_shadow_fissureAI(creature);
+ return GetShatteredHallsAI<npc_lesser_shadow_fissureAI>(creature);
}
};
diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp
index 68ac53eb708..967e01a5cef 100644
--- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp
@@ -29,6 +29,8 @@ boss_warbringer_omrogg
EndContentData */
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
#include "shattered_halls.h"
@@ -393,7 +395,7 @@ class boss_warbringer_omrogg : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_warbringer_omroggAI>(creature);
+ return GetShatteredHallsAI<boss_warbringer_omroggAI>(creature);
}
};
@@ -443,7 +445,7 @@ class npc_omrogg_heads : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_omrogg_headsAI>(creature);
+ return GetShatteredHallsAI<npc_omrogg_headsAI>(creature);
}
};
diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp
index a4f10aa9eda..a052fd941fc 100644
--- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp
@@ -28,6 +28,8 @@ boss_warchief_kargath_bladefist
EndContentData */
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
#include "shattered_halls.h"
@@ -339,7 +341,7 @@ class boss_warchief_kargath_bladefist : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_warchief_kargath_bladefistAI>(creature);
+ return GetShatteredHallsAI<boss_warchief_kargath_bladefistAI>(creature);
}
};
diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp
index 72a29272c84..a692e5c8429 100644
--- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp
@@ -24,13 +24,15 @@ SDCategory: Hellfire Citadel, Shattered Halls
EndScriptData */
#include "ScriptMgr.h"
+#include "Creature.h"
+#include "CreatureAI.h"
+#include "GameObject.h"
#include "InstanceScript.h"
-#include "shattered_halls.h"
+#include "Map.h"
#include "Player.h"
+#include "shattered_halls.h"
#include "SpellAuras.h"
-#include "CreatureAI.h"
-#include "ScriptedCreature.h"
-#include "SpellScript.h"
+#include "TemporarySummon.h"
DoorData const doorData[] =
{
@@ -42,7 +44,7 @@ DoorData const doorData[] =
class instance_shattered_halls : public InstanceMapScript
{
public:
- instance_shattered_halls() : InstanceMapScript("instance_shattered_halls", 540) { }
+ instance_shattered_halls() : InstanceMapScript(SHScriptName, 540) { }
InstanceScript* GetInstanceScript(InstanceMap* map) const override
{
diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/shattered_halls.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/shattered_halls.cpp
index 0c17f711982..9b68f751249 100644
--- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/shattered_halls.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/shattered_halls.cpp
@@ -16,13 +16,14 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "SpellScript.h"
-#include "SpellAuraEffects.h"
#include "InstanceScript.h"
+#include "Map.h"
+#include "ObjectAccessor.h"
#include "Player.h"
-#include "SpellAuras.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
#include "shattered_halls.h"
+#include "TemporarySummon.h"
class at_nethekurse_exit : public AreaTriggerScript
{
@@ -171,7 +172,7 @@ class boss_shattered_executioner : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_shattered_executionerAI>(creature);
+ return GetShatteredHallsAI<boss_shattered_executionerAI>(creature);
}
};
diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/shattered_halls.h b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/shattered_halls.h
index d62746e098f..d92255f5b59 100644
--- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/shattered_halls.h
+++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/shattered_halls.h
@@ -19,6 +19,10 @@
#ifndef DEF_SHATTERED_H
#define DEF_SHATTERED_H
+#include "CreatureAIImpl.h"
+#include "Position.h"
+
+#define SHScriptName "instance_shattered_halls"
#define DataHeader "SH"
uint32 const EncounterCount = 4;
@@ -98,9 +102,9 @@ struct FactionSpawnerHelper
inline Position const& GetPos() const { return _spawnPos; }
private:
- const uint32 _allianceNPC;
- const uint32 _hordeNPC;
- const Position _spawnPos;
+ uint32 const _allianceNPC;
+ uint32 const _hordeNPC;
+ Position const _spawnPos;
};
const FactionSpawnerHelper executionerVictims[VictimCount] =
@@ -110,5 +114,10 @@ const FactionSpawnerHelper executionerVictims[VictimCount] =
{ NPC_ALLIANCE_VICTIM_2, NPC_HORDE_VICTIM_2, { 151.0459f, -77.51981f, 2.021008f, 4.74729500f } }
};
+template<typename AI>
+inline AI* GetShatteredHallsAI(Creature* creature)
+{
+ return GetInstanceAI<AI>(creature, SHScriptName);
+}
#endif
diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp
index 04ee2c90fa0..cfaa9ff8b45 100644
--- a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp
@@ -24,9 +24,12 @@ SDCategory: Tempest Keep, The Eye
EndScriptData */
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
-#include "the_eye.h"
#include "SpellInfo.h"
+#include "TemporarySummon.h"
+#include "the_eye.h"
enum Spells
{
@@ -448,7 +451,7 @@ class boss_alar : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_alarAI>(creature);
+ return GetTheEyeAI<boss_alarAI>(creature);
}
};
@@ -531,7 +534,7 @@ class npc_ember_of_alar : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_ember_of_alarAI>(creature);
+ return GetTheEyeAI<npc_ember_of_alarAI>(creature);
}
};
@@ -553,7 +556,7 @@ class npc_flame_patch_alar : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_flame_patch_alarAI(creature);
+ return GetTheEyeAI<npc_flame_patch_alarAI>(creature);
}
};
diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp
index 671d1e8a9ca..9736d61d44e 100644
--- a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp
@@ -24,10 +24,13 @@ SDCategory: Tempest Keep, The Eye
EndScriptData */
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
+#include "SpellAuras.h"
+#include "SpellInfo.h"
#include "SpellScript.h"
-#include "SpellAuraEffects.h"
-
+#include "TemporarySummon.h"
#include "the_eye.h"
enum Yells
@@ -410,7 +413,7 @@ class boss_high_astromancer_solarian : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_high_astromancer_solarianAI>(creature);
+ return GetTheEyeAI<boss_high_astromancer_solarianAI>(creature);
}
};
@@ -497,7 +500,7 @@ class npc_solarium_priest : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_solarium_priestAI>(creature);
+ return GetTheEyeAI<npc_solarium_priestAI>(creature);
}
};
@@ -512,9 +515,7 @@ class spell_astromancer_wrath_of_the_astromancer : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_WRATH_OF_THE_ASTROMANCER_DOT))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_WRATH_OF_THE_ASTROMANCER_DOT });
}
void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp
index ccda9fd839d..b624b614ac8 100644
--- a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp
@@ -29,7 +29,6 @@ EndScriptData */
#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
#include "SpellInfo.h"
-#include "SpellMgr.h"
#include "SpellScript.h"
#include "the_eye.h"
@@ -867,7 +866,7 @@ class boss_kaelthas : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_kaelthasAI>(creature);
+ return GetTheEyeAI<boss_kaelthasAI>(creature);
}
};
@@ -972,7 +971,7 @@ class boss_thaladred_the_darkener : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_thaladred_the_darkenerAI>(creature);
+ return GetTheEyeAI<boss_thaladred_the_darkenerAI>(creature);
}
};
@@ -1036,7 +1035,7 @@ class boss_lord_sanguinar : public CreatureScript
};
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_lord_sanguinarAI>(creature);
+ return GetTheEyeAI<boss_lord_sanguinarAI>(creature);
}
};
@@ -1167,7 +1166,7 @@ class boss_grand_astromancer_capernian : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_grand_astromancer_capernianAI>(creature);
+ return GetTheEyeAI<boss_grand_astromancer_capernianAI>(creature);
}
};
@@ -1246,7 +1245,7 @@ class boss_master_engineer_telonicus : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_master_engineer_telonicusAI>(creature);
+ return GetTheEyeAI<boss_master_engineer_telonicusAI>(creature);
}
};
@@ -1316,7 +1315,7 @@ class npc_kael_flamestrike : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_kael_flamestrikeAI(creature);
+ return GetTheEyeAI<npc_kael_flamestrikeAI>(creature);
}
};
@@ -1375,7 +1374,7 @@ class npc_phoenix_tk : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_phoenix_tkAI(creature);
+ return GetTheEyeAI<npc_phoenix_tkAI>(creature);
}
};
@@ -1441,7 +1440,7 @@ class npc_phoenix_egg_tk : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_phoenix_egg_tkAI(creature);
+ return GetTheEyeAI<npc_phoenix_egg_tkAI>(creature);
}
};
@@ -1463,11 +1462,7 @@ class spell_kael_gravity_lapse : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- for (uint8 i = 0; i < 25; ++i)
- if (!sSpellMgr->GetSpellInfo(GravityLapseSpells[i]))
- return false;
-
- return true;
+ return ValidateSpellInfo(GravityLapseSpells);
}
void HandleScript(SpellEffIndex /*effIndex*/)
diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp
index c111756aa5c..673a260a15a 100644
--- a/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp
@@ -16,6 +16,7 @@
*/
#include "ScriptMgr.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
#include "the_eye.h"
@@ -167,7 +168,7 @@ class boss_void_reaver : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_void_reaverAI>(creature);
+ return GetTheEyeAI<boss_void_reaverAI>(creature);
}
};
diff --git a/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp b/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp
index 0d279c928f0..e36d7a818c8 100644
--- a/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp
@@ -24,7 +24,9 @@ SDCategory: Tempest Keep, The Eye
EndScriptData */
#include "ScriptMgr.h"
+#include "Creature.h"
#include "InstanceScript.h"
+#include "Map.h"
#include "the_eye.h"
/* The Eye encounters:
@@ -52,7 +54,7 @@ ObjectData const gameObjectData[] =
class instance_the_eye : public InstanceMapScript
{
public:
- instance_the_eye() : InstanceMapScript("instance_the_eye", 550) { }
+ instance_the_eye() : InstanceMapScript(TheEyeScriptName, 550) { }
struct instance_the_eye_InstanceMapScript : public InstanceScript
{
diff --git a/src/server/scripts/Outland/TempestKeep/Eye/the_eye.h b/src/server/scripts/Outland/TempestKeep/Eye/the_eye.h
index 1111e2409f5..f2232707ebd 100644
--- a/src/server/scripts/Outland/TempestKeep/Eye/the_eye.h
+++ b/src/server/scripts/Outland/TempestKeep/Eye/the_eye.h
@@ -19,6 +19,9 @@
#ifndef DEF_THE_EYE_H
#define DEF_THE_EYE_H
+#include "CreatureAIImpl.h"
+
+#define TheEyeScriptName "instance_the_eye"
#define DataHeader "TE"
uint32 const EncounterCount = 4;
@@ -63,4 +66,10 @@ enum TEGameObjectIds
GO_ARCANE_DOOR_RIGHT = 184325
};
+template<typename AI>
+inline AI* GetTheEyeAI(Creature* creature)
+{
+ return GetInstanceAI<AI>(creature, TheEyeScriptName);
+}
+
#endif
diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_gyrokill.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_gyrokill.cpp
index b10b6276337..6376a0e8175 100644
--- a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_gyrokill.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_gyrokill.cpp
@@ -23,8 +23,8 @@ SDCategory: Tempest Keep, The Mechanar
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "mechanar.h"
+#include "ScriptedCreature.h"
enum Say
{
@@ -120,7 +120,7 @@ class boss_gatewatcher_gyrokill : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_gatewatcher_gyrokillAI(creature);
+ return GetMechanarAI<boss_gatewatcher_gyrokillAI>(creature);
}
};
diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_ironhand.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_ironhand.cpp
index 1733d94bc78..0b060d35771 100644
--- a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_ironhand.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_ironhand.cpp
@@ -24,8 +24,8 @@ SDCategory: Tempest Keep, The Mechanar
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "mechanar.h"
+#include "ScriptedCreature.h"
enum Says
{
@@ -127,7 +127,7 @@ class boss_gatewatcher_iron_hand : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_gatewatcher_iron_handAI(creature);
+ return GetMechanarAI<boss_gatewatcher_iron_handAI>(creature);
}
};
diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp
index 8187cdb14a0..6a6c80578ca 100644
--- a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp
@@ -16,11 +16,10 @@
*/
#include "ScriptMgr.h"
+#include "mechanar.h"
#include "ScriptedCreature.h"
-#include "SpellScript.h"
#include "SpellInfo.h"
-#include "mechanar.h"
-#include "Player.h"
+#include "SpellScript.h"
enum Spells
{
@@ -156,7 +155,7 @@ class boss_mechano_lord_capacitus : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_mechano_lord_capacitusAI(creature);
+ return GetMechanarAI<boss_mechano_lord_capacitusAI>(creature);
}
};
@@ -171,24 +170,22 @@ class spell_capacitus_polarity_charge : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_POSITIVE_CHARGE))
- return false;
- if (!sSpellMgr->GetSpellInfo(SPELL_POSITIVE_CHARGE_STACK))
- return false;
- if (!sSpellMgr->GetSpellInfo(SPELL_NEGATIVE_CHARGE))
- return false;
- if (!sSpellMgr->GetSpellInfo(SPELL_NEGATIVE_CHARGE_STACK))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_POSITIVE_CHARGE,
+ SPELL_POSITIVE_CHARGE_STACK,
+ SPELL_NEGATIVE_CHARGE,
+ SPELL_NEGATIVE_CHARGE_STACK
+ });
}
void HandleTargets(std::list<WorldObject*>& targetList)
{
uint8 count = 0;
- for (std::list<WorldObject*>::iterator ihit = targetList.begin(); ihit != targetList.end(); ++ihit)
- if ((*ihit)->GetGUID() != GetCaster()->GetGUID())
- if (Player* target = (*ihit)->ToPlayer())
- if (target->HasAura(GetTriggeringSpell()->Id))
+ for (WorldObject* target : targetList)
+ if (target->GetGUID() != GetCaster()->GetGUID())
+ if (target->GetTypeId() == TYPEID_PLAYER)
+ if (target->ToUnit()->HasAura(GetTriggeringSpell()->Id))
++count;
if (count)
@@ -239,9 +236,7 @@ class spell_capacitus_polarity_shift : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_POSITIVE_POLARITY) || !sSpellMgr->GetSpellInfo(SPELL_NEGATIVE_POLARITY))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_POSITIVE_POLARITY, SPELL_NEGATIVE_POLARITY });
}
void HandleDummy(SpellEffIndex /* effIndex */)
diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_nethermancer_sepethrea.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_nethermancer_sepethrea.cpp
index 199fa3d81c1..a3be06dd188 100644
--- a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_nethermancer_sepethrea.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_nethermancer_sepethrea.cpp
@@ -24,8 +24,9 @@ SDCategory: Tempest Keep, The Mechanar
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "InstanceScript.h"
#include "mechanar.h"
+#include "ScriptedCreature.h"
enum Says
{
@@ -141,7 +142,7 @@ class boss_nethermancer_sepethrea : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_nethermancer_sepethreaAI(creature);
+ return GetMechanarAI<boss_nethermancer_sepethreaAI>(creature);
}
};
@@ -229,7 +230,7 @@ class npc_ragin_flames : public CreatureScript
};
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_ragin_flamesAI>(creature);
+ return GetMechanarAI<npc_ragin_flamesAI>(creature);
}
};
diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_pathaleon_the_calculator.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_pathaleon_the_calculator.cpp
index 33ffa66b387..5bba703362c 100644
--- a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_pathaleon_the_calculator.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_pathaleon_the_calculator.cpp
@@ -24,8 +24,9 @@ SDCategory: Tempest Keep, The Mechanar
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "mechanar.h"
+#include "ScriptedCreature.h"
+#include "TemporarySummon.h"
enum Says
{
@@ -163,7 +164,7 @@ class boss_pathaleon_the_calculator : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_pathaleon_the_calculatorAI(creature);
+ return GetMechanarAI<boss_pathaleon_the_calculatorAI>(creature);
}
};
@@ -243,7 +244,7 @@ class npc_nether_wraith : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_nether_wraithAI(creature);
+ return GetMechanarAI<npc_nether_wraithAI>(creature);
}
};
diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp
index 47587cf528e..483364b8c22 100644
--- a/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp
@@ -17,7 +17,9 @@
*/
#include "ScriptMgr.h"
+#include "GameObject.h"
#include "InstanceScript.h"
+#include "Map.h"
#include "mechanar.h"
static DoorData const doorData[] =
@@ -31,7 +33,7 @@ static DoorData const doorData[] =
class instance_mechanar : public InstanceMapScript
{
public:
- instance_mechanar(): InstanceMapScript("instance_mechanar", 554) { }
+ instance_mechanar(): InstanceMapScript(MechanarScriptName, 554) { }
struct instance_mechanar_InstanceMapScript : public InstanceScript
{
diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/mechanar.h b/src/server/scripts/Outland/TempestKeep/Mechanar/mechanar.h
index 35494c745f8..8b7dc09bced 100644
--- a/src/server/scripts/Outland/TempestKeep/Mechanar/mechanar.h
+++ b/src/server/scripts/Outland/TempestKeep/Mechanar/mechanar.h
@@ -18,6 +18,9 @@
#ifndef DEF_MECHANAR_H
#define DEF_MECHANAR_H
+#include "CreatureAIImpl.h"
+
+#define MechanarScriptName "instance_mechanar"
#define DataHeader "MR"
uint32 const EncounterCount = 5;
@@ -38,4 +41,10 @@ enum MRGameobjectIds
GO_DOOR_NETHERMANCER = 184449
};
+template<typename AI>
+inline AI* GetMechanarAI(Creature* creature)
+{
+ return GetInstanceAI<AI>(creature, MechanarScriptName);
+}
+
#endif
diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp
index f96fadfc5a7..8771b8a5af5 100644
--- a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp
+++ b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp
@@ -30,8 +30,9 @@ npc_zerekethvoidzone
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "arcatraz.h"
+#include "InstanceScript.h"
+#include "ScriptedCreature.h"
/*#####
# npc_millhouse_manastorm
@@ -549,7 +550,7 @@ class npc_zerekethvoidzone : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_zerekethvoidzoneAI(creature);
+ return GetArcatrazAI<npc_zerekethvoidzoneAI>(creature);
}
};
diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.h b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.h
index 038dfb16067..5a6368d08f2 100644
--- a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.h
+++ b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.h
@@ -18,6 +18,8 @@
#ifndef ARCATRAZ_H
#define ARCATRAZ_H
+#include "CreatureAIImpl.h"
+
#define ArcatrazScriptName "instance_arcatraz"
#define DataHeader "AZ"
@@ -62,8 +64,8 @@ enum AZGameObjectIds
GO_WARDENS_SHIELD = 184802 // shield 'protecting' mellichar
};
-template<class AI>
-AI* GetArcatrazAI(Creature* creature)
+template<typename AI>
+inline AI* GetArcatrazAI(Creature* creature)
{
return GetInstanceAI<AI>(creature, ArcatrazScriptName);
}
diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_dalliah_the_doomsayer.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_dalliah_the_doomsayer.cpp
index 52481ac629d..e2235a34c3c 100644
--- a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_dalliah_the_doomsayer.cpp
+++ b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_dalliah_the_doomsayer.cpp
@@ -16,8 +16,10 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "arcatraz.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
enum Say
{
diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp
index 763d0c206cc..564bb6b2d9c 100644
--- a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp
+++ b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp
@@ -29,8 +29,10 @@ boss_harbinger_skyriss_illusion
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "arcatraz.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
enum Says
{
@@ -293,7 +295,7 @@ class boss_harbinger_skyriss_illusion : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_harbinger_skyriss_illusionAI(creature);
+ return GetArcatrazAI<boss_harbinger_skyriss_illusionAI>(creature);
}
};
diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_wrath_scryer_soccothrates.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_wrath_scryer_soccothrates.cpp
index 4f12a669a6a..4232d6efdc9 100644
--- a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_wrath_scryer_soccothrates.cpp
+++ b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_wrath_scryer_soccothrates.cpp
@@ -23,8 +23,10 @@ SDCategory: Tempest Keep, The Arcatraz
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "arcatraz.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
enum Say
{
diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_zereketh_the_unbound.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_zereketh_the_unbound.cpp
index 54693d3776a..5c5bfa2c4fa 100644
--- a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_zereketh_the_unbound.cpp
+++ b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_zereketh_the_unbound.cpp
@@ -16,8 +16,8 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "arcatraz.h"
+#include "ScriptedCreature.h"
enum Say
{
@@ -118,7 +118,7 @@ class boss_zereketh_the_unbound : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_zereketh_the_unboundAI(creature);
+ return GetArcatrazAI<boss_zereketh_the_unboundAI>(creature);
}
};
diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp
index b79274d3b5d..f700d5f725f 100644
--- a/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp
+++ b/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp
@@ -16,8 +16,11 @@
*/
#include "ScriptMgr.h"
-#include "InstanceScript.h"
#include "arcatraz.h"
+#include "Creature.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "Map.h"
DoorData const doorData[] =
{
diff --git a/src/server/scripts/Outland/TempestKeep/botanica/boss_commander_sarannis.cpp b/src/server/scripts/Outland/TempestKeep/botanica/boss_commander_sarannis.cpp
index ad83bd90e61..48c2d0dadad 100644
--- a/src/server/scripts/Outland/TempestKeep/botanica/boss_commander_sarannis.cpp
+++ b/src/server/scripts/Outland/TempestKeep/botanica/boss_commander_sarannis.cpp
@@ -16,9 +16,10 @@
*/
#include "ScriptMgr.h"
+#include "Map.h"
#include "ScriptedCreature.h"
-#include "the_botanica.h"
#include "SpellScript.h"
+#include "the_botanica.h"
enum Says
{
@@ -142,7 +143,7 @@ class boss_commander_sarannis : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_commander_sarannisAI(creature);
+ return GetBotanicaAI<boss_commander_sarannisAI>(creature);
}
};
diff --git a/src/server/scripts/Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp b/src/server/scripts/Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp
index 91de750ad81..3ba08006940 100644
--- a/src/server/scripts/Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp
+++ b/src/server/scripts/Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp
@@ -24,6 +24,7 @@ SDCategory: Tempest Keep, The Botanica
EndScriptData */
#include "ScriptMgr.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
#include "the_botanica.h"
@@ -210,7 +211,7 @@ class boss_high_botanist_freywinn : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_high_botanist_freywinnAI(creature);
+ return GetBotanicaAI<boss_high_botanist_freywinnAI>(creature);
}
};
diff --git a/src/server/scripts/Outland/TempestKeep/botanica/boss_laj.cpp b/src/server/scripts/Outland/TempestKeep/botanica/boss_laj.cpp
index e8283eeb8cb..31241a050dd 100644
--- a/src/server/scripts/Outland/TempestKeep/botanica/boss_laj.cpp
+++ b/src/server/scripts/Outland/TempestKeep/botanica/boss_laj.cpp
@@ -223,7 +223,7 @@ class boss_laj : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_lajAI(creature);
+ return GetBotanicaAI<boss_lajAI>(creature);
}
};
diff --git a/src/server/scripts/Outland/TempestKeep/botanica/boss_thorngrin_the_tender.cpp b/src/server/scripts/Outland/TempestKeep/botanica/boss_thorngrin_the_tender.cpp
index 6480b8a2b58..67a27523d99 100644
--- a/src/server/scripts/Outland/TempestKeep/botanica/boss_thorngrin_the_tender.cpp
+++ b/src/server/scripts/Outland/TempestKeep/botanica/boss_thorngrin_the_tender.cpp
@@ -152,7 +152,7 @@ class boss_thorngrin_the_tender : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_thorngrin_the_tenderAI(creature);
+ return GetBotanicaAI<boss_thorngrin_the_tenderAI>(creature);
}
};
diff --git a/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp b/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp
index 0f5c31445e8..21ac858cb6b 100644
--- a/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp
+++ b/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp
@@ -24,7 +24,9 @@ SDCategory: Tempest Keep, The Botanica
EndScriptData */
#include "ScriptMgr.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
+#include "TemporarySummon.h"
#include "the_botanica.h"
enum Says
@@ -125,7 +127,7 @@ class npc_warp_splinter_treant : public CreatureScript
};
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_warp_splinter_treantAI(creature);
+ return GetBotanicaAI<npc_warp_splinter_treantAI>(creature);
}
};
@@ -239,7 +241,7 @@ class boss_warp_splinter : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_warp_splinterAI(creature);
+ return GetBotanicaAI<boss_warp_splinterAI>(creature);
}
};
diff --git a/src/server/scripts/Outland/TempestKeep/botanica/instance_the_botanica.cpp b/src/server/scripts/Outland/TempestKeep/botanica/instance_the_botanica.cpp
index 3d878bae81e..6e092b743f3 100644
--- a/src/server/scripts/Outland/TempestKeep/botanica/instance_the_botanica.cpp
+++ b/src/server/scripts/Outland/TempestKeep/botanica/instance_the_botanica.cpp
@@ -16,13 +16,15 @@
*/
#include "ScriptMgr.h"
+#include "Creature.h"
#include "InstanceScript.h"
+#include "Map.h"
#include "the_botanica.h"
class instance_the_botanica : public InstanceMapScript
{
public:
- instance_the_botanica() : InstanceMapScript("instance_the_botanica", 553) { }
+ instance_the_botanica() : InstanceMapScript(BotanicaScriptName, 553) { }
struct instance_the_botanica_InstanceMapScript : public InstanceScript
{
diff --git a/src/server/scripts/Outland/TempestKeep/botanica/the_botanica.h b/src/server/scripts/Outland/TempestKeep/botanica/the_botanica.h
index fc773d0b133..4c3c2dbe2b7 100644
--- a/src/server/scripts/Outland/TempestKeep/botanica/the_botanica.h
+++ b/src/server/scripts/Outland/TempestKeep/botanica/the_botanica.h
@@ -19,6 +19,9 @@
#ifndef DEF_THE_BOTANICA_H
#define DEF_THE_BOTANICA_H
+#include "CreatureAIImpl.h"
+
+#define BotanicaScriptName "instance_the_botanica"
#define DataHeader "BC"
uint32 const EncounterCount = 5;
@@ -41,4 +44,10 @@ enum BCCreatureIds
NPC_WARP_SPLINTER = 17977
};
+template<typename AI>
+inline AI* GetBotanicaAI(Creature* creature)
+{
+ return GetInstanceAI<AI>(creature, BotanicaScriptName);
+}
+
#endif
diff --git a/src/server/scripts/Outland/boss_doomlord_kazzak.cpp b/src/server/scripts/Outland/boss_doomlord_kazzak.cpp
index 28c424d39b6..8d6440a43b2 100644
--- a/src/server/scripts/Outland/boss_doomlord_kazzak.cpp
+++ b/src/server/scripts/Outland/boss_doomlord_kazzak.cpp
@@ -18,7 +18,6 @@
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
-#include "SpellAuraEffects.h"
#include "SpellScript.h"
enum Texts
@@ -187,9 +186,7 @@ class spell_mark_of_kazzak : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_MARK_OF_KAZZAK_DAMAGE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_MARK_OF_KAZZAK_DAMAGE });
}
void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
@@ -234,9 +231,7 @@ class spell_twisted_reflection : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_TWISTED_REFLECTION_HEAL))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_TWISTED_REFLECTION_HEAL });
}
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
diff --git a/src/server/scripts/Outland/zone_blades_edge_mountains.cpp b/src/server/scripts/Outland/zone_blades_edge_mountains.cpp
index 84e2635d8a9..42783ce2953 100644
--- a/src/server/scripts/Outland/zone_blades_edge_mountains.cpp
+++ b/src/server/scripts/Outland/zone_blades_edge_mountains.cpp
@@ -30,16 +30,17 @@ go_legion_obelisk
EndContentData */
#include "ScriptMgr.h"
+#include "CellImpl.h"
+#include "CreatureAIImpl.h"
+#include "GameObject.h"
+#include "GridNotifiersImpl.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
-#include "GridNotifiers.h"
-#include "GridNotifiersImpl.h"
-#include "Cell.h"
-#include "CellImpl.h"
#include "SpellInfo.h"
#include "SpellScript.h"
-#include "SpellAuras.h"
-#include "SpellAuraEffects.h"
+#include "TemporarySummon.h"
/*######
## npc_nether_drake
@@ -959,7 +960,7 @@ public:
{
// Spell 37392 does not exist in dbc, manually spawning
me->SummonCreature(NPC_OSCILLATING_FREQUENCY_SCANNER_TOP_BUNNY, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ() + 0.5f, me->GetOrientation(), TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 50000);
- me->SummonGameObject(GO_OSCILLATING_FREQUENCY_SCANNER, *me, G3D::Quat(), 50);
+ me->SummonGameObject(GO_OSCILLATING_FREQUENCY_SCANNER, *me, QuaternionData(), 50);
me->DespawnOrUnsummon(50000);
}
diff --git a/src/server/scripts/Outland/zone_hellfire_peninsula.cpp b/src/server/scripts/Outland/zone_hellfire_peninsula.cpp
index 92d87b5a279..439a07161fc 100644
--- a/src/server/scripts/Outland/zone_hellfire_peninsula.cpp
+++ b/src/server/scripts/Outland/zone_hellfire_peninsula.cpp
@@ -32,11 +32,11 @@ EndContentData */
#include "ScriptMgr.h"
#include "Log.h"
+#include "ObjectAccessor.h"
#include "Player.h"
-#include "ScriptedCreature.h"
+#include "QuestDef.h"
#include "ScriptedEscortAI.h"
#include "ScriptedGossip.h"
-#include "WorldSession.h"
/*######
## npc_aeranas
@@ -661,7 +661,7 @@ public:
switch (gossipListId)
{
case 1:
- player->PlayerTalkClass->SendCloseGossip();
+ CloseGossipMenuFor(player);
me->AI()->Talk(SAY_BARADA_1);
me->AI()->DoAction(ACTION_START_EVENT);
break;
diff --git a/src/server/scripts/Outland/zone_nagrand.cpp b/src/server/scripts/Outland/zone_nagrand.cpp
index de689f03fa9..bddbc07a8e5 100644
--- a/src/server/scripts/Outland/zone_nagrand.cpp
+++ b/src/server/scripts/Outland/zone_nagrand.cpp
@@ -27,12 +27,15 @@ EndScriptData */
npc_maghar_captive
npc_creditmarker_visit_with_ancestors
EndContentData */
+
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
-#include "ScriptedEscortAI.h"
+#include "GameObject.h"
#include "Player.h"
+#include "QuestDef.h"
+#include "ScriptedEscortAI.h"
+#include "ScriptedGossip.h"
#include "SpellInfo.h"
+#include "TemporarySummon.h"
/*######
## npc_maghar_captive
diff --git a/src/server/scripts/Outland/zone_netherstorm.cpp b/src/server/scripts/Outland/zone_netherstorm.cpp
index 9532d43c162..38d48bc4118 100644
--- a/src/server/scripts/Outland/zone_netherstorm.cpp
+++ b/src/server/scripts/Outland/zone_netherstorm.cpp
@@ -31,9 +31,11 @@ go_captain_tyralius_prison
EndContentData */
#include "ScriptMgr.h"
+#include "GameObject.h"
#include "Log.h"
+#include "ObjectAccessor.h"
#include "Player.h"
-#include "ScriptedCreature.h"
+#include "QuestDef.h"
#include "ScriptedEscortAI.h"
#include "ScriptedGossip.h"
diff --git a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp
index 82ba849bbbe..d216e08ece7 100644
--- a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp
+++ b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp
@@ -41,6 +41,7 @@ EndContentData */
#include "Group.h"
#include "ObjectAccessor.h"
#include "Player.h"
+#include "QuestDef.h"
#include "ScriptedEscortAI.h"
#include "ScriptedGossip.h"
#include "SpellInfo.h"
@@ -76,7 +77,8 @@ public:
void Reset() override
{
- ground = me->GetMap()->GetHeight(me->GetPhases(), me->GetPositionX(), me->GetPositionY(), me->GetPositionZMinusOffset());
+ ground = me->GetPositionZ();
+ me->UpdateGroundPositionZ(me->GetPositionX(), me->GetPositionY(), ground);
SummonInfernal();
events.ScheduleEvent(EVENT_CAST_SUMMON_INFERNAL, urand(1000, 3000));
}
diff --git a/src/server/scripts/Outland/zone_shattrath_city.cpp b/src/server/scripts/Outland/zone_shattrath_city.cpp
index 78bbb88e021..9342417acdc 100644
--- a/src/server/scripts/Outland/zone_shattrath_city.cpp
+++ b/src/server/scripts/Outland/zone_shattrath_city.cpp
@@ -32,11 +32,9 @@ npc_kservant
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "Player.h"
#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
-#include "Player.h"
-#include "WorldSession.h"
/*######
## npc_raliq_the_drunk
diff --git a/src/server/scripts/Outland/zone_terokkar_forest.cpp b/src/server/scripts/Outland/zone_terokkar_forest.cpp
index 1927dae9d57..98752c1eb1e 100644
--- a/src/server/scripts/Outland/zone_terokkar_forest.cpp
+++ b/src/server/scripts/Outland/zone_terokkar_forest.cpp
@@ -33,12 +33,11 @@ npc_slim
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
-#include "ScriptedEscortAI.h"
+#include "GameObject.h"
#include "Group.h"
#include "Player.h"
-#include "WorldSession.h"
+#include "ScriptedEscortAI.h"
+#include "ScriptedGossip.h"
/*######
## npc_unkor_the_ruthless
diff --git a/src/server/scripts/Outland/zone_zangarmarsh.cpp b/src/server/scripts/Outland/zone_zangarmarsh.cpp
index a1810316cf1..7417cd04085 100644
--- a/src/server/scripts/Outland/zone_zangarmarsh.cpp
+++ b/src/server/scripts/Outland/zone_zangarmarsh.cpp
@@ -31,11 +31,9 @@ npc_kayra_longmane
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "Player.h"
#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
-#include "Player.h"
-#include "WorldSession.h"
/*######
## npcs_ashyen_and_keleth
diff --git a/src/server/scripts/Pet/pet_dk.cpp b/src/server/scripts/Pet/pet_dk.cpp
index a17b9fd8b59..9f475ddf9c3 100644
--- a/src/server/scripts/Pet/pet_dk.cpp
+++ b/src/server/scripts/Pet/pet_dk.cpp
@@ -21,12 +21,11 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "CombatAI.h"
-#include "Cell.h"
#include "CellImpl.h"
-#include "GridNotifiers.h"
+#include "CombatAI.h"
#include "GridNotifiersImpl.h"
+#include "ScriptedCreature.h"
+#include "SpellInfo.h"
enum DeathKnightSpells
{
diff --git a/src/server/scripts/Pet/pet_generic.cpp b/src/server/scripts/Pet/pet_generic.cpp
index c7cee9bd559..1ac60ba3405 100644
--- a/src/server/scripts/Pet/pet_generic.cpp
+++ b/src/server/scripts/Pet/pet_generic.cpp
@@ -28,9 +28,13 @@
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "DB2Structure.h"
+#include "Map.h"
+#include "ObjectAccessor.h"
#include "PassiveAI.h"
+#include "PetDefines.h"
#include "Player.h"
+#include "ScriptedCreature.h"
enum BabyBlizzardBearMisc
{
diff --git a/src/server/scripts/Pet/pet_hunter.cpp b/src/server/scripts/Pet/pet_hunter.cpp
index 8e90a5fad6f..b42c85b3f26 100644
--- a/src/server/scripts/Pet/pet_hunter.cpp
+++ b/src/server/scripts/Pet/pet_hunter.cpp
@@ -21,7 +21,9 @@
*/
#include "ScriptMgr.h"
+#include "CreatureAIImpl.h"
#include "ScriptedCreature.h"
+#include "TemporarySummon.h"
enum HunterSpells
{
diff --git a/src/server/scripts/Pet/pet_mage.cpp b/src/server/scripts/Pet/pet_mage.cpp
index ef1eb2a356e..43ffddeca5d 100644
--- a/src/server/scripts/Pet/pet_mage.cpp
+++ b/src/server/scripts/Pet/pet_mage.cpp
@@ -21,13 +21,13 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "CellImpl.h"
#include "CombatAI.h"
+#include "GridNotifiersImpl.h"
#include "Pet.h"
#include "PetAI.h"
-#include "Cell.h"
-#include "CellImpl.h"
-#include "GridNotifiers.h"
+#include "Player.h"
+#include "ScriptedCreature.h"
enum MageSpells
{
diff --git a/src/server/scripts/Pet/pet_priest.cpp b/src/server/scripts/Pet/pet_priest.cpp
index 09dc6c07439..9dbc3b54192 100644
--- a/src/server/scripts/Pet/pet_priest.cpp
+++ b/src/server/scripts/Pet/pet_priest.cpp
@@ -21,9 +21,9 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "PassiveAI.h"
#include "PetAI.h"
+#include "ScriptedCreature.h"
enum PriestSpells
{
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp
index d53a014343e..fbd9a8363ee 100644
--- a/src/server/scripts/Spells/spell_generic.cpp
+++ b/src/server/scripts/Spells/spell_generic.cpp
@@ -1439,7 +1439,7 @@ class spell_gen_dungeon_credit : public SpellScriptLoader
_handled = true;
Unit* caster = GetCaster();
if (InstanceScript* instance = caster->GetInstanceScript())
- instance->UpdateEncounterState(ENCOUNTER_CREDIT_CAST_SPELL, GetSpellInfo()->Id, caster);
+ instance->UpdateEncounterStateForSpellCast(GetSpellInfo()->Id, caster);
}
void Register() override
diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp
index e5d313236d9..64cc2d34a4e 100644
--- a/src/server/scripts/Spells/spell_item.cpp
+++ b/src/server/scripts/Spells/spell_item.cpp
@@ -2836,7 +2836,7 @@ class spell_item_crystal_prison_dummy_dnd : public SpellScriptLoader
if (Creature* target = GetHitCreature())
if (target->isDead() && !target->IsPet())
{
- GetCaster()->SummonGameObject(OBJECT_IMPRISONED_DOOMGUARD, *target, G3D::Quat(), uint32(target->GetRespawnTime()-time(NULL)));
+ GetCaster()->SummonGameObject(OBJECT_IMPRISONED_DOOMGUARD, *target, QuaternionData(), uint32(target->GetRespawnTime()-time(NULL)));
target->DespawnOrUnsummon();
}
}
diff --git a/src/server/scripts/World/achievement_scripts.cpp b/src/server/scripts/World/achievement_scripts.cpp
index 9495970378c..a94bbc853e8 100644
--- a/src/server/scripts/World/achievement_scripts.cpp
+++ b/src/server/scripts/World/achievement_scripts.cpp
@@ -18,9 +18,8 @@
#include "ScriptMgr.h"
#include "BattlegroundSA.h"
#include "BattlegroundIC.h"
-#include "Vehicle.h"
-#include "Player.h"
#include "Creature.h"
+#include "Player.h"
class achievement_resilient_victory : public AchievementCriteriaScript
{
diff --git a/src/server/scripts/World/areatrigger_scripts.cpp b/src/server/scripts/World/areatrigger_scripts.cpp
index 59e3452c02f..45a42835858 100644
--- a/src/server/scripts/World/areatrigger_scripts.cpp
+++ b/src/server/scripts/World/areatrigger_scripts.cpp
@@ -36,8 +36,12 @@ at_area_52_entrance
EndContentData */
#include "ScriptMgr.h"
+#include "GameObject.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
#include "Player.h"
+#include "TemporarySummon.h"
+#include "World.h"
/*######
## at_coilfang_waterfall
diff --git a/src/server/scripts/World/boss_emerald_dragons.cpp b/src/server/scripts/World/boss_emerald_dragons.cpp
index c674a32f43f..ab490ec4a59 100644
--- a/src/server/scripts/World/boss_emerald_dragons.cpp
+++ b/src/server/scripts/World/boss_emerald_dragons.cpp
@@ -16,13 +16,12 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ObjectMgr.h"
#include "ScriptMgr.h"
+#include "ObjectAccessor.h"
+#include "PassiveAI.h"
#include "ScriptedCreature.h"
+#include "SpellInfo.h"
#include "SpellScript.h"
-#include "Spell.h"
-#include "SpellAuraEffects.h"
-#include "PassiveAI.h"
//
// Emerald Dragon NPCs and IDs (kept here for reference)
@@ -770,11 +769,7 @@ class spell_mark_of_nature : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_MARK_OF_NATURE))
- return false;
- if (!sSpellMgr->GetSpellInfo(SPELL_AURA_OF_NATURE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_MARK_OF_NATURE, SPELL_AURA_OF_NATURE });
}
void FilterTargets(std::list<WorldObject*>& targets)
diff --git a/src/server/scripts/World/go_scripts.cpp b/src/server/scripts/World/go_scripts.cpp
index 4f7015bd222..835407a0a4e 100644
--- a/src/server/scripts/World/go_scripts.cpp
+++ b/src/server/scripts/World/go_scripts.cpp
@@ -45,13 +45,13 @@ go_toy_train_set
EndContentData */
#include "ScriptMgr.h"
+#include "GameObject.h"
#include "GameObjectAI.h"
#include "Log.h"
#include "Player.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
-#include "Spell.h"
-#include "WorldSession.h"
+#include "TemporarySummon.h"
/*######
## go_cat_figurine
@@ -864,7 +864,8 @@ enum PrisonersOfWyrmskull
NPC_PRISONER_PRIEST = 24086,
NPC_PRISONER_MAGE = 24088,
NPC_PRISONER_WARRIOR = 24089,
- NPC_PRISONER_PALADIN = 24090
+ NPC_PRISONER_PALADIN = 24090,
+ NPC_CAPTURED_VALGARDE_PRISONER_PROXY = 24124
};
class go_dragonflayer_cage : public GameObjectScript
@@ -893,13 +894,9 @@ public:
if (!pPrisoner || !pPrisoner->IsAlive())
return true;
- Quest const* qInfo = sObjectMgr->GetQuestTemplate(QUEST_PRISONERS_OF_WYRMSKULL);
- if (qInfo)
- {
- /// @todo prisoner should help player for a short period of time
- player->KilledMonsterCredit(qInfo->Objectives[0].ObjectID);
- pPrisoner->DisappearAndDie();
- }
+ /// @todo prisoner should help player for a short period of time
+ player->KilledMonsterCredit(NPC_CAPTURED_VALGARDE_PRISONER_PROXY);
+ pPrisoner->DespawnOrUnsummon();
return true;
}
};
diff --git a/src/server/scripts/World/guards.cpp b/src/server/scripts/World/guards.cpp
index b3a12d11f9d..7ff2a090353 100644
--- a/src/server/scripts/World/guards.cpp
+++ b/src/server/scripts/World/guards.cpp
@@ -30,8 +30,8 @@ guard_shattrath_scryer
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "GuardAI.h"
+#include "ObjectAccessor.h"
#include "Player.h"
#include "SpellInfo.h"
diff --git a/src/server/scripts/World/item_scripts.cpp b/src/server/scripts/World/item_scripts.cpp
index 05f9054ab48..7b93769cbe6 100644
--- a/src/server/scripts/World/item_scripts.cpp
+++ b/src/server/scripts/World/item_scripts.cpp
@@ -31,9 +31,13 @@ item_only_for_flight Items which should only useable while flying
EndContentData */
#include "ScriptMgr.h"
+#include "GameObject.h"
+#include "Item.h"
+#include "Player.h"
#include "ScriptedCreature.h"
#include "Spell.h"
-#include "Player.h"
+#include "SpellMgr.h"
+#include "TemporarySummon.h"
/*#####
# item_only_for_flight
@@ -241,7 +245,7 @@ public:
float x, y, z;
go->GetClosePoint(x, y, z, go->GetObjectSize() / 3, 7.0f);
- go->SummonGameObject(GO_HIGH_QUALITY_FUR, *go, G3D::Quat(), 1);
+ go->SummonGameObject(GO_HIGH_QUALITY_FUR, *go, QuaternionData(), 1);
if (TempSummon* summon = player->SummonCreature(NPC_NESINGWARY_TRAPPER, x, y, z, go->GetOrientation(), TEMPSUMMON_DEAD_DESPAWN, 1000))
{
summon->SetVisible(false);
@@ -275,7 +279,7 @@ public:
if (!player->GetTransport() || player->GetAreaId() != AREA_ID_SHATTERED_STRAITS)
{
- if (const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(SPELL_PETROV_BOMB))
+ if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(SPELL_PETROV_BOMB))
Spell::SendCastResult(player, spellInfo, 0, castId, SPELL_FAILED_NOT_HERE);
return true;
diff --git a/src/server/scripts/World/mob_generic_creature.cpp b/src/server/scripts/World/mob_generic_creature.cpp
index 6fee5b870b9..c7feb0a64fc 100644
--- a/src/server/scripts/World/mob_generic_creature.cpp
+++ b/src/server/scripts/World/mob_generic_creature.cpp
@@ -17,8 +17,9 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "PassiveAI.h"
+#include "ScriptedCreature.h"
+#include "SpellMgr.h"
class trigger_periodic : public CreatureScript
{
diff --git a/src/server/scripts/World/npc_innkeeper.cpp b/src/server/scripts/World/npc_innkeeper.cpp
index 8c321c82664..261e94c1ee9 100644
--- a/src/server/scripts/World/npc_innkeeper.cpp
+++ b/src/server/scripts/World/npc_innkeeper.cpp
@@ -24,10 +24,10 @@ SDCategory: NPCs
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
#include "GameEventMgr.h"
#include "Player.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "WorldSession.h"
enum Spells
diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp
index 9987168141c..2d42afd23ff 100644
--- a/src/server/scripts/World/npcs_special.cpp
+++ b/src/server/scripts/World/npcs_special.cpp
@@ -17,24 +17,24 @@
*/
#include "ScriptMgr.h"
-#include "Cell.h"
#include "CellImpl.h"
#include "CreatureTextMgr.h"
#include "GameEventMgr.h"
+#include "GameObject.h"
#include "GameObjectAI.h"
-#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "Log.h"
+#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "PassiveAI.h"
-#include "Pet.h"
-#include "ScriptedCreature.h"
+#include "Player.h"
+#include "QuestDef.h"
#include "ScriptedEscortAI.h"
#include "ScriptedGossip.h"
-#include "ScriptMgr.h"
#include "SpellAuras.h"
#include "SpellHistory.h"
-#include "World.h"
+#include "SpellInfo.h"
+#include "TemporarySummon.h"
/*########
# npc_air_force_bots
@@ -2080,7 +2080,7 @@ public:
float displacement = 0.7f;
for (uint8 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(), G3D::Quat(), 1);
+ me->SummonGameObject(GetFireworkGameObjectId(), me->GetPositionX() + (i % 2 == 0 ? displacement : -displacement), me->GetPositionY() + (i > 1 ? displacement : -displacement), me->GetPositionZ() + 4.0f, me->GetOrientation(), QuaternionData(), 1);
}
else
//me->CastSpell(me, GetFireworkSpell(me->GetEntry()), true);