aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts
diff options
context:
space:
mode:
authorariel- <ariel-@users.noreply.github.com>2017-06-19 23:20:06 -0300
committerariel- <ariel-@users.noreply.github.com>2017-06-19 23:20:06 -0300
commit85a7d5ce9ac68b30da2277cc91d4b70358f1880d (patch)
treedf3d2084ee2e35008903c03178039b9c986e2d08 /src/server/scripts
parent052fc24315ace866ea1cf610e85df119b68100c9 (diff)
Core: ported headers cleanup from master branch
Diffstat (limited to 'src/server/scripts')
-rw-r--r--src/server/scripts/Commands/cs_account.cpp63
-rw-r--r--src/server/scripts/Commands/cs_achievement.cpp5
-rw-r--r--src/server/scripts/Commands/cs_ahbot.cpp51
-rw-r--r--src/server/scripts/Commands/cs_arena.cpp21
-rw-r--r--src/server/scripts/Commands/cs_ban.cpp31
-rw-r--r--src/server/scripts/Commands/cs_bf.cpp17
-rw-r--r--src/server/scripts/Commands/cs_cast.cpp33
-rw-r--r--src/server/scripts/Commands/cs_character.cpp34
-rw-r--r--src/server/scripts/Commands/cs_cheat.cpp24
-rw-r--r--src/server/scripts/Commands/cs_debug.cpp100
-rw-r--r--src/server/scripts/Commands/cs_deserter.cpp11
-rw-r--r--src/server/scripts/Commands/cs_disable.cpp20
-rw-r--r--src/server/scripts/Commands/cs_event.cpp9
-rw-r--r--src/server/scripts/Commands/cs_gm.cpp15
-rw-r--r--src/server/scripts/Commands/cs_go.cpp40
-rw-r--r--src/server/scripts/Commands/cs_gobject.cpp52
-rw-r--r--src/server/scripts/Commands/cs_group.cpp16
-rw-r--r--src/server/scripts/Commands/cs_guild.cpp20
-rw-r--r--src/server/scripts/Commands/cs_honor.cpp11
-rw-r--r--src/server/scripts/Commands/cs_instance.cpp16
-rw-r--r--src/server/scripts/Commands/cs_learn.cpp31
-rw-r--r--src/server/scripts/Commands/cs_lfg.cpp16
-rw-r--r--src/server/scripts/Commands/cs_list.cpp24
-rw-r--r--src/server/scripts/Commands/cs_lookup.cpp23
-rw-r--r--src/server/scripts/Commands/cs_message.cpp16
-rw-r--r--src/server/scripts/Commands/cs_misc.cpp114
-rw-r--r--src/server/scripts/Commands/cs_mmaps.cpp23
-rw-r--r--src/server/scripts/Commands/cs_modify.cpp91
-rw-r--r--src/server/scripts/Commands/cs_npc.cpp21
-rw-r--r--src/server/scripts/Commands/cs_pet.cpp14
-rw-r--r--src/server/scripts/Commands/cs_quest.cpp21
-rw-r--r--src/server/scripts/Commands/cs_rbac.cpp35
-rw-r--r--src/server/scripts/Commands/cs_reload.cpp211
-rw-r--r--src/server/scripts/Commands/cs_reset.cpp13
-rw-r--r--src/server/scripts/Commands/cs_send.cpp33
-rw-r--r--src/server/scripts/Commands/cs_server.cpp12
-rw-r--r--src/server/scripts/Commands/cs_tele.cpp23
-rw-r--r--src/server/scripts/Commands/cs_ticket.cpp50
-rw-r--r--src/server/scripts/Commands/cs_titles.cpp9
-rw-r--r--src/server/scripts/Commands/cs_wp.cpp51
-rw-r--r--src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp1
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp28
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.h9
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_ambassador_flamelash.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_coren_direbrew.cpp45
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_general_angerforge.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_high_interrogator_gerstahn.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_magmus.cpp5
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_moira_bronzebeard.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_tomb_of_seven.cpp9
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp255
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/blackrock_spire.h8
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_drakkisath.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_gizrul_the_slavener.cpp5
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_gyth.cpp7
-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.cpp41
-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.cpp21
-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.cpp23
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/blackwing_lair.h10
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_broodlord_lashlayer.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_chromaggus.cpp9
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_ebonroc.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_firemaw.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_flamegor.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp14
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_razorgore.cpp12
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp11
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/instance_blackwing_lair.cpp11
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_baron_geddon.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_garr.cpp8
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_gehennas.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_golemagg.cpp10
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_lucifron.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_magmadar.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_majordomo_executus.cpp12
-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.cpp8
-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.cpp8
-rw-r--r--src/server/scripts/EasternKingdoms/Deadmines/deadmines.cpp7
-rw-r--r--src/server/scripts/EasternKingdoms/Deadmines/deadmines.h9
-rw-r--r--src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp28
-rw-r--r--src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp30
-rw-r--r--src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.h9
-rw-r--r--src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp10
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp12
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp19
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp9
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp16
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp22
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp13
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp35
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp7
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp19
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/karazhan.h4
-rw-r--r--src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp39
-rw-r--r--src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp31
-rw-r--r--src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp9
-rw-r--r--src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp7
-rw-r--r--src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp16
-rw-r--r--src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp8
-rw-r--r--src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.h9
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp27
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp14
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp16
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp11
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp50
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp5
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_houndmaster_loksey.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp13
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp20
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/scarlet_monastery.h4
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp40
-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.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_illucia_barov.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_jandice_barov.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_kirtonos_the_herald.cpp28
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_kormok.cpp13
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_lord_alexei_barov.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_the_ravenian.cpp4
-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/boss_apothecary_hummel.cpp20
-rw-r--r--src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp11
-rw-r--r--src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp18
-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.cpp3
-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.cpp12
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp18
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/stratholme.h9
-rw-r--r--src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp8
-rw-r--r--src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.cpp11
-rw-r--r--src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.h9
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp13
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp16
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp15
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp21
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp16
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.h4
-rw-r--r--src/server/scripts/EasternKingdoms/TheStockade/instance_the_stockade.cpp1
-rw-r--r--src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp24
-rw-r--r--src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp12
-rw-r--r--src/server/scripts/EasternKingdoms/Uldaman/uldaman.cpp10
-rw-r--r--src/server/scripts/EasternKingdoms/Uldaman/uldaman.h9
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp17
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp15
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp16
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp7
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp5
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp13
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/zulaman.h8
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp10
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_grilek.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_hazzarah.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp9
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp7
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp7
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp12
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_wushoolay.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp20
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/zulgurub.h9
-rw-r--r--src/server/scripts/EasternKingdoms/zone_blasted_lands.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/zone_duskwood.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/zone_ghostlands.cpp7
-rw-r--r--src/server/scripts/EasternKingdoms/zone_hinterlands.cpp5
-rw-r--r--src/server/scripts/EasternKingdoms/zone_silverpine_forest.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/zone_stormwind_city.cpp8
-rw-r--r--src/server/scripts/EasternKingdoms/zone_stranglethorn_vale.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/zone_swamp_of_sorrows.cpp19
-rw-r--r--src/server/scripts/EasternKingdoms/zone_tirisfal_glades.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/zone_undercity.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/zone_western_plaguelands.cpp2
-rw-r--r--src/server/scripts/Events/childrens_week.cpp4
-rw-r--r--src/server/scripts/Events/fireworks_show.cpp115
-rw-r--r--src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp18
-rw-r--r--src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.h9
-rw-r--r--src/server/scripts/Kalimdor/BlackfathomDeeps/boss_aku_mai.cpp2
-rw-r--r--src/server/scripts/Kalimdor/BlackfathomDeeps/boss_gelihast.cpp2
-rw-r--r--src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp2
-rw-r--r--src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp12
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp15
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp23
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp9
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp17
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp7
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp11
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.h9
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp35
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h1
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp91
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp12
-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.cpp6
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp7
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp2
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm_the_fleshcrafter.cpp2
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp16
-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.cpp9
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp3
-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.cpp14
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp8
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp18
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.h9
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/boss_aeonus.cpp5
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/boss_chrono_lord_deja.cpp5
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/boss_temporus.cpp6
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/instance_the_black_morass.cpp14
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.cpp14
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.h9
-rw-r--r--src/server/scripts/Kalimdor/DireMaul/instance_dire_maul.cpp2
-rw-r--r--src/server/scripts/Kalimdor/Maraudon/boss_celebras_the_cursed.cpp3
-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.cpp18
-rw-r--r--src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp11
-rw-r--r--src/server/scripts/Kalimdor/OnyxiasLair/onyxias_lair.h10
-rw-r--r--src/server/scripts/Kalimdor/RagefireChasm/instance_ragefire_chasm.cpp1
-rw-r--r--src/server/scripts/Kalimdor/RazorfenDowns/boss_amnennar_the_coldbringer.cpp2
-rw-r--r--src/server/scripts/Kalimdor/RazorfenDowns/boss_glutton.cpp2
-rw-r--r--src/server/scripts/Kalimdor/RazorfenDowns/boss_mordresh_fire_eye.cpp2
-rw-r--r--src/server/scripts/Kalimdor/RazorfenDowns/boss_tuten_kash.cpp2
-rw-r--r--src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp6
-rw-r--r--src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp23
-rw-r--r--src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.h6
-rw-r--r--src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp9
-rw-r--r--src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp9
-rw-r--r--src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.h10
-rw-r--r--src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp11
-rw-r--r--src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp18
-rw-r--r--src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp13
-rw-r--r--src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp2
-rw-r--r--src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp27
-rw-r--r--src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_rajaxx.cpp6
-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.cpp11
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp30
-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.cpp4
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_sartura.cpp5
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp9
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp30
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp10
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp134
-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.cpp7
-rw-r--r--src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp30
-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.cpp11
-rw-r--r--src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp26
-rw-r--r--src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.h9
-rw-r--r--src/server/scripts/Kalimdor/boss_azuregos.cpp10
-rw-r--r--src/server/scripts/Kalimdor/zone_ashenvale.cpp6
-rw-r--r--src/server/scripts/Kalimdor/zone_azshara.cpp10
-rw-r--r--src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp15
-rw-r--r--src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp21
-rw-r--r--src/server/scripts/Kalimdor/zone_darkshore.cpp2
-rw-r--r--src/server/scripts/Kalimdor/zone_desolace.cpp7
-rw-r--r--src/server/scripts/Kalimdor/zone_durotar.cpp26
-rw-r--r--src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp18
-rw-r--r--src/server/scripts/Kalimdor/zone_felwood.cpp3
-rw-r--r--src/server/scripts/Kalimdor/zone_feralas.cpp7
-rw-r--r--src/server/scripts/Kalimdor/zone_moonglade.cpp14
-rw-r--r--src/server/scripts/Kalimdor/zone_orgrimmar.cpp11
-rw-r--r--src/server/scripts/Kalimdor/zone_silithus.cpp23
-rw-r--r--src/server/scripts/Kalimdor/zone_tanaris.cpp9
-rw-r--r--src/server/scripts/Kalimdor/zone_the_barrens.cpp12
-rw-r--r--src/server/scripts/Kalimdor/zone_thousand_needles.cpp6
-rw-r--r--src/server/scripts/Kalimdor/zone_ungoro_crater.cpp6
-rw-r--r--src/server/scripts/Kalimdor/zone_winterspring.cpp39
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/ahnkahet.h6
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp16
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_elder_nadox.cpp15
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp16
-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.cpp22
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp7
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/AzjolNerub/azjol_nerub.h9
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp27
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp40
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp34
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp40
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp10
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/instance_obsidian_sanctum.cpp3
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.cpp20
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.h8
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp7
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp6
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp54
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp9
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp13
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.cpp11
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.h25
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp22
-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.cpp22
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp21
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp13
-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.cpp27
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp95
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp21
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp51
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp40
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp28
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp89
-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.cpp16
-rw-r--r--src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp4
-rw-r--r--src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp23
-rw-r--r--src/server/scripts/Northrend/DraktharonKeep/drak_tharon_keep.h8
-rw-r--r--src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp6
-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.cpp26
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp8
-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.cpp8
-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.h32
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp7
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp26
-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.cpp14
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp10
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp15
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp36
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp24
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp36
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.h22
-rw-r--r--src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp4
-rw-r--r--src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp8
-rw-r--r--src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp4
-rw-r--r--src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp10
-rw-r--r--src/server/scripts/Northrend/Gundrak/gundrak.h4
-rw-r--r--src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp13
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp28
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp41
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp35
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp20
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp84
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp24
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp19
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp57
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp24
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp48
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp110
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp18
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp73
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h47
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel_teleport.cpp6
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp22
-rw-r--r--src/server/scripts/Northrend/IsleOfConquest/isle_of_conquest.cpp20
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp8
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp9
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp25
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp14
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp30
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp17
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp20
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp30
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_loatheb.cpp11
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp16
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_noth.cpp5
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp11
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp9
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp19
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp59
-rw-r--r--src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp13
-rw-r--r--src/server/scripts/Northrend/Naxxramas/naxxramas.h17
-rw-r--r--src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp89
-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.cpp12
-rw-r--r--src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp9
-rw-r--r--src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp15
-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.cpp6
-rw-r--r--src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp6
-rw-r--r--src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp3
-rw-r--r--src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp13
-rw-r--r--src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp26
-rw-r--r--src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp31
-rw-r--r--src/server/scripts/Northrend/Nexus/Oculus/oculus.h8
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp8
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp11
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp6
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp15
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfLightning/halls_of_lightning.h8
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp28
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp5
-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.cpp5
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp10
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.h8
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp24
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp33
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_assembly_of_iron.cpp19
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp2
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp26
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp14
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp29
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp15
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp13
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp10
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp115
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp22
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp49
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp41
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp98
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp16
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h6
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp13
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp5
-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.cpp22
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp21
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.h8
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp18
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp33
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp7
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp6
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_utgarde_pinnacle.cpp3
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/utgarde_pinnacle.h6
-rw-r--r--src/server/scripts/Northrend/VaultOfArchavon/boss_archavon.cpp25
-rw-r--r--src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp8
-rw-r--r--src/server/scripts/Northrend/VaultOfArchavon/boss_koralon.cpp17
-rw-r--r--src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp10
-rw-r--r--src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp10
-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.cpp3
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp25
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp1
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_moragg.cpp3
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp8
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp1
-rw-r--r--src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp30
-rw-r--r--src/server/scripts/Northrend/VioletHold/violet_hold.cpp117
-rw-r--r--src/server/scripts/Northrend/VioletHold/violet_hold.h4
-rw-r--r--src/server/scripts/Northrend/zone_borean_tundra.cpp42
-rw-r--r--src/server/scripts/Northrend/zone_crystalsong_forest.cpp3
-rw-r--r--src/server/scripts/Northrend/zone_dalaran.cpp13
-rw-r--r--src/server/scripts/Northrend/zone_dragonblight.cpp16
-rw-r--r--src/server/scripts/Northrend/zone_grizzly_hills.cpp23
-rw-r--r--src/server/scripts/Northrend/zone_howling_fjord.cpp12
-rw-r--r--src/server/scripts/Northrend/zone_icecrown.cpp6
-rw-r--r--src/server/scripts/Northrend/zone_sholazar_basin.cpp18
-rw-r--r--src/server/scripts/Northrend/zone_storm_peaks.cpp62
-rw-r--r--src/server/scripts/Northrend/zone_wintergrasp.cpp55
-rw-r--r--src/server/scripts/Northrend/zone_zuldrak.cpp103
-rw-r--r--src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp30
-rw-r--r--src/server/scripts/OutdoorPvP/OutdoorPvPEP.h2
-rw-r--r--src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp8
-rw-r--r--src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp244
-rw-r--r--src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp19
-rw-r--r--src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp86
-rw-r--r--src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp78
-rw-r--r--src/server/scripts/OutdoorPvP/OutdoorPvPZM.h12
-rw-r--r--src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/auchenai_crypts.h8
-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.cpp11
-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.cpp9
-rw-r--r--src/server/scripts/Outland/Auchindoun/ManaTombs/instance_mana_tombs.cpp1
-rw-r--r--src/server/scripts/Outland/Auchindoun/ManaTombs/mana_tombs.h8
-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.cpp4
-rw-r--r--src/server/scripts/Outland/Auchindoun/SethekkHalls/instance_sethekk_halls.cpp5
-rw-r--r--src/server/scripts/Outland/Auchindoun/SethekkHalls/sethekk_halls.h8
-rw-r--r--src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp4
-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.cpp9
-rw-r--r--src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp9
-rw-r--r--src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp5
-rw-r--r--src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/shadow_labyrinth.cpp4
-rw-r--r--src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/shadow_labyrinth.h8
-rw-r--r--src/server/scripts/Outland/BlackTemple/black_temple.cpp13
-rw-r--r--src/server/scripts/Outland/BlackTemple/black_temple.h6
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_gurtogg_bloodboil.cpp12
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_illidan.cpp62
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_illidari_council.cpp51
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp26
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp16
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp20
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_supremus.cpp6
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp37
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp16
-rw-r--r--src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp7
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp23
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp7
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp22
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp31
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp54
-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.cpp22
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/serpent_shrine.h9
-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.cpp9
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp4
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SteamVault/steam_vault.h6
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_ahune.cpp64
-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.cpp2
-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.cpp20
-rw-r--r--src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp13
-rw-r--r--src/server/scripts/Outland/GruulsLair/gruuls_lair.h8
-rw-r--r--src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp54
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/BloodFurnace/blood_furnace.h6
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp15
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp4
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp32
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp9
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp15
-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.cpp35
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp7
-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.cpp5
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp38
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/shattered_halls.cpp15
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/shattered_halls.h20
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp20
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp29
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp33
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp9
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp18
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/the_eye.cpp2
-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.cpp29
-rw-r--r--src/server/scripts/Outland/TempestKeep/Mechanar/boss_nethermancer_sepethrea.cpp8
-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.cpp35
-rw-r--r--src/server/scripts/Outland/TempestKeep/Mechanar/mechanar.h9
-rw-r--r--src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp6
-rw-r--r--src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.h8
-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.cpp5
-rw-r--r--src/server/scripts/Outland/TempestKeep/arcatraz/boss_zereketh_the_unbound.cpp2
-rw-r--r--src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp24
-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.cpp4
-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.cpp10
-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.cpp10
-rw-r--r--src/server/scripts/Outland/zone_blades_edge_mountains.cpp24
-rw-r--r--src/server/scripts/Outland/zone_hellfire_peninsula.cpp8
-rw-r--r--src/server/scripts/Outland/zone_nagrand.cpp13
-rw-r--r--src/server/scripts/Outland/zone_netherstorm.cpp16
-rw-r--r--src/server/scripts/Outland/zone_shadowmoon_valley.cpp30
-rw-r--r--src/server/scripts/Outland/zone_terokkar_forest.cpp8
-rw-r--r--src/server/scripts/Outland/zone_zangarmarsh.cpp4
-rw-r--r--src/server/scripts/Pet/pet_dk.cpp5
-rw-r--r--src/server/scripts/Pet/pet_generic.cpp6
-rw-r--r--src/server/scripts/Pet/pet_hunter.cpp19
-rw-r--r--src/server/scripts/Pet/pet_mage.cpp9
-rw-r--r--src/server/scripts/ScriptPCH.cpp21
-rw-r--r--src/server/scripts/ScriptPCH.h30
-rw-r--r--src/server/scripts/Spells/spell_dk.cpp352
-rw-r--r--src/server/scripts/Spells/spell_druid.cpp223
-rw-r--r--src/server/scripts/Spells/spell_generic.cpp365
-rw-r--r--src/server/scripts/Spells/spell_holiday.cpp182
-rw-r--r--src/server/scripts/Spells/spell_hunter.cpp147
-rw-r--r--src/server/scripts/Spells/spell_item.cpp491
-rw-r--r--src/server/scripts/Spells/spell_mage.cpp152
-rw-r--r--src/server/scripts/Spells/spell_paladin.cpp308
-rw-r--r--src/server/scripts/Spells/spell_pet.cpp20
-rw-r--r--src/server/scripts/Spells/spell_priest.cpp133
-rw-r--r--src/server/scripts/Spells/spell_quest.cpp155
-rw-r--r--src/server/scripts/Spells/spell_rogue.cpp138
-rw-r--r--src/server/scripts/Spells/spell_shaman.cpp193
-rw-r--r--src/server/scripts/Spells/spell_warlock.cpp152
-rw-r--r--src/server/scripts/Spells/spell_warrior.cpp135
-rw-r--r--src/server/scripts/World/action_ip_logger.cpp6
-rw-r--r--src/server/scripts/World/areatrigger_scripts.cpp9
-rw-r--r--src/server/scripts/World/boss_emerald_dragons.cpp21
-rw-r--r--src/server/scripts/World/chat_log.cpp4
-rw-r--r--src/server/scripts/World/duel_reset.cpp7
-rw-r--r--src/server/scripts/World/go_scripts.cpp18
-rw-r--r--src/server/scripts/World/guards.cpp7
-rw-r--r--src/server/scripts/World/item_scripts.cpp40
-rw-r--r--src/server/scripts/World/mob_generic_creature.cpp7
-rw-r--r--src/server/scripts/World/npc_innkeeper.cpp4
-rw-r--r--src/server/scripts/World/npc_professions.cpp11
-rw-r--r--src/server/scripts/World/npcs_special.cpp57
658 files changed, 7414 insertions, 6900 deletions
diff --git a/src/server/scripts/Commands/cs_account.cpp b/src/server/scripts/Commands/cs_account.cpp
index 0b8dc77cba2..82c3e716a8d 100644
--- a/src/server/scripts/Commands/cs_account.cpp
+++ b/src/server/scripts/Commands/cs_account.cpp
@@ -24,9 +24,14 @@ EndScriptData */
#include "AccountMgr.h"
#include "Chat.h"
+#include "DatabaseEnv.h"
#include "Language.h"
+#include "Log.h"
#include "Player.h"
#include "ScriptMgr.h"
+#include "World.h"
+#include "WorldSession.h"
+#include <boost/asio/ip/address_v4.hpp>
class account_commandscript : public CommandScript
{
@@ -43,7 +48,7 @@ public:
static std::vector<ChatCommand> accountSetCommandTable =
{
{ "addon", rbac::RBAC_PERM_COMMAND_ACCOUNT_SET_ADDON, true, &HandleAccountSetAddonCommand, "" },
- { "sec", rbac::RBAC_PERM_COMMAND_ACCOUNT_SET_SEC, true, NULL, "", accountSetSecTable },
+ { "sec", rbac::RBAC_PERM_COMMAND_ACCOUNT_SET_SEC, true, nullptr, "", accountSetSecTable },
{ "gmlevel", rbac::RBAC_PERM_COMMAND_ACCOUNT_SET_GMLEVEL, true, &HandleAccountSetGmLevelCommand, "" },
{ "password", rbac::RBAC_PERM_COMMAND_ACCOUNT_SET_PASSWORD, true, &HandleAccountSetPasswordCommand, "" },
};
@@ -59,14 +64,14 @@ public:
{ "delete", rbac::RBAC_PERM_COMMAND_ACCOUNT_DELETE, true, &HandleAccountDeleteCommand, "" },
{ "email", rbac::RBAC_PERM_COMMAND_ACCOUNT_EMAIL, false, &HandleAccountEmailCommand, "" },
{ "onlinelist", rbac::RBAC_PERM_COMMAND_ACCOUNT_ONLINE_LIST, true, &HandleAccountOnlineListCommand, "" },
- { "lock", rbac::RBAC_PERM_COMMAND_ACCOUNT_LOCK, false, NULL, "", accountLockCommandTable },
- { "set", rbac::RBAC_PERM_COMMAND_ACCOUNT_SET, true, NULL, "", accountSetCommandTable },
+ { "lock", rbac::RBAC_PERM_COMMAND_ACCOUNT_LOCK, false, nullptr, "", accountLockCommandTable },
+ { "set", rbac::RBAC_PERM_COMMAND_ACCOUNT_SET, true, nullptr, "", accountSetCommandTable },
{ "password", rbac::RBAC_PERM_COMMAND_ACCOUNT_PASSWORD, false, &HandleAccountPasswordCommand, "" },
{ "", rbac::RBAC_PERM_COMMAND_ACCOUNT, false, &HandleAccountCommand, "" },
};
static std::vector<ChatCommand> commandTable =
{
- { "account", rbac::RBAC_PERM_COMMAND_ACCOUNT, true, NULL, "", accountCommandTable },
+ { "account", rbac::RBAC_PERM_COMMAND_ACCOUNT, true, nullptr, "", accountCommandTable },
};
return commandTable;
}
@@ -113,8 +118,8 @@ public:
///- %Parse the command line arguments
char* accountName = strtok((char*)args, " ");
- char* password = strtok(NULL, " ");
- char* possibleEmail = strtok(NULL, " ' ");
+ char* password = strtok(nullptr, " ");
+ char* possibleEmail = strtok(nullptr, " ' ");
if (possibleEmail)
email = possibleEmail;
@@ -196,7 +201,7 @@ public:
/// Commands not recommended call from chat, but support anyway
/// can delete only for account with less security
/// This is also reject self apply in fact
- if (handler->HasLowerSecurityAccount(NULL, accountId, true))
+ if (handler->HasLowerSecurityAccount(nullptr, accountId, true))
return false;
AccountOpResult result = AccountMgr::DeleteAccount(accountId);
@@ -286,7 +291,7 @@ public:
if (param == "on")
{
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_LOGON_COUNTRY);
- uint32 ip = inet_addr(handler->GetSession()->GetRemoteAddress().c_str());
+ uint32 ip = boost::asio::ip::address_v4::from_string(handler->GetSession()->GetRemoteAddress()).to_ulong();
EndianConvertReverse(ip);
stmt->setUInt32(0, ip);
PreparedQueryResult result = LoginDatabase.Query(stmt);
@@ -368,9 +373,9 @@ public:
}
char* oldEmail = strtok((char*)args, " ");
- char* password = strtok(NULL, " ");
- char* email = strtok(NULL, " ");
- char* emailConfirmation = strtok(NULL, " ");
+ char* password = strtok(nullptr, " ");
+ char* email = strtok(nullptr, " ");
+ char* emailConfirmation = strtok(nullptr, " ");
if (!oldEmail || !password || !email || !emailConfirmation)
{
@@ -462,9 +467,9 @@ public:
// Command is supposed to be: .account password [$oldpassword] [$newpassword] [$newpasswordconfirmation] [$emailconfirmation]
char* oldPassword = strtok((char*)args, " "); // This extracts [$oldpassword]
- char* newPassword = strtok(NULL, " "); // This extracts [$newpassword]
- char* passwordConfirmation = strtok(NULL, " "); // This extracts [$newpasswordconfirmation]
- char const* emailConfirmation = strtok(NULL, " "); // This defines the emailConfirmation variable, which is optional depending on sec type.
+ char* newPassword = strtok(nullptr, " "); // This extracts [$newpassword]
+ char* passwordConfirmation = strtok(nullptr, " "); // This extracts [$newpasswordconfirmation]
+ char const* emailConfirmation = strtok(nullptr, " "); // This defines the emailConfirmation variable, which is optional depending on sec type.
if (!emailConfirmation) // This extracts [$emailconfirmation]. If it doesn't exist, however...
emailConfirmation = ""; // ... it's simply "" for emailConfirmation.
@@ -580,7 +585,7 @@ public:
{
///- Get the command line arguments
char* account = strtok((char*)args, " ");
- char* exp = strtok(NULL, " ");
+ char* exp = strtok(nullptr, " ");
if (!account)
return false;
@@ -621,7 +626,7 @@ public:
// Let set addon state only for lesser (strong) security level
// or to self account
if (handler->GetSession() && handler->GetSession()->GetAccountId() != accountId &&
- handler->HasLowerSecurityAccount(NULL, accountId, true))
+ handler->HasLowerSecurityAccount(nullptr, accountId, true))
return false;
int expansion = atoi(exp); //get int anyway (0 if error)
@@ -653,8 +658,8 @@ public:
uint32 targetSecurity = 0;
uint32 gm = 0;
char* arg1 = strtok((char*)args, " ");
- char* arg2 = strtok(NULL, " ");
- char* arg3 = strtok(NULL, " ");
+ char* arg2 = strtok(nullptr, " ");
+ char* arg3 = strtok(nullptr, " ");
bool isAccountNameGiven = true;
if (!arg3)
@@ -689,7 +694,7 @@ public:
return false;
}
- // handler->getSession() == NULL only for console
+ // handler->getSession() == nullptr only for console
targetAccountId = (isAccountNameGiven) ? AccountMgr::GetId(targetAccountName) : handler->getSelectedPlayer()->GetSession()->GetAccountId();
int32 gmRealmID = (isAccountNameGiven) ? atoi(arg3) : atoi(arg2);
uint32 playerSecurity;
@@ -734,7 +739,7 @@ public:
return false;
}
- rbac::RBACData* rbac = isAccountNameGiven ? NULL : handler->getSelectedPlayer()->GetSession()->GetRBACData();
+ rbac::RBACData* rbac = isAccountNameGiven ? nullptr : handler->getSelectedPlayer()->GetSession()->GetRBACData();
sAccountMgr->UpdateAccountAccess(rbac, targetAccountId, uint8(gm), gmRealmID);
handler->PSendSysMessage(LANG_YOU_CHANGE_SECURITY, targetAccountName.c_str(), gm);
@@ -753,8 +758,8 @@ public:
///- Get the command line arguments
char* account = strtok((char*)args, " ");
- char* password = strtok(NULL, " ");
- char* passwordConfirmation = strtok(NULL, " ");
+ char* password = strtok(nullptr, " ");
+ char* passwordConfirmation = strtok(nullptr, " ");
if (!account || !password || !passwordConfirmation)
return false;
@@ -777,7 +782,7 @@ public:
/// can set password only for target with less security
/// This also restricts setting handler's own password
- if (handler->HasLowerSecurityAccount(NULL, targetAccountId, true))
+ if (handler->HasLowerSecurityAccount(nullptr, targetAccountId, true))
return false;
if (strcmp(password, passwordConfirmation) != 0)
@@ -818,8 +823,8 @@ public:
///- Get the command line arguments
char* account = strtok((char*)args, " ");
- char* email = strtok(NULL, " ");
- char* emailConfirmation = strtok(NULL, " ");
+ char* email = strtok(nullptr, " ");
+ char* emailConfirmation = strtok(nullptr, " ");
if (!account || !email || !emailConfirmation)
{
@@ -846,7 +851,7 @@ public:
/// can set email only for target with less security
/// This also restricts setting handler's own email.
- if (handler->HasLowerSecurityAccount(NULL, targetAccountId, true))
+ if (handler->HasLowerSecurityAccount(nullptr, targetAccountId, true))
return false;
if (strcmp(email, emailConfirmation) != 0)
@@ -894,8 +899,8 @@ public:
///- Get the command line arguments
char* account = strtok((char*)args, " ");
- char* email = strtok(NULL, " ");
- char* emailConfirmation = strtok(NULL, " ");
+ char* email = strtok(nullptr, " ");
+ char* emailConfirmation = strtok(nullptr, " ");
if (!account || !email || !emailConfirmation)
{
@@ -922,7 +927,7 @@ public:
/// can set email only for target with less security
/// This also restricts setting handler's own email.
- if (handler->HasLowerSecurityAccount(NULL, targetAccountId, true))
+ if (handler->HasLowerSecurityAccount(nullptr, targetAccountId, true))
return false;
if (strcmp(email, emailConfirmation) != 0)
diff --git a/src/server/scripts/Commands/cs_achievement.cpp b/src/server/scripts/Commands/cs_achievement.cpp
index ddfd35e17e4..8b84a598708 100644
--- a/src/server/scripts/Commands/cs_achievement.cpp
+++ b/src/server/scripts/Commands/cs_achievement.cpp
@@ -22,11 +22,12 @@ Comment: All achievement related commands
Category: commandscripts
EndScriptData */
+#include "ScriptMgr.h"
#include "AchievementMgr.h"
#include "Chat.h"
#include "Language.h"
#include "Player.h"
-#include "ScriptMgr.h"
+#include "RBAC.h"
class achievement_commandscript : public CommandScript
{
@@ -41,7 +42,7 @@ public:
};
static std::vector<ChatCommand> commandTable =
{
- { "achievement", rbac::RBAC_PERM_COMMAND_ACHIEVEMENT, false, NULL, "", achievementCommandTable },
+ { "achievement", rbac::RBAC_PERM_COMMAND_ACHIEVEMENT, false, nullptr, "", achievementCommandTable },
};
return commandTable;
}
diff --git a/src/server/scripts/Commands/cs_ahbot.cpp b/src/server/scripts/Commands/cs_ahbot.cpp
index 08fa562cdb6..fcbca458539 100644
--- a/src/server/scripts/Commands/cs_ahbot.cpp
+++ b/src/server/scripts/Commands/cs_ahbot.cpp
@@ -16,11 +16,12 @@
*/
#include "ScriptMgr.h"
+#include "AuctionHouseBot.h"
#include "Chat.h"
#include "Language.h"
-#include "AuctionHouseBot.h"
+#include "RBAC.h"
-static const uint32 ahbotQualityIds[MAX_AUCTION_QUALITY] =
+uint32 const ahbotQualityIds[MAX_AUCTION_QUALITY] =
{
LANG_AHBOT_QUALITY_GRAY, LANG_AHBOT_QUALITY_WHITE,
LANG_AHBOT_QUALITY_GREEN, LANG_AHBOT_QUALITY_BLUE,
@@ -57,8 +58,8 @@ public:
static std::vector<ChatCommand> ahbotCommandTable =
{
- { "items", rbac::RBAC_PERM_COMMAND_AHBOT_ITEMS, true, NULL, "", ahbotItemsAmountCommandTable },
- { "ratio", rbac::RBAC_PERM_COMMAND_AHBOT_RATIO, true, NULL, "", ahbotItemsRatioCommandTable },
+ { "items", rbac::RBAC_PERM_COMMAND_AHBOT_ITEMS, true, nullptr, "", ahbotItemsAmountCommandTable },
+ { "ratio", rbac::RBAC_PERM_COMMAND_AHBOT_RATIO, true, nullptr, "", ahbotItemsRatioCommandTable },
{ "rebuild", rbac::RBAC_PERM_COMMAND_AHBOT_REBUILD, true, &HandleAHBotRebuildCommand, "" },
{ "reload", rbac::RBAC_PERM_COMMAND_AHBOT_RELOAD, true, &HandleAHBotReloadCommand, "" },
{ "status", rbac::RBAC_PERM_COMMAND_AHBOT_STATUS, true, &HandleAHBotStatusCommand, "" },
@@ -66,13 +67,13 @@ public:
static std::vector<ChatCommand> commandTable =
{
- { "ahbot", rbac::RBAC_PERM_COMMAND_AHBOT, false, NULL, "", ahbotCommandTable },
+ { "ahbot", rbac::RBAC_PERM_COMMAND_AHBOT, false, nullptr, "", ahbotCommandTable },
};
return commandTable;
}
- static bool HandleAHBotItemsAmountCommand(ChatHandler* handler, const char* args)
+ static bool HandleAHBotItemsAmountCommand(ChatHandler* handler, char const* args)
{
uint32 qVals[MAX_AUCTION_QUALITY];
char* arg = strtok((char*)args, " ");
@@ -81,7 +82,7 @@ public:
if (!arg)
return false;
qVals[i] = atoi(arg);
- arg = strtok(NULL, " ");
+ arg = strtok(nullptr, " ");
}
sAuctionBot->SetItemsAmount(qVals);
@@ -93,7 +94,7 @@ public:
}
template <AuctionQuality Q>
- static bool HandleAHBotItemsAmountQualityCommand(ChatHandler* handler, const char* args)
+ static bool HandleAHBotItemsAmountQualityCommand(ChatHandler* handler, char const* args)
{
char* arg = strtok((char*)args, " ");
if (!arg)
@@ -107,7 +108,7 @@ public:
return true;
}
- static bool HandleAHBotItemsRatioCommand(ChatHandler* handler, const char* args)
+ static bool HandleAHBotItemsRatioCommand(ChatHandler* handler, char const* args)
{
uint32 rVal[MAX_AUCTION_QUALITY];
char* arg = strtok((char*)args, " ");
@@ -116,7 +117,7 @@ public:
if (!arg)
return false;
rVal[i] = atoi(arg);
- arg = strtok(NULL, " ");
+ arg = strtok(nullptr, " ");
}
sAuctionBot->SetItemsRatio(rVal[0], rVal[1], rVal[2]);
@@ -127,7 +128,7 @@ public:
}
template<AuctionHouseType H>
- static bool HandleAHBotItemsRatioHouseCommand(ChatHandler* handler, const char* args)
+ static bool HandleAHBotItemsRatioHouseCommand(ChatHandler* handler, char const* args)
{
char* arg = strtok((char*)args, " ");
if (!arg)
@@ -139,7 +140,7 @@ public:
return true;
}
- static bool HandleAHBotRebuildCommand(ChatHandler* /*handler*/, const char* args)
+ static bool HandleAHBotRebuildCommand(ChatHandler* /*handler*/, char const* args)
{
char* arg = strtok((char*)args, " ");
@@ -151,14 +152,14 @@ public:
return true;
}
- static bool HandleAHBotReloadCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleAHBotReloadCommand(ChatHandler* handler, char const* /*args*/)
{
sAuctionBot->ReloadAllConfig();
handler->SendSysMessage(LANG_AHBOT_RELOAD_OK);
return true;
}
- static bool HandleAHBotStatusCommand(ChatHandler* handler, const char* args)
+ static bool HandleAHBotStatusCommand(ChatHandler* handler, char const* args)
{
char* arg = strtok((char*)args, " ");
if (!arg)
@@ -227,17 +228,17 @@ public:
};
-template bool ahbot_commandscript::HandleAHBotItemsAmountQualityCommand<AUCTION_QUALITY_GRAY>(ChatHandler* handler, const char*);
-template bool ahbot_commandscript::HandleAHBotItemsAmountQualityCommand<AUCTION_QUALITY_WHITE>(ChatHandler* handler, const char*);
-template bool ahbot_commandscript::HandleAHBotItemsAmountQualityCommand<AUCTION_QUALITY_GREEN>(ChatHandler* handler, const char*);
-template bool ahbot_commandscript::HandleAHBotItemsAmountQualityCommand<AUCTION_QUALITY_BLUE>(ChatHandler* handler, const char*);
-template bool ahbot_commandscript::HandleAHBotItemsAmountQualityCommand<AUCTION_QUALITY_PURPLE>(ChatHandler* handler, const char*);
-template bool ahbot_commandscript::HandleAHBotItemsAmountQualityCommand<AUCTION_QUALITY_ORANGE>(ChatHandler* handler, const char*);
-template bool ahbot_commandscript::HandleAHBotItemsAmountQualityCommand<AUCTION_QUALITY_YELLOW>(ChatHandler* handler, const char*);
-
-template bool ahbot_commandscript::HandleAHBotItemsRatioHouseCommand<AUCTION_HOUSE_ALLIANCE>(ChatHandler* handler, const char*);
-template bool ahbot_commandscript::HandleAHBotItemsRatioHouseCommand<AUCTION_HOUSE_HORDE>(ChatHandler* handler, const char*);
-template bool ahbot_commandscript::HandleAHBotItemsRatioHouseCommand<AUCTION_HOUSE_NEUTRAL>(ChatHandler* handler, const char*);
+template bool ahbot_commandscript::HandleAHBotItemsAmountQualityCommand<AUCTION_QUALITY_GRAY>(ChatHandler* handler, char const*);
+template bool ahbot_commandscript::HandleAHBotItemsAmountQualityCommand<AUCTION_QUALITY_WHITE>(ChatHandler* handler, char const*);
+template bool ahbot_commandscript::HandleAHBotItemsAmountQualityCommand<AUCTION_QUALITY_GREEN>(ChatHandler* handler, char const*);
+template bool ahbot_commandscript::HandleAHBotItemsAmountQualityCommand<AUCTION_QUALITY_BLUE>(ChatHandler* handler, char const*);
+template bool ahbot_commandscript::HandleAHBotItemsAmountQualityCommand<AUCTION_QUALITY_PURPLE>(ChatHandler* handler, char const*);
+template bool ahbot_commandscript::HandleAHBotItemsAmountQualityCommand<AUCTION_QUALITY_ORANGE>(ChatHandler* handler, char const*);
+template bool ahbot_commandscript::HandleAHBotItemsAmountQualityCommand<AUCTION_QUALITY_YELLOW>(ChatHandler* handler, char const*);
+
+template bool ahbot_commandscript::HandleAHBotItemsRatioHouseCommand<AUCTION_HOUSE_ALLIANCE>(ChatHandler* handler, char const*);
+template bool ahbot_commandscript::HandleAHBotItemsRatioHouseCommand<AUCTION_HOUSE_HORDE>(ChatHandler* handler, char const*);
+template bool ahbot_commandscript::HandleAHBotItemsRatioHouseCommand<AUCTION_HOUSE_NEUTRAL>(ChatHandler* handler, char const*);
void AddSC_ahbot_commandscript()
{
diff --git a/src/server/scripts/Commands/cs_arena.cpp b/src/server/scripts/Commands/cs_arena.cpp
index bfcb82d3eba..eef0b3c44f5 100644
--- a/src/server/scripts/Commands/cs_arena.cpp
+++ b/src/server/scripts/Commands/cs_arena.cpp
@@ -22,13 +22,16 @@ Comment: All arena team related commands
Category: commandscripts
EndScriptData */
-#include "ObjectMgr.h"
+#include "ScriptMgr.h"
+#include "ArenaTeamMgr.h"
+#include "CharacterCache.h"
#include "Chat.h"
#include "Language.h"
-#include "ArenaTeamMgr.h"
+#include "Log.h"
+#include "ObjectMgr.h"
#include "Player.h"
-#include "ScriptMgr.h"
-#include "CharacterCache.h"
+#include "RBAC.h"
+#include "WorldSession.h"
class arena_commandscript : public CommandScript
{
@@ -48,7 +51,7 @@ public:
};
static std::vector<ChatCommand> commandTable =
{
- { "arena", rbac::RBAC_PERM_COMMAND_ARENA, false, NULL, "", arenaCommandTable },
+ { "arena", rbac::RBAC_PERM_COMMAND_ARENA, false, nullptr, "", arenaCommandTable },
};
return commandTable;
}
@@ -59,10 +62,10 @@ public:
return false;
Player* target;
- if (!handler->extractPlayerTarget(*args != '"' ? (char*)args : NULL, &target))
+ if (!handler->extractPlayerTarget(*args != '"' ? (char*)args : nullptr, &target))
return false;
- char* tailStr = *args != '"' ? strtok(NULL, "") : (char*)args;
+ char* tailStr = *args != '"' ? strtok(nullptr, "") : (char*)args;
if (!tailStr)
return false;
@@ -70,7 +73,7 @@ public:
if (!name)
return false;
- char* typeStr = strtok(NULL, "");
+ char* typeStr = strtok(nullptr, "");
if (!typeStr)
return false;
@@ -168,7 +171,7 @@ public:
return false;
}
- char const* newArenaStr = handler->extractQuotedArg(strtok(NULL, ""));
+ char const* newArenaStr = handler->extractQuotedArg(strtok(nullptr, ""));
if (!newArenaStr)
{
handler->SendSysMessage(LANG_BAD_VALUE);
diff --git a/src/server/scripts/Commands/cs_ban.cpp b/src/server/scripts/Commands/cs_ban.cpp
index 9ccb904f7b4..5c390a34e11 100644
--- a/src/server/scripts/Commands/cs_ban.cpp
+++ b/src/server/scripts/Commands/cs_ban.cpp
@@ -22,14 +22,17 @@ Comment: All ban related commands
Category: commandscripts
EndScriptData */
+#include "ScriptMgr.h"
#include "AccountMgr.h"
#include "CharacterCache.h"
#include "Chat.h"
+#include "DatabaseEnv.h"
#include "Language.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Player.h"
-#include "ScriptMgr.h"
+#include "World.h"
+#include "WorldSession.h"
class ban_commandscript : public CommandScript
{
@@ -66,10 +69,10 @@ public:
};
static std::vector<ChatCommand> commandTable =
{
- { "ban", rbac::RBAC_PERM_COMMAND_BAN, true, NULL, "", banCommandTable },
- { "baninfo", rbac::RBAC_PERM_COMMAND_BANINFO, true, NULL, "", baninfoCommandTable },
- { "banlist", rbac::RBAC_PERM_COMMAND_BANLIST, true, NULL, "", banlistCommandTable },
- { "unban", rbac::RBAC_PERM_COMMAND_UNBAN, true, NULL, "", unbanCommandTable },
+ { "ban", rbac::RBAC_PERM_COMMAND_BAN, true, nullptr, "", banCommandTable },
+ { "baninfo", rbac::RBAC_PERM_COMMAND_BANINFO, true, nullptr, "", baninfoCommandTable },
+ { "banlist", rbac::RBAC_PERM_COMMAND_BANLIST, true, nullptr, "", banlistCommandTable },
+ { "unban", rbac::RBAC_PERM_COMMAND_UNBAN, true, nullptr, "", unbanCommandTable },
};
return commandTable;
}
@@ -90,11 +93,11 @@ public:
std::string name = nameStr;
- char* durationStr = strtok(NULL, " ");
+ char* durationStr = strtok(nullptr, " ");
if (!durationStr || !atoi(durationStr))
return false;
- char* reasonStr = strtok(NULL, "");
+ char* reasonStr = strtok(nullptr, "");
if (!reasonStr)
return false;
@@ -161,11 +164,11 @@ public:
std::string nameOrIP = cnameOrIP;
- char* durationStr = strtok(NULL, " ");
+ char* durationStr = strtok(nullptr, " ");
if (!durationStr || !atoi(durationStr))
return false;
- char* reasonStr = strtok(NULL, "");
+ char* reasonStr = strtok(nullptr, "");
if (!reasonStr)
return false;
@@ -278,7 +281,7 @@ public:
time_t unbanDate = time_t(fields[3].GetUInt32());
bool active = false;
- if (fields[2].GetBool() && (fields[1].GetUInt64() == uint64(0) || unbanDate >= time(NULL)))
+ if (fields[2].GetBool() && (fields[1].GetUInt64() == uint64(0) || unbanDate >= time(nullptr)))
active = true;
bool permanent = (fields[1].GetUInt64() == uint64(0));
std::string banTime = permanent ? handler->GetTrinityString(LANG_BANINFO_INFINITE) : secsToTimeString(fields[1].GetUInt64(), true);
@@ -336,7 +339,7 @@ public:
Field* fields = result->Fetch();
time_t unbanDate = time_t(fields[3].GetUInt32());
bool active = false;
- if (fields[2].GetUInt8() && (!fields[1].GetUInt32() || unbanDate >= time(NULL)))
+ if (fields[2].GetUInt8() && (!fields[1].GetUInt32() || unbanDate >= time(nullptr)))
active = true;
bool permanent = (fields[1].GetUInt32() == uint32(0));
std::string banTime = permanent ? handler->GetTrinityString(LANG_BANINFO_INFINITE) : secsToTimeString(fields[1].GetUInt32(), true);
@@ -382,7 +385,7 @@ public:
static bool HandleBanListAccountCommand(ChatHandler* handler, char const* args)
{
- PreparedStatement* stmt = NULL;
+ PreparedStatement* stmt = nullptr;
stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_EXPIRED_IP_BANS);
LoginDatabase.Execute(stmt);
@@ -425,7 +428,7 @@ public:
Field* fields = result->Fetch();
uint32 accountid = fields[0].GetUInt32();
- QueryResult banResult = LoginDatabase.PQuery("SELECT account.username FROM account, account_banned WHERE account_banned.id='%u' AND account_banned.id=account.id", accountid);
+ QueryResult banResult = LoginDatabase.PQuery("SELECT account.username FROM account, account_banned WHERE account_banned.id='%u' AND account_banned.id = account.id", accountid);
if (banResult)
{
Field* fields2 = banResult->Fetch();
@@ -584,7 +587,7 @@ public:
static bool HandleBanListIPCommand(ChatHandler* handler, char const* args)
{
- PreparedStatement* stmt = NULL;
+ PreparedStatement* stmt = nullptr;
stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_EXPIRED_IP_BANS);
LoginDatabase.Execute(stmt);
diff --git a/src/server/scripts/Commands/cs_bf.cpp b/src/server/scripts/Commands/cs_bf.cpp
index 6c4097a79b6..c2bcf60523d 100644
--- a/src/server/scripts/Commands/cs_bf.cpp
+++ b/src/server/scripts/Commands/cs_bf.cpp
@@ -23,8 +23,9 @@ Category: commandscripts
EndScriptData */
#include "ScriptMgr.h"
-#include "Chat.h"
#include "BattlefieldMgr.h"
+#include "Chat.h"
+#include "RBAC.h"
class bf_commandscript : public CommandScript
{
@@ -43,12 +44,12 @@ public:
};
static std::vector<ChatCommand> commandTable =
{
- { "bf", rbac::RBAC_PERM_COMMAND_BF, false, NULL, "", battlefieldcommandTable },
+ { "bf", rbac::RBAC_PERM_COMMAND_BF, false, nullptr, "", battlefieldcommandTable },
};
return commandTable;
}
- static bool HandleBattlefieldStart(ChatHandler* handler, const char* args)
+ static bool HandleBattlefieldStart(ChatHandler* handler, char const* args)
{
uint32 battleid = 0;
char* battleid_str = strtok((char*)args, " ");
@@ -70,7 +71,7 @@ public:
return true;
}
- static bool HandleBattlefieldEnd(ChatHandler* handler, const char* args)
+ static bool HandleBattlefieldEnd(ChatHandler* handler, char const* args)
{
uint32 battleid = 0;
char* battleid_str = strtok((char*)args, " ");
@@ -92,7 +93,7 @@ public:
return true;
}
- static bool HandleBattlefieldEnable(ChatHandler* handler, const char* args)
+ static bool HandleBattlefieldEnable(ChatHandler* handler, char const* args)
{
uint32 battleid = 0;
char* battleid_str = strtok((char*)args, " ");
@@ -122,7 +123,7 @@ public:
return true;
}
- static bool HandleBattlefieldSwitch(ChatHandler* handler, const char* args)
+ static bool HandleBattlefieldSwitch(ChatHandler* handler, char const* args)
{
uint32 battleid = 0;
char* battleid_str = strtok((char*)args, " ");
@@ -143,14 +144,14 @@ public:
return true;
}
- static bool HandleBattlefieldTimer(ChatHandler* handler, const char* args)
+ static bool HandleBattlefieldTimer(ChatHandler* handler, char const* args)
{
uint32 battleid = 0;
uint32 time = 0;
char* battleid_str = strtok((char*)args, " ");
if (!battleid_str)
return false;
- char* time_str = strtok(NULL, " ");
+ char* time_str = strtok(nullptr, " ");
if (!time_str)
return false;
diff --git a/src/server/scripts/Commands/cs_cast.cpp b/src/server/scripts/Commands/cs_cast.cpp
index 7806c1e42cd..3143c44d567 100644
--- a/src/server/scripts/Commands/cs_cast.cpp
+++ b/src/server/scripts/Commands/cs_cast.cpp
@@ -27,6 +27,9 @@ EndScriptData */
#include "Creature.h"
#include "Language.h"
#include "Player.h"
+#include "RBAC.h"
+#include "SpellMgr.h"
+#include "WorldSession.h"
class cast_commandscript : public CommandScript
{
@@ -46,7 +49,7 @@ public:
};
static std::vector<ChatCommand> commandTable =
{
- { "cast", rbac::RBAC_PERM_COMMAND_CAST, false, NULL, "", castCommandTable },
+ { "cast", rbac::RBAC_PERM_COMMAND_CAST, false, nullptr, "", castCommandTable },
};
return commandTable;
}
@@ -91,7 +94,7 @@ public:
if (!CheckSpellExistsAndIsValid(handler, spellId))
return false;
- char* triggeredStr = strtok(NULL, " ");
+ char* triggeredStr = strtok(nullptr, " ");
if (triggeredStr)
{
int l = strlen(triggeredStr);
@@ -99,7 +102,7 @@ public:
return false;
}
- TriggerCastFlags triggered = (triggeredStr != NULL) ? TRIGGERED_FULL_DEBUG_MASK : TRIGGERED_NONE;
+ TriggerCastFlags triggered = (triggeredStr != nullptr) ? TRIGGERED_FULL_DEBUG_MASK : TRIGGERED_NONE;
handler->GetSession()->GetPlayer()->CastSpell(target, spellId, triggered);
return true;
@@ -123,7 +126,7 @@ public:
if (!CheckSpellExistsAndIsValid(handler, spellId))
return false;
- char* triggeredStr = strtok(NULL, " ");
+ char* triggeredStr = strtok(nullptr, " ");
if (triggeredStr)
{
int l = strlen(triggeredStr);
@@ -131,7 +134,7 @@ public:
return false;
}
- TriggerCastFlags triggered = (triggeredStr != NULL) ? TRIGGERED_FULL_DEBUG_MASK : TRIGGERED_NONE;
+ TriggerCastFlags triggered = (triggeredStr != nullptr) ? TRIGGERED_FULL_DEBUG_MASK : TRIGGERED_NONE;
caster->CastSpell(handler->GetSession()->GetPlayer(), spellId, triggered);
return true;
@@ -150,14 +153,14 @@ public:
if (!CheckSpellExistsAndIsValid(handler, spellId))
return false;
- char* distStr = strtok(NULL, " ");
+ char* distStr = strtok(nullptr, " ");
float dist = 0;
if (distStr)
sscanf(distStr, "%f", &dist);
- char* triggeredStr = strtok(NULL, " ");
+ char* triggeredStr = strtok(nullptr, " ");
if (triggeredStr)
{
int l = strlen(triggeredStr);
@@ -165,7 +168,7 @@ public:
return false;
}
- TriggerCastFlags triggered = (triggeredStr != NULL) ? TRIGGERED_FULL_DEBUG_MASK : TRIGGERED_NONE;
+ TriggerCastFlags triggered = (triggeredStr != nullptr) ? TRIGGERED_FULL_DEBUG_MASK : TRIGGERED_NONE;
float x, y, z;
handler->GetSession()->GetPlayer()->GetClosePoint(x, y, z, dist);
@@ -219,7 +222,7 @@ public:
if (!CheckSpellExistsAndIsValid(handler, spellId))
return false;
- char* triggeredStr = strtok(NULL, " ");
+ char* triggeredStr = strtok(nullptr, " ");
if (triggeredStr)
{
int l = strlen(triggeredStr);
@@ -227,7 +230,7 @@ public:
return false;
}
- TriggerCastFlags triggered = (triggeredStr != NULL) ? TRIGGERED_FULL_DEBUG_MASK : TRIGGERED_NONE;
+ TriggerCastFlags triggered = (triggeredStr != nullptr) ? TRIGGERED_FULL_DEBUG_MASK : TRIGGERED_NONE;
caster->CastSpell(caster->GetVictim(), spellId, triggered);
return true;
@@ -251,9 +254,9 @@ public:
if (!CheckSpellExistsAndIsValid(handler, spellId))
return false;
- char* posX = strtok(NULL, " ");
- char* posY = strtok(NULL, " ");
- char* posZ = strtok(NULL, " ");
+ char* posX = strtok(nullptr, " ");
+ char* posY = strtok(nullptr, " ");
+ char* posZ = strtok(nullptr, " ");
if (!posX || !posY || !posZ)
return false;
@@ -262,7 +265,7 @@ public:
float y = float(atof(posY));
float z = float(atof(posZ));
- char* triggeredStr = strtok(NULL, " ");
+ char* triggeredStr = strtok(nullptr, " ");
if (triggeredStr)
{
int l = strlen(triggeredStr);
@@ -270,7 +273,7 @@ public:
return false;
}
- TriggerCastFlags triggered = (triggeredStr != NULL) ? TRIGGERED_FULL_DEBUG_MASK : TRIGGERED_NONE;
+ TriggerCastFlags triggered = (triggeredStr != nullptr) ? TRIGGERED_FULL_DEBUG_MASK : TRIGGERED_NONE;
caster->CastSpell(x, y, z, spellId, triggered);
return true;
diff --git a/src/server/scripts/Commands/cs_character.cpp b/src/server/scripts/Commands/cs_character.cpp
index 726e40db497..be11143c675 100644
--- a/src/server/scripts/Commands/cs_character.cpp
+++ b/src/server/scripts/Commands/cs_character.cpp
@@ -22,14 +22,20 @@ Comment: All character related commands
Category: commandscripts
EndScriptData */
+#include "ScriptMgr.h"
#include "AccountMgr.h"
#include "CharacterCache.h"
#include "Chat.h"
+#include "DatabaseEnv.h"
+#include "DBCStores.h"
+#include "Log.h"
+#include "ObjectAccessor.h"
#include "ObjectMgr.h"
-#include "PlayerDump.h"
#include "Player.h"
+#include "PlayerDump.h"
#include "ReputationMgr.h"
-#include "ScriptMgr.h"
+#include "World.h"
+#include "WorldSession.h"
class character_commandscript : public CommandScript
{
@@ -57,7 +63,7 @@ public:
{ "changefaction", rbac::RBAC_PERM_COMMAND_CHARACTER_CHANGEFACTION, true, &HandleCharacterChangeFactionCommand, "", },
{ "changerace", rbac::RBAC_PERM_COMMAND_CHARACTER_CHANGERACE, true, &HandleCharacterChangeRaceCommand, "", },
{ "changeaccount", rbac::RBAC_PERM_COMMAND_CHARACTER_CHANGEACCOUNT, true, &HandleCharacterChangeAccountCommand, "", },
- { "deleted", rbac::RBAC_PERM_COMMAND_CHARACTER_DELETED, true, NULL, "", characterDeletedCommandTable },
+ { "deleted", rbac::RBAC_PERM_COMMAND_CHARACTER_DELETED, true, nullptr, "", characterDeletedCommandTable },
{ "erase", rbac::RBAC_PERM_COMMAND_CHARACTER_ERASE, true, &HandleCharacterEraseCommand, "", },
{ "level", rbac::RBAC_PERM_COMMAND_CHARACTER_LEVEL, true, &HandleCharacterLevelCommand, "", },
{ "rename", rbac::RBAC_PERM_COMMAND_CHARACTER_RENAME, true, &HandleCharacterRenameCommand, "", },
@@ -67,9 +73,9 @@ public:
static std::vector<ChatCommand> commandTable =
{
- { "character", rbac::RBAC_PERM_COMMAND_CHARACTER, true, NULL, "", characterCommandTable },
+ { "character", rbac::RBAC_PERM_COMMAND_CHARACTER, true, nullptr, "", characterCommandTable },
{ "levelup", rbac::RBAC_PERM_COMMAND_LEVELUP, false, &HandleLevelUpCommand, "" },
- { "pdump", rbac::RBAC_PERM_COMMAND_PDUMP, true, NULL, "", pdumpCommandTable },
+ { "pdump", rbac::RBAC_PERM_COMMAND_PDUMP, true, nullptr, "", pdumpCommandTable },
};
return commandTable;
}
@@ -306,7 +312,7 @@ public:
if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
return false;
- char const* newNameStr = strtok(NULL, " ");
+ char const* newNameStr = strtok(nullptr, " ");
if (newNameStr)
{
@@ -324,7 +330,7 @@ public:
else
{
// check offline security
- if (handler->HasLowerSecurity(NULL, targetGuid))
+ if (handler->HasLowerSecurity(nullptr, targetGuid))
return false;
sCharacterCache->GetCharacterNameByGuid(targetGuid, playerOldName);
@@ -410,7 +416,7 @@ public:
else
{
// check offline security
- if (handler->HasLowerSecurity(NULL, targetGuid))
+ if (handler->HasLowerSecurity(nullptr, targetGuid))
return false;
std::string oldNameLink = handler->playerLink(targetName);
@@ -892,7 +898,7 @@ public:
if (levelStr && isalpha(levelStr[0]))
{
nameStr = levelStr;
- levelStr = NULL; // current level will be used
+ levelStr = nullptr; // current level will be used
}
Player* target;
@@ -931,7 +937,7 @@ public:
if (!fileStr)
return false;
- char* accountStr = strtok(NULL, " ");
+ char* accountStr = strtok(nullptr, " ");
if (!accountStr)
return false;
@@ -962,8 +968,8 @@ public:
return false;
}
- char* guidStr = NULL;
- char* nameStr = strtok(NULL, " ");
+ char* guidStr = nullptr;
+ char* nameStr = strtok(nullptr, " ");
std::string name;
if (nameStr)
@@ -984,7 +990,7 @@ public:
return false;
}
- guidStr = strtok(NULL, " ");
+ guidStr = strtok(nullptr, " ");
}
ObjectGuid::LowType guid = 0;
@@ -1039,7 +1045,7 @@ public:
return false;
char* fileStr = strtok((char*)args, " ");
- char* playerStr = strtok(NULL, " ");
+ char* playerStr = strtok(nullptr, " ");
if (!fileStr || !playerStr)
return false;
diff --git a/src/server/scripts/Commands/cs_cheat.cpp b/src/server/scripts/Commands/cs_cheat.cpp
index 3e2a0bb2541..c37f5ea1372 100644
--- a/src/server/scripts/Commands/cs_cheat.cpp
+++ b/src/server/scripts/Commands/cs_cheat.cpp
@@ -22,10 +22,12 @@ Comment: All cheat related commands
Category: commandscripts
EndScriptData */
+#include "ScriptMgr.h"
#include "Chat.h"
#include "Language.h"
#include "Player.h"
-#include "ScriptMgr.h"
+#include "RBAC.h"
+#include "WorldSession.h"
class cheat_commandscript : public CommandScript
{
@@ -49,12 +51,12 @@ public:
static std::vector<ChatCommand> commandTable =
{
- { "cheat", rbac::RBAC_PERM_COMMAND_CHEAT, false, NULL, "", cheatCommandTable },
+ { "cheat", rbac::RBAC_PERM_COMMAND_CHEAT, false, nullptr, "", cheatCommandTable },
};
return commandTable;
}
- static bool HandleGodModeCheatCommand(ChatHandler* handler, const char* args)
+ static bool HandleGodModeCheatCommand(ChatHandler* handler, char const* args)
{
if (!handler->GetSession() && !handler->GetSession()->GetPlayer())
return false;
@@ -80,7 +82,7 @@ public:
return false;
}
- static bool HandleCasttimeCheatCommand(ChatHandler* handler, const char* args)
+ static bool HandleCasttimeCheatCommand(ChatHandler* handler, char const* args)
{
if (!handler->GetSession() && !handler->GetSession()->GetPlayer())
return false;
@@ -106,7 +108,7 @@ public:
return false;
}
- static bool HandleCoolDownCheatCommand(ChatHandler* handler, const char* args)
+ static bool HandleCoolDownCheatCommand(ChatHandler* handler, char const* args)
{
if (!handler->GetSession() && !handler->GetSession()->GetPlayer())
return false;
@@ -132,7 +134,7 @@ public:
return false;
}
- static bool HandlePowerCheatCommand(ChatHandler* handler, const char* args)
+ static bool HandlePowerCheatCommand(ChatHandler* handler, char const* args)
{
if (!handler->GetSession() && !handler->GetSession()->GetPlayer())
return false;
@@ -158,12 +160,12 @@ public:
return false;
}
- static bool HandleCheatStatusCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleCheatStatusCommand(ChatHandler* handler, char const* /*args*/)
{
Player* player = handler->GetSession()->GetPlayer();
- const char* enabled = "ON";
- const char* disabled = "OFF";
+ char const* enabled = "ON";
+ char const* disabled = "OFF";
handler->SendSysMessage(LANG_COMMAND_CHEAT_STATUS);
handler->PSendSysMessage(LANG_COMMAND_CHEAT_GOD, player->GetCommandStatus(CHEAT_GOD) ? enabled : disabled);
@@ -176,7 +178,7 @@ public:
return true;
}
- static bool HandleWaterWalkCheatCommand(ChatHandler* handler, const char* args)
+ static bool HandleWaterWalkCheatCommand(ChatHandler* handler, char const* args)
{
if (!handler->GetSession() && !handler->GetSession()->GetPlayer())
return false;
@@ -204,7 +206,7 @@ public:
return false;
}
- static bool HandleTaxiCheatCommand(ChatHandler* handler, const char* args)
+ static bool HandleTaxiCheatCommand(ChatHandler* handler, char const* args)
{
std::string argstr = (char*)args;
Player* chr = handler->getSelectedPlayer();
diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp
index 3e3215232fb..c7319760bc7 100644
--- a/src/server/scripts/Commands/cs_debug.cpp
+++ b/src/server/scripts/Commands/cs_debug.cpp
@@ -23,20 +23,20 @@ Category: commandscripts
EndScriptData */
#include "ScriptMgr.h"
-#include "ObjectMgr.h"
+#include "Bag.h"
+#include "BattlefieldMgr.h"
#include "BattlegroundMgr.h"
-#include "Chat.h"
-#include "Cell.h"
#include "CellImpl.h"
-#include "GridNotifiers.h"
-#include "GridNotifiersImpl.h"
+#include "Chat.h"
#include "GossipDef.h"
-#include "Transport.h"
+#include "GridNotifiersImpl.h"
#include "Language.h"
-#include "MapManager.h"
+#include "Log.h"
#include "M2Stores.h"
-#include "BattlefieldMgr.h"
-
+#include "MapManager.h"
+#include "ObjectMgr.h"
+#include "RBAC.h"
+#include "Transport.h"
#include <fstream>
#include <limits>
@@ -121,28 +121,27 @@ public:
}
uint32 cinematicId = atoul(args);
- if (!sCinematicSequencesStore.LookupEntry(cinematicId))
+
+ CinematicSequencesEntry const* cineSeq = sCinematicSequencesStore.LookupEntry(cinematicId);
+ if (!cineSeq)
{
handler->PSendSysMessage(LANG_CINEMATIC_NOT_EXIST, cinematicId);
handler->SetSentErrorMessage(true);
return false;
}
+
// Dump camera locations
- if (CinematicSequencesEntry const* cineSeq = sCinematicSequencesStore.LookupEntry(cinematicId))
+ if (std::vector<FlyByCamera> const* flyByCameras = GetFlyByCameras(cineSeq->cinematicCamera))
{
- std::unordered_map<uint32, FlyByCameraCollection>::const_iterator itr = sFlyByCameraStore.find(cineSeq->cinematicCamera);
- if (itr != sFlyByCameraStore.end())
+ handler->PSendSysMessage("Waypoints for sequence %u, camera %u", cinematicId, cineSeq->cinematicCamera);
+ uint32 count = 1;
+ for (FlyByCamera const& cam : *flyByCameras)
{
- handler->PSendSysMessage("Waypoints for sequence %u, camera %u", cinematicId, cineSeq->cinematicCamera);
- uint32 count = 1 ;
- for (FlyByCamera cam : itr->second)
- {
- handler->PSendSysMessage("%02u - %7ums [%f, %f, %f] Facing %f (%f degrees)", count, cam.timeStamp, cam.locations.x, cam.locations.y, cam.locations.z, cam.locations.w, cam.locations.w * (180 / M_PI));
- count++;
- }
- handler->PSendSysMessage("%u waypoints dumped", itr->second.size());
+ handler->PSendSysMessage("%02u - %7ums [%s (%f degrees)]", count, cam.timeStamp, cam.locations.ToString().c_str(), cam.locations.GetOrientation() * (180 / M_PI));
+ ++count;
}
+ handler->PSendSysMessage("%u waypoints dumped", flyByCameras->size());
}
handler->GetSession()->GetPlayer()->SendCinematicStart(cinematicId);
@@ -250,10 +249,10 @@ public:
if (failNum == 0 && *result != '0')
return false;
- char* fail1 = strtok(NULL, " ");
+ char* fail1 = strtok(nullptr, " ");
uint8 failArg1 = fail1 ? (uint8)atoi(fail1) : 0;
- char* fail2 = strtok(NULL, " ");
+ char* fail2 = strtok(nullptr, " ");
uint8 failArg2 = fail2 ? (uint8)atoi(fail2) : 0;
WorldPacket data(SMSG_CAST_FAILED, 5);
@@ -266,7 +265,6 @@ public:
data << uint32(failArg2);
handler->GetSession()->SendPacket(&data);
-
return true;
}
@@ -276,7 +274,7 @@ public:
return false;
InventoryResult msg = InventoryResult(atoi(args));
- handler->GetSession()->GetPlayer()->SendEquipError(msg, NULL, NULL);
+ handler->GetSession()->GetPlayer()->SendEquipError(msg, nullptr, nullptr);
return true;
}
@@ -303,7 +301,7 @@ public:
static bool HandleDebugSendOpcodeCommand(ChatHandler* handler, char const* /*args*/)
{
Unit* unit = handler->getSelectedUnit();
- Player* player = NULL;
+ Player* player = nullptr;
if (!unit || (unit->GetTypeId() != TYPEID_PLAYER))
player = handler->GetSession()->GetPlayer();
else
@@ -466,7 +464,7 @@ public:
}
TC_LOG_DEBUG("network", "Sending opcode %u", data.GetOpcode());
data.hexlike();
- player->GetSession()->SendPacket(&data);
+ player->SendDirectMessage(&data);
handler->PSendSysMessage(LANG_COMMAND_OPCODESENT, data.GetOpcode(), unit->GetName().c_str());
return true;
}
@@ -474,7 +472,7 @@ public:
static bool HandleDebugUpdateWorldStateCommand(ChatHandler* handler, char const* args)
{
char* w = strtok((char*)args, " ");
- char* s = strtok(NULL, " ");
+ char* s = strtok(nullptr, " ");
if (!w || !s)
return false;
@@ -692,7 +690,7 @@ public:
continue;
}
- if (updateQueue[qp] == NULL)
+ if (updateQueue[qp] == nullptr)
{
handler->PSendSysMessage("The item with slot %d and guid %d has its queuepos (%d) pointing to NULL in the queue!", item->GetSlot(), item->GetGUID().GetCounter(), qp);
error = true;
@@ -760,7 +758,7 @@ public:
continue;
}
- if (updateQueue[qp] == NULL)
+ if (updateQueue[qp] == nullptr)
{
handler->PSendSysMessage("The item in bag %d at slot %d having guid %d has a queuepos (%d) that points to NULL in the queue!", bag->GetSlot(), item2->GetSlot(), item2->GetGUID().GetCounter(), qp);
error = true;
@@ -809,7 +807,7 @@ public:
Item* test = player->GetItemByPos(item->GetBagSlot(), item->GetSlot());
- if (test == NULL)
+ if (test == nullptr)
{
handler->PSendSysMessage("queue(%zu): The bag(%d) and slot(%d) values for %s are incorrect, the player doesn't have any item at that position!", i, item->GetBagSlot(), item->GetSlot(), item->GetGUID().ToString().c_str());
error = true;
@@ -848,7 +846,7 @@ public:
if (!target || target->IsTotem() || target->IsPet())
return false;
- ThreatContainer::StorageType const &threatList = target->getThreatManager().getThreatList();
+ ThreatContainer::StorageType const& threatList = target->getThreatManager().getThreatList();
ThreatContainer::StorageType::const_iterator itr;
uint32 count = 0;
handler->PSendSysMessage("Threat list of %s (guid %u)", target->GetName().c_str(), target->GetGUID().GetCounter());
@@ -917,7 +915,7 @@ public:
if (!i)
return false;
- char* j = strtok(NULL, " ");
+ char* j = strtok(nullptr, " ");
uint32 entry = (uint32)atoi(i);
int8 seatId = j ? (int8)atoi(j) : -1;
@@ -926,7 +924,7 @@ public:
handler->GetSession()->GetPlayer()->EnterVehicle(target, seatId);
else
{
- Creature* passenger = NULL;
+ Creature* passenger = nullptr;
Trinity::AllCreaturesOfEntryInRange check(handler->GetSession()->GetPlayer(), entry, 20.0f);
Trinity::CreatureSearcher<Trinity::AllCreaturesOfEntryInRange> searcher(handler->GetSession()->GetPlayer(), passenger, check);
Cell::VisitAllObjects(handler->GetSession()->GetPlayer(), searcher, 30.0f);
@@ -945,7 +943,7 @@ public:
return false;
char* e = strtok((char*)args, " ");
- char* i = strtok(NULL, " ");
+ char* i = strtok(nullptr, " ");
if (!e)
return false;
@@ -987,7 +985,7 @@ public:
static bool HandleDebugSendLargePacketCommand(ChatHandler* handler, char const* /*args*/)
{
- const char* stuffingString = "This is a dummy string to push the packet's size beyond 128000 bytes. ";
+ char const* stuffingString = "This is a dummy string to push the packet's size beyond 128000 bytes. ";
std::ostringstream ss;
while (ss.str().size() < 128000)
ss << stuffingString;
@@ -1011,7 +1009,7 @@ public:
return false;
char* e = strtok((char*)args, " ");
- char* f = strtok(NULL, " ");
+ char* f = strtok(nullptr, " ");
if (!e || !f)
return false;
@@ -1040,8 +1038,8 @@ public:
return false;
char* e = strtok((char*)args, " ");
- char* f = strtok(NULL, " ");
- char* g = strtok(NULL, " ");
+ char* f = strtok(nullptr, " ");
+ char* g = strtok(nullptr, " ");
if (!e || !f || !g)
return false;
@@ -1147,8 +1145,8 @@ public:
return false;
char* x = strtok((char*)args, " ");
- char* y = strtok(NULL, " ");
- char* z = strtok(NULL, " ");
+ char* y = strtok(nullptr, " ");
+ char* z = strtok(nullptr, " ");
if (!x || !y)
return false;
@@ -1196,7 +1194,7 @@ public:
return false;
char* x = strtok((char*)args, " ");
- char* z = strtok(NULL, " ");
+ char* z = strtok(nullptr, " ");
if (!x)
return false;
@@ -1242,7 +1240,7 @@ public:
return false;
char* x = strtok((char*)args, " ");
- char* y = strtok(NULL, " ");
+ char* y = strtok(nullptr, " ");
if (!x || !y)
return false;
@@ -1297,7 +1295,7 @@ public:
else if (updateIndex >= UNIT_END)
return true;
- char* val = strtok(NULL, " ");
+ char* val = strtok(nullptr, " ");
if (!val)
{
value = unit->GetUInt32Value(updateIndex);
@@ -1329,7 +1327,7 @@ public:
}
char* x = strtok((char*)args, " ");
- char* y = strtok(NULL, " ");
+ char* y = strtok(nullptr, " ");
if (!x || !y)
return false;
@@ -1363,7 +1361,7 @@ public:
if (!mask1)
return false;
- char* mask2 = strtok(NULL, " \n");
+ char* mask2 = strtok(nullptr, " \n");
uint32 moveFlags = (uint32)atoi(mask1);
@@ -1552,18 +1550,18 @@ public:
static bool HandleDebugNearGraveyard(ChatHandler* handler, char const* args)
{
Player* player = handler->GetSession()->GetPlayer();
- const WorldSafeLocsEntry* nearestLoc = nullptr;
+ WorldSafeLocsEntry const* nearestLoc = nullptr;
if (stricmp(args, "linked"))
{
if (Battleground* bg = player->GetBattleground())
- nearestLoc = bg->GetClosestGraveYard(player);
+ nearestLoc = bg->GetClosestGraveyard(player);
else
{
if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(player->GetZoneId()))
- nearestLoc = bf->GetClosestGraveYard(player);
+ nearestLoc = bf->GetClosestGraveyard(player);
else
- nearestLoc = sObjectMgr->GetClosestGraveYard(player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), player->GetTeam());
+ nearestLoc = sObjectMgr->GetClosestGraveyard(player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), player->GetTeam());
}
}
else
@@ -1575,7 +1573,7 @@ public:
for (uint32 i = 0; i < sWorldSafeLocsStore.GetNumRows(); ++i)
{
- const WorldSafeLocsEntry* loc = sWorldSafeLocsStore.LookupEntry(i);
+ WorldSafeLocsEntry const* loc = sWorldSafeLocsStore.LookupEntry(i);
if (loc && loc->map_id == player->GetMapId())
{
float dist = (loc->x - x) * (loc->x - x) + (loc->y - y) * (loc->y - y) + (loc->z - z) * (loc->z - z);
diff --git a/src/server/scripts/Commands/cs_deserter.cpp b/src/server/scripts/Commands/cs_deserter.cpp
index d1778d14999..d3f298deaf7 100644
--- a/src/server/scripts/Commands/cs_deserter.cpp
+++ b/src/server/scripts/Commands/cs_deserter.cpp
@@ -22,10 +22,11 @@
* This file contains the CommandScripts for all deserter sub-commands
*/
+#include "ScriptMgr.h"
#include "Chat.h"
-#include "Player.h"
#include "Language.h"
-#include "ScriptMgr.h"
+#include "Player.h"
+#include "RBAC.h"
#include "SpellAuras.h"
enum Spells
@@ -58,12 +59,12 @@ public:
static std::vector<ChatCommand> deserterCommandTable =
{
- { "instance", rbac::RBAC_PERM_COMMAND_DESERTER_INSTANCE, false, NULL, "", deserterInstanceCommandTable },
- { "bg", rbac::RBAC_PERM_COMMAND_DESERTER_BG, false, NULL, "", deserterBGCommandTable },
+ { "instance", rbac::RBAC_PERM_COMMAND_DESERTER_INSTANCE, false, nullptr, "", deserterInstanceCommandTable },
+ { "bg", rbac::RBAC_PERM_COMMAND_DESERTER_BG, false, nullptr, "", deserterBGCommandTable },
};
static std::vector<ChatCommand> commandTable =
{
- { "deserter", rbac::RBAC_PERM_COMMAND_DESERTER, false, NULL, "", deserterCommandTable },
+ { "deserter", rbac::RBAC_PERM_COMMAND_DESERTER, false, nullptr, "", deserterCommandTable },
};
return commandTable;
}
diff --git a/src/server/scripts/Commands/cs_disable.cpp b/src/server/scripts/Commands/cs_disable.cpp
index 5863c2adebe..bc80d3d6fd0 100644
--- a/src/server/scripts/Commands/cs_disable.cpp
+++ b/src/server/scripts/Commands/cs_disable.cpp
@@ -22,14 +22,16 @@ Comment: All disable related commands
Category: commandscripts
EndScriptData */
-#include "DisableMgr.h"
+#include "ScriptMgr.h"
#include "AchievementMgr.h"
#include "Chat.h"
+#include "DatabaseEnv.h"
+#include "DisableMgr.h"
#include "Language.h"
#include "ObjectMgr.h"
#include "OutdoorPvP.h"
#include "Player.h"
-#include "ScriptMgr.h"
+#include "RBAC.h"
#include "SpellMgr.h"
class disable_commandscript : public CommandScript
@@ -63,12 +65,12 @@ public:
};
static std::vector<ChatCommand> disableCommandTable =
{
- { "add", rbac::RBAC_PERM_COMMAND_DISABLE_ADD, true, NULL, "", addDisableCommandTable },
- { "remove", rbac::RBAC_PERM_COMMAND_DISABLE_REMOVE, true, NULL, "", removeDisableCommandTable },
+ { "add", rbac::RBAC_PERM_COMMAND_DISABLE_ADD, true, nullptr, "", addDisableCommandTable },
+ { "remove", rbac::RBAC_PERM_COMMAND_DISABLE_REMOVE, true, nullptr, "", removeDisableCommandTable },
};
static std::vector<ChatCommand> commandTable =
{
- { "disable", rbac::RBAC_PERM_COMMAND_DISABLE, false, NULL, "", disableCommandTable },
+ { "disable", rbac::RBAC_PERM_COMMAND_DISABLE, false, nullptr, "", disableCommandTable },
};
return commandTable;
}
@@ -79,10 +81,10 @@ public:
if (!entryStr || !atoi(entryStr))
return false;
- char* flagsStr = strtok(NULL, " ");
+ char* flagsStr = strtok(nullptr, " ");
uint8 flags = flagsStr ? uint8(atoi(flagsStr)) : 0;
- char* commentStr = strtok(NULL, "");
+ char* commentStr = strtok(nullptr, "");
if (!commentStr)
return false;
@@ -185,7 +187,7 @@ public:
break;
}
- PreparedStatement* stmt = NULL;
+ PreparedStatement* stmt = nullptr;
stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_DISABLES);
stmt->setUInt32(0, entry);
stmt->setUInt8(1, disableType);
@@ -311,7 +313,7 @@ public:
break;
}
- PreparedStatement* stmt = NULL;
+ PreparedStatement* stmt = nullptr;
stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_DISABLES);
stmt->setUInt32(0, entry);
stmt->setUInt8(1, disableType);
diff --git a/src/server/scripts/Commands/cs_event.cpp b/src/server/scripts/Commands/cs_event.cpp
index 05b49f9b4e7..3612bc17e66 100644
--- a/src/server/scripts/Commands/cs_event.cpp
+++ b/src/server/scripts/Commands/cs_event.cpp
@@ -22,11 +22,12 @@ Comment: All event related commands
Category: commandscripts
EndScriptData */
+#include "ScriptMgr.h"
#include "Chat.h"
#include "GameEventMgr.h"
#include "Language.h"
#include "Player.h"
-#include "ScriptMgr.h"
+#include "RBAC.h"
class event_commandscript : public CommandScript
{
@@ -44,7 +45,7 @@ public:
};
static std::vector<ChatCommand> commandTable =
{
- { "event", rbac::RBAC_PERM_COMMAND_EVENT, false, NULL, "", eventCommandTable },
+ { "event", rbac::RBAC_PERM_COMMAND_EVENT, false, nullptr, "", eventCommandTable },
};
return commandTable;
}
@@ -115,8 +116,8 @@ public:
std::string endTimeStr = TimeToTimestampStr(eventData.end);
uint32 delay = sGameEventMgr->NextCheck(eventId);
- time_t nextTime = time(NULL) + delay;
- std::string nextStr = nextTime >= eventData.start && nextTime < eventData.end ? TimeToTimestampStr(time(NULL) + delay) : "-";
+ time_t nextTime = time(nullptr) + delay;
+ std::string nextStr = nextTime >= eventData.start && nextTime < eventData.end ? TimeToTimestampStr(time(nullptr) + delay) : "-";
std::string occurenceStr = secsToTimeString(eventData.occurence * MINUTE);
std::string lengthStr = secsToTimeString(eventData.length * MINUTE);
diff --git a/src/server/scripts/Commands/cs_gm.cpp b/src/server/scripts/Commands/cs_gm.cpp
index 09048305449..0e514680552 100644
--- a/src/server/scripts/Commands/cs_gm.cpp
+++ b/src/server/scripts/Commands/cs_gm.cpp
@@ -23,13 +23,18 @@ Category: commandscripts
EndScriptData */
#include "ScriptMgr.h"
-#include "ObjectMgr.h"
-#include "Chat.h"
#include "AccountMgr.h"
+#include "Chat.h"
+#include "DatabaseEnv.h"
#include "Language.h"
-#include "World.h"
-#include "Player.h"
+#include "ObjectAccessor.h"
#include "Opcodes.h"
+#include "Player.h"
+#include "Realm.h"
+#include "World.h"
+#include "WorldSession.h"
+#include <boost/thread/locks.hpp>
+#include <boost/thread/shared_mutex.hpp>
class gm_commandscript : public CommandScript
{
@@ -49,7 +54,7 @@ public:
};
static std::vector<ChatCommand> commandTable =
{
- { "gm", rbac::RBAC_PERM_COMMAND_GM, false, NULL, "", gmCommandTable },
+ { "gm", rbac::RBAC_PERM_COMMAND_GM, false, nullptr, "", gmCommandTable },
};
return commandTable;
}
diff --git a/src/server/scripts/Commands/cs_go.cpp b/src/server/scripts/Commands/cs_go.cpp
index cdeb07ee844..6a27060c2ed 100644
--- a/src/server/scripts/Commands/cs_go.cpp
+++ b/src/server/scripts/Commands/cs_go.cpp
@@ -23,13 +23,17 @@ Category: commandscripts
EndScriptData */
#include "ScriptMgr.h"
-#include "ObjectMgr.h"
-#include "MapManager.h"
-#include "TicketMgr.h"
#include "Chat.h"
+#include "DatabaseEnv.h"
#include "Language.h"
+#include "MapManager.h"
+#include "MotionMaster.h"
+#include "ObjectMgr.h"
#include "Player.h"
+#include "RBAC.h"
+#include "TicketMgr.h"
#include "Transport.h"
+#include "WorldSession.h"
class go_commandscript : public CommandScript
{
@@ -54,7 +58,7 @@ public:
static std::vector<ChatCommand> commandTable =
{
- { "go", rbac::RBAC_PERM_COMMAND_GO, false, NULL, "", goCommandTable },
+ { "go", rbac::RBAC_PERM_COMMAND_GO, false, nullptr, "", goCommandTable },
};
return commandTable;
}
@@ -89,7 +93,7 @@ public:
{
// Get the "creature_template.entry"
// number or [name] Shift-click form |color|Hcreature_entry:creature_id|h[name]|h|r
- char* tail = strtok(NULL, "");
+ char* tail = strtok(nullptr, "");
if (!tail)
return false;
char* id = handler->extractKeyFromLink(tail, "Hcreature_entry");
@@ -111,7 +115,7 @@ public:
{
std::string name = param1;
WorldDatabase.EscapeString(name);
- whereClause << ", creature_template WHERE creature.id = creature_template.entry AND creature_template.name " _LIKE_" '" << name << '\'';
+ whereClause << ", creature_template WHERE creature.id = creature_template.entry AND creature_template.name LIKE '" << name << '\'';
}
else
whereClause << "WHERE guid = '" << guidLow << '\'';
@@ -134,7 +138,7 @@ public:
float o = fields[3].GetFloat();
uint32 mapId = fields[4].GetUInt16();
- Transport* transport = NULL;
+ Transport* transport = nullptr;
if (!MapManager::IsValidMapCoord(mapId, x, y, z, o) || sObjectMgr->IsTransportMap(mapId))
{
@@ -215,8 +219,8 @@ public:
Player* player = handler->GetSession()->GetPlayer();
char* gridX = strtok((char*)args, " ");
- char* gridY = strtok(NULL, " ");
- char* id = strtok(NULL, " ");
+ char* gridY = strtok(nullptr, " ");
+ char* id = strtok(nullptr, " ");
if (!gridX || !gridY)
return false;
@@ -407,8 +411,8 @@ public:
Player* player = handler->GetSession()->GetPlayer();
char* zoneX = strtok((char*)args, " ");
- char* zoneY = strtok(NULL, " ");
- char* tail = strtok(NULL, "");
+ char* zoneY = strtok(nullptr, " ");
+ char* tail = strtok(nullptr, "");
char* id = handler->extractKeyFromLink(tail, "Harea"); // string or [name] Shift-click form |color|Harea:area_id|h[name]|h|r
@@ -480,10 +484,10 @@ public:
Player* player = handler->GetSession()->GetPlayer();
char* goX = strtok((char*)args, " ");
- char* goY = strtok(NULL, " ");
- char* goZ = strtok(NULL, " ");
- char* id = strtok(NULL, " ");
- char* port = strtok(NULL, " ");
+ char* goY = strtok(nullptr, " ");
+ char* goZ = strtok(nullptr, " ");
+ char* id = strtok(nullptr, " ");
+ char* port = strtok(nullptr, " ");
if (!goX || !goY)
return false;
@@ -571,9 +575,9 @@ public:
Player* player = handler->GetSession()->GetPlayer();
char* goX = strtok((char*)args, " ");
- char* goY = strtok(NULL, " ");
- char* goZ = strtok(NULL, " ");
- char* port = strtok(NULL, " ");
+ char* goY = strtok(nullptr, " ");
+ char* goZ = strtok(nullptr, " ");
+ char* port = strtok(nullptr, " ");
float x, y, z, o;
player->GetPosition(x, y, z, o);
diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp
index dd636aa52da..a315355ff44 100644
--- a/src/server/scripts/Commands/cs_gobject.cpp
+++ b/src/server/scripts/Commands/cs_gobject.cpp
@@ -23,14 +23,20 @@ Category: commandscripts
EndScriptData */
#include "ScriptMgr.h"
-#include "GameEventMgr.h"
-#include "ObjectMgr.h"
-#include "PoolMgr.h"
-#include "MapManager.h"
#include "Chat.h"
+#include "DatabaseEnv.h"
+#include "DBCStores.h"
+#include "GameEventMgr.h"
#include "Language.h"
-#include "Player.h"
+#include "Log.h"
+#include "MapManager.h"
+#include "ObjectAccessor.h"
+#include "ObjectMgr.h"
#include "Opcodes.h"
+#include "Player.h"
+#include "PoolMgr.h"
+#include "RBAC.h"
+#include "WorldSession.h"
class gobject_commandscript : public CommandScript
{
@@ -58,12 +64,12 @@ public:
{ "near", rbac::RBAC_PERM_COMMAND_GOBJECT_NEAR, false, &HandleGameObjectNearCommand, "" },
{ "target", rbac::RBAC_PERM_COMMAND_GOBJECT_TARGET, false, &HandleGameObjectTargetCommand, "" },
{ "turn", rbac::RBAC_PERM_COMMAND_GOBJECT_TURN, false, &HandleGameObjectTurnCommand, "" },
- { "add", rbac::RBAC_PERM_COMMAND_GOBJECT_ADD, false, NULL, "", gobjectAddCommandTable },
- { "set", rbac::RBAC_PERM_COMMAND_GOBJECT_SET, false, NULL, "", gobjectSetCommandTable },
+ { "add", rbac::RBAC_PERM_COMMAND_GOBJECT_ADD, false, nullptr, "", gobjectAddCommandTable },
+ { "set", rbac::RBAC_PERM_COMMAND_GOBJECT_SET, false, nullptr, "", gobjectSetCommandTable },
};
static std::vector<ChatCommand> commandTable =
{
- { "gobject", rbac::RBAC_PERM_COMMAND_GOBJECT, false, NULL, "", gobjectCommandTable },
+ { "gobject", rbac::RBAC_PERM_COMMAND_GOBJECT, false, nullptr, "", gobjectCommandTable },
};
return commandTable;
}
@@ -140,7 +146,7 @@ public:
GameObject* object = new GameObject();
ObjectGuid::LowType guidLow = map->GenerateLowGuid<HighGuid::GameObject>();
- G3D::Quat rot = G3D::Matrix3::fromEulerAnglesZYX(player->GetOrientation(), 0.f, 0.f);
+ QuaternionData rot = QuaternionData::fromEulerAnglesZYX(player->GetOrientation(), 0.f, 0.f);
if (!object->Create(guidLow, objectInfo->entry, map, player->GetPhaseMaskForSpawn(), *player, rot, 255, GO_STATE_READY))
{
delete object;
@@ -188,13 +194,13 @@ public:
Player* player = handler->GetSession()->GetPlayer();
- char* spawntime = strtok(NULL, " ");
+ char* spawntime = strtok(nullptr, " ");
uint32 spawntm = 300;
if (spawntime)
spawntm = atoul(spawntime);
- G3D::Quat rotation = G3D::Matrix3::fromEulerAnglesZYX(player->GetOrientation(), 0.f, 0.f);
+ QuaternionData rotation = QuaternionData::fromEulerAnglesZYX(player->GetOrientation(), 0.f, 0.f);
uint32 objectId = atoul(id);
if (!sObjectMgr->GetGameObjectTemplate(objectId))
@@ -233,7 +239,7 @@ public:
WorldDatabase.EscapeString(name);
result = WorldDatabase.PQuery(
"SELECT guid, id, position_x, position_y, position_z, orientation, map, phaseMask, (POW(position_x - %f, 2) + POW(position_y - %f, 2) + POW(position_z - %f, 2)) AS order_ "
- "FROM gameobject, gameobject_template WHERE gameobject_template.entry = gameobject.id AND map = %i AND name " _LIKE_" " _CONCAT3_("'%%'", "'%s'", "'%%'")" ORDER BY order_ ASC LIMIT 1",
+ "FROM gameobject LEFT JOIN gameobject_template ON gameobject_template.entry = gameobject.id WHERE map = %i AND name LIKE '%%%s%%' ORDER BY order_ ASC LIMIT 1",
player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), name.c_str());
}
}
@@ -315,7 +321,7 @@ public:
if (target)
{
- int32 curRespawnDelay = int32(target->GetRespawnTimeEx() - time(NULL));
+ int32 curRespawnDelay = int32(target->GetRespawnTimeEx() - time(nullptr));
if (curRespawnDelay < 0)
curRespawnDelay = 0;
@@ -390,18 +396,18 @@ public:
return false;
}
- char* orientation = strtok(NULL, " ");
+ char* orientation = strtok(nullptr, " ");
float oz = 0.f, oy = 0.f, ox = 0.f;
if (orientation)
{
oz = float(atof(orientation));
- orientation = strtok(NULL, " ");
+ orientation = strtok(nullptr, " ");
if (orientation)
{
oy = float(atof(orientation));
- orientation = strtok(NULL, " ");
+ orientation = strtok(nullptr, " ");
if (orientation)
ox = float(atof(orientation));
}
@@ -454,9 +460,9 @@ public:
return false;
}
- char* toX = strtok(NULL, " ");
- char* toY = strtok(NULL, " ");
- char* toZ = strtok(NULL, " ");
+ char* toX = strtok(nullptr, " ");
+ char* toY = strtok(nullptr, " ");
+ char* toZ = strtok(nullptr, " ");
float x, y, z;
if (!toX)
@@ -523,7 +529,7 @@ public:
return false;
}
- char* phase = strtok (NULL, " ");
+ char* phase = strtok (nullptr, " ");
uint32 phaseMask = phase ? atoul(phase) : 0;
if (phaseMask == 0)
{
@@ -605,7 +611,7 @@ public:
if (!cValue)
return false;
ObjectGuid::LowType guidLow = atoul(cValue);
- const GameObjectData* data = sObjectMgr->GetGOData(guidLow);
+ GameObjectData const* data = sObjectMgr->GetGOData(guidLow);
if (!data)
return false;
entry = data->id;
@@ -663,7 +669,7 @@ public:
return false;
}
- char* type = strtok(NULL, " ");
+ char* type = strtok(nullptr, " ");
if (!type)
return false;
@@ -677,7 +683,7 @@ public:
return true;
}
- char* state = strtok(NULL, " ");
+ char* state = strtok(nullptr, " ");
if (!state)
return false;
diff --git a/src/server/scripts/Commands/cs_group.cpp b/src/server/scripts/Commands/cs_group.cpp
index 49bb13f4786..ed69c88ee21 100644
--- a/src/server/scripts/Commands/cs_group.cpp
+++ b/src/server/scripts/Commands/cs_group.cpp
@@ -15,14 +15,20 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "ScriptMgr.h"
#include "CharacterCache.h"
#include "Chat.h"
+#include "DatabaseEnv.h"
+#include "DBCStores.h"
+#include "GroupMgr.h"
#include "Language.h"
#include "LFG.h"
+#include "Map.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "Player.h"
-#include "ObjectMgr.h"
-#include "GroupMgr.h"
-#include "ScriptMgr.h"
+#include "RBAC.h"
+#include "WorldSession.h"
class group_commandscript : public CommandScript
{
@@ -292,7 +298,7 @@ public:
ObjectGuid guidSource;
ObjectGuid guidTarget;
char* nameplgrStr = strtok((char*)args, " ");
- char* nameplStr = strtok(NULL, " ");
+ char* nameplStr = strtok(nullptr, " ");
if (!handler->GetPlayerGroupAndGUIDByName(nameplgrStr, playerSource, groupSource, guidSource, true))
return false;
@@ -335,7 +341,7 @@ public:
ObjectGuid guidTarget;
std::string nameTarget;
std::string zoneName;
- const char* onlineState = "";
+ char const* onlineState = "";
// Parse the guid to uint32...
ObjectGuid parseGUID(HighGuid::Player, uint32(atoul(args)));
diff --git a/src/server/scripts/Commands/cs_guild.cpp b/src/server/scripts/Commands/cs_guild.cpp
index 6c47cbbc02f..95503183821 100644
--- a/src/server/scripts/Commands/cs_guild.cpp
+++ b/src/server/scripts/Commands/cs_guild.cpp
@@ -22,13 +22,15 @@ Comment: All guild related commands
Category: commandscripts
EndScriptData */
+#include "ScriptMgr.h"
+#include "CharacterCache.h"
#include "Chat.h"
-#include "Language.h"
#include "Guild.h"
#include "GuildMgr.h"
+#include "Language.h"
#include "ObjectAccessor.h"
-#include "ScriptMgr.h"
-#include "CharacterCache.h"
+#include "Player.h"
+#include "RBAC.h"
class guild_commandscript : public CommandScript
{
@@ -49,7 +51,7 @@ public:
};
static std::vector<ChatCommand> commandTable =
{
- { "guild", rbac::RBAC_PERM_COMMAND_GUILD, true, NULL, "", guildCommandTable },
+ { "guild", rbac::RBAC_PERM_COMMAND_GUILD, true, nullptr, "", guildCommandTable },
};
return commandTable;
}
@@ -69,10 +71,10 @@ public:
// if not guild name only (in "") then player name
Player* target;
- if (!handler->extractPlayerTarget(*args != '"' ? (char*)args : NULL, &target))
+ if (!handler->extractPlayerTarget(*args != '"' ? (char*)args : nullptr, &target))
return false;
- char* tailStr = *args != '"' ? strtok(NULL, "") : (char*)args;
+ char* tailStr = *args != '"' ? strtok(nullptr, "") : (char*)args;
if (!tailStr)
return false;
@@ -130,10 +132,10 @@ public:
// if not guild name only (in "") then player name
ObjectGuid targetGuid;
- if (!handler->extractPlayerTarget(*args != '"' ? (char*)args : NULL, NULL, &targetGuid))
+ if (!handler->extractPlayerTarget(*args != '"' ? (char*)args : nullptr, nullptr, &targetGuid))
return false;
- char* tailStr = *args != '"' ? strtok(NULL, "") : (char*)args;
+ char* tailStr = *args != '"' ? strtok(nullptr, "") : (char*)args;
if (!tailStr)
return false;
@@ -213,7 +215,7 @@ public:
return false;
}
- char const* newGuildStr = handler->extractQuotedArg(strtok(NULL, ""));
+ char const* newGuildStr = handler->extractQuotedArg(strtok(nullptr, ""));
if (!newGuildStr)
{
handler->SendSysMessage(LANG_INSERT_GUILD_NAME);
diff --git a/src/server/scripts/Commands/cs_honor.cpp b/src/server/scripts/Commands/cs_honor.cpp
index 4cff715fd2c..e0fc316ab70 100644
--- a/src/server/scripts/Commands/cs_honor.cpp
+++ b/src/server/scripts/Commands/cs_honor.cpp
@@ -22,11 +22,12 @@ Comment: All honor related commands
Category: commandscripts
EndScriptData */
+#include "ScriptMgr.h"
#include "Chat.h"
#include "Language.h"
-#include "ObjectMgr.h"
#include "Player.h"
-#include "ScriptMgr.h"
+#include "RBAC.h"
+#include "WorldSession.h"
class honor_commandscript : public CommandScript
{
@@ -43,13 +44,13 @@ public:
static std::vector<ChatCommand> honorCommandTable =
{
- { "add", rbac::RBAC_PERM_COMMAND_HONOR_ADD, false, NULL, "", honorAddCommandTable },
+ { "add", rbac::RBAC_PERM_COMMAND_HONOR_ADD, false, nullptr, "", honorAddCommandTable },
{ "update", rbac::RBAC_PERM_COMMAND_HONOR_UPDATE, false, &HandleHonorUpdateCommand, "" },
};
static std::vector<ChatCommand> commandTable =
{
- { "honor", rbac::RBAC_PERM_COMMAND_HONOR, false, NULL, "", honorCommandTable },
+ { "honor", rbac::RBAC_PERM_COMMAND_HONOR, false, nullptr, "", honorCommandTable },
};
return commandTable;
}
@@ -72,7 +73,7 @@ public:
return false;
uint32 amount = (uint32)atoi(args);
- target->RewardHonor(NULL, 1, amount);
+ target->RewardHonor(nullptr, 1, amount);
return true;
}
diff --git a/src/server/scripts/Commands/cs_instance.cpp b/src/server/scripts/Commands/cs_instance.cpp
index ff1a1c4da88..682976ba897 100644
--- a/src/server/scripts/Commands/cs_instance.cpp
+++ b/src/server/scripts/Commands/cs_instance.cpp
@@ -27,9 +27,13 @@ EndScriptData */
#include "Group.h"
#include "InstanceSaveMgr.h"
#include "InstanceScript.h"
+#include "Language.h"
#include "MapManager.h"
+#include "ObjectAccessor.h"
+#include "ObjectMgr.h"
#include "Player.h"
-#include "Language.h"
+#include "RBAC.h"
+#include "WorldSession.h"
class instance_commandscript : public CommandScript
{
@@ -50,7 +54,7 @@ public:
static std::vector<ChatCommand> commandTable =
{
- { "instance", rbac::RBAC_PERM_COMMAND_INSTANCE, true, NULL, "", instanceCommandTable },
+ { "instance", rbac::RBAC_PERM_COMMAND_INSTANCE, true, nullptr, "", instanceCommandTable },
};
return commandTable;
@@ -81,7 +85,7 @@ public:
for (Player::BoundInstancesMap::const_iterator itr = binds.begin(); itr != binds.end(); ++itr)
{
InstanceSave* save = itr->second.save;
- std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL));
+ std::string timeleft = GetTimeString(save->GetResetTime() - time(nullptr));
handler->PSendSysMessage(LANG_COMMAND_LIST_BIND_INFO, itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", itr->second.extendState == EXTEND_STATE_EXPIRED ? "expired" : itr->second.extendState == EXTEND_STATE_EXTENDED ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str());
counter++;
}
@@ -97,7 +101,7 @@ public:
for (Group::BoundInstancesMap::const_iterator itr = binds.begin(); itr != binds.end(); ++itr)
{
InstanceSave* save = itr->second.save;
- std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL));
+ std::string timeleft = GetTimeString(save->GetResetTime() - time(nullptr));
handler->PSendSysMessage(LANG_COMMAND_LIST_BIND_INFO, itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", "-", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str());
counter++;
}
@@ -118,7 +122,7 @@ public:
player = handler->GetSession()->GetPlayer();
char* map = strtok((char*)args, " ");
- char* pDiff = strtok(NULL, " ");
+ char* pDiff = strtok(nullptr, " ");
int8 diff = -1;
if (pDiff)
diff = atoi(pDiff);
@@ -140,7 +144,7 @@ public:
InstanceSave* save = itr->second.save;
if (itr->first != player->GetMapId() && (!MapId || MapId == itr->first) && (diff == -1 || diff == save->GetDifficulty()))
{
- std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL));
+ std::string timeleft = GetTimeString(save->GetResetTime() - time(nullptr));
handler->PSendSysMessage(LANG_COMMAND_INST_UNBIND_UNBINDING, itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str());
player->UnbindInstance(itr, Difficulty(i));
counter++;
diff --git a/src/server/scripts/Commands/cs_learn.cpp b/src/server/scripts/Commands/cs_learn.cpp
index 0e286357915..66e5865ee23 100644
--- a/src/server/scripts/Commands/cs_learn.cpp
+++ b/src/server/scripts/Commands/cs_learn.cpp
@@ -22,14 +22,17 @@ Comment: All learn related commands
Category: commandscripts
EndScriptData */
-#include "Chat.h"
#include "ScriptMgr.h"
-#include "ObjectMgr.h"
+#include "Chat.h"
+#include "DBCStores.h"
#include "Language.h"
-#include "SpellMgr.h"
-#include "SpellInfo.h"
-#include "Player.h"
+#include "ObjectMgr.h"
#include "Pet.h"
+#include "Player.h"
+#include "RBAC.h"
+#include "SpellInfo.h"
+#include "SpellMgr.h"
+#include "WorldSession.h"
class learn_commandscript : public CommandScript
{
@@ -48,7 +51,7 @@ public:
static std::vector<ChatCommand> learnAllCommandTable =
{
- { "my", rbac::RBAC_PERM_COMMAND_LEARN_ALL_MY, false, NULL, "", learnAllMyCommandTable },
+ { "my", rbac::RBAC_PERM_COMMAND_LEARN_ALL_MY, false, nullptr, "", learnAllMyCommandTable },
{ "gm", rbac::RBAC_PERM_COMMAND_LEARN_ALL_GM, false, &HandleLearnAllGMCommand, "" },
{ "crafts", rbac::RBAC_PERM_COMMAND_LEARN_ALL_CRAFTS, false, &HandleLearnAllCraftsCommand, "" },
{ "default", rbac::RBAC_PERM_COMMAND_LEARN_ALL_DEFAULT, false, &HandleLearnAllDefaultCommand, "" },
@@ -58,13 +61,13 @@ public:
static std::vector<ChatCommand> learnCommandTable =
{
- { "all", rbac::RBAC_PERM_COMMAND_LEARN_ALL, false, NULL, "", learnAllCommandTable },
+ { "all", rbac::RBAC_PERM_COMMAND_LEARN_ALL, false, nullptr, "", learnAllCommandTable },
{ "", rbac::RBAC_PERM_COMMAND_LEARN, false, &HandleLearnCommand, "" },
};
static std::vector<ChatCommand> commandTable =
{
- { "learn", rbac::RBAC_PERM_COMMAND_LEARN, false, NULL, "", learnCommandTable },
+ { "learn", rbac::RBAC_PERM_COMMAND_LEARN, false, nullptr, "", learnCommandTable },
{ "unlearn", rbac::RBAC_PERM_COMMAND_UNLEARN, false, &HandleUnLearnCommand, "" },
};
return commandTable;
@@ -86,7 +89,7 @@ public:
if (!spell || !sSpellMgr->GetSpellInfo(spell))
return false;
- char const* all = strtok(NULL, " ");
+ char const* all = strtok(nullptr, " ");
bool allRanks = all ? (strncmp(all, "all", strlen(all)) == 0) : false;
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell);
@@ -314,9 +317,9 @@ public:
static bool HandleLearnAllLangCommand(ChatHandler* handler, char const* /*args*/)
{
- // skipping UNIVERSAL language (0)
- for (uint8 i = 1; i < LANGUAGES_COUNT; ++i)
- handler->GetSession()->GetPlayer()->LearnSpell(lang_description[i].spell_id, false);
+ for (LanguageDesc const& langDesc : lang_description)
+ if (uint32 langSpellId = langDesc.spell_id)
+ handler->GetSession()->GetPlayer()->LearnSpell(langSpellId, false);
handler->SendSysMessage(LANG_COMMAND_LEARN_ALL_LANG);
return true;
@@ -384,7 +387,7 @@ public:
std::string name;
- SkillLineEntry const* targetSkillInfo = NULL;
+ SkillLineEntry const* targetSkillInfo = nullptr;
for (uint32 i = 1; i < sSkillLineStore.GetNumRows(); ++i)
{
SkillLineEntry const* skillInfo = sSkillLineStore.LookupEntry(i);
@@ -480,7 +483,7 @@ public:
if (!spellId)
return false;
- char const* allStr = strtok(NULL, " ");
+ char const* allStr = strtok(nullptr, " ");
bool allRanks = allStr ? (strncmp(allStr, "all", strlen(allStr)) == 0) : false;
Player* target = handler->getSelectedPlayer();
diff --git a/src/server/scripts/Commands/cs_lfg.cpp b/src/server/scripts/Commands/cs_lfg.cpp
index 56836ebf1e9..1e71c6c676d 100644
--- a/src/server/scripts/Commands/cs_lfg.cpp
+++ b/src/server/scripts/Commands/cs_lfg.cpp
@@ -18,12 +18,14 @@
#include "ScriptMgr.h"
#include "CharacterCache.h"
#include "Chat.h"
-#include "Language.h"
-#include "LFGMgr.h"
-#include "ObjectMgr.h"
+#include "DatabaseEnv.h"
#include "Group.h"
#include "GroupMgr.h"
+#include "Language.h"
+#include "LFGMgr.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "RBAC.h"
void GetPlayerInfo(ChatHandler* handler, Player* player)
{
@@ -57,16 +59,16 @@ public:
static std::vector<ChatCommand> commandTable =
{
- { "lfg", rbac::RBAC_PERM_COMMAND_LFG, true, NULL, "", lfgCommandTable },
+ { "lfg", rbac::RBAC_PERM_COMMAND_LFG, true, nullptr, "", lfgCommandTable },
};
return commandTable;
}
static bool HandleLfgPlayerInfoCommand(ChatHandler* handler, char const* args)
{
- Player* target = NULL;
+ Player* target = nullptr;
std::string playerName;
- if (!handler->extractPlayerTarget((char*)args, &target, NULL, &playerName))
+ if (!handler->extractPlayerTarget((char*)args, &target, nullptr, &playerName))
return false;
GetPlayerInfo(handler, target);
@@ -89,7 +91,7 @@ public:
else if (!handler->extractPlayerTarget((char*)args, &playerTarget, &guidTarget, &nameTarget))
return false;
- Group* groupTarget = NULL;
+ Group* groupTarget = nullptr;
if (playerTarget)
groupTarget = playerTarget->GetGroup();
diff --git a/src/server/scripts/Commands/cs_list.cpp b/src/server/scripts/Commands/cs_list.cpp
index 299364aa998..8b502f60e11 100644
--- a/src/server/scripts/Commands/cs_list.cpp
+++ b/src/server/scripts/Commands/cs_list.cpp
@@ -23,14 +23,18 @@ Category: commandscripts
EndScriptData */
#include "ScriptMgr.h"
+#include "CharacterCache.h"
#include "Chat.h"
-#include "SpellAuraEffects.h"
+#include "DatabaseEnv.h"
+#include "DBCStores.h"
#include "Language.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Player.h"
-#include "CharacterCache.h"
-#include <iostream>
+#include "Random.h"
+#include "RBAC.h"
+#include "SpellAuraEffects.h"
+#include "WorldSession.h"
class list_commandscript : public CommandScript
{
@@ -49,7 +53,7 @@ public:
};
static std::vector<ChatCommand> commandTable =
{
- { "list", rbac::RBAC_PERM_COMMAND_LIST,true, NULL, "", listCommandTable },
+ { "list", rbac::RBAC_PERM_COMMAND_LIST,true, nullptr, "", listCommandTable },
};
return commandTable;
}
@@ -80,7 +84,7 @@ public:
return false;
}
- char* countStr = strtok(NULL, " ");
+ char* countStr = strtok(nullptr, " ");
uint32 count = countStr ? atoul(countStr) : 10;
if (count == 0)
@@ -152,7 +156,7 @@ public:
return false;
}
- char* countStr = strtok(NULL, " ");
+ char* countStr = strtok(nullptr, " ");
uint32 count = countStr ? atoul(countStr) : 10;
if (count == 0)
@@ -227,7 +231,7 @@ public:
result = CharacterDatabase.Query(stmt);
}
else
- result = PreparedQueryResult(NULL);
+ result = PreparedQueryResult(nullptr);
if (result)
{
@@ -274,7 +278,7 @@ public:
result = CharacterDatabase.Query(stmt);
}
else
- result = PreparedQueryResult(NULL);
+ result = PreparedQueryResult(nullptr);
if (result)
{
@@ -369,7 +373,7 @@ public:
return false;
}
- char* countStr = strtok(NULL, " ");
+ char* countStr = strtok(nullptr, " ");
uint32 count = countStr ? atoul(countStr) : 10;
if (count == 0)
@@ -470,7 +474,7 @@ public:
Player* target;
ObjectGuid targetGuid;
std::string targetName;
- PreparedStatement* stmt = NULL;
+ PreparedStatement* stmt = nullptr;
if (!*args)
return false;
diff --git a/src/server/scripts/Commands/cs_lookup.cpp b/src/server/scripts/Commands/cs_lookup.cpp
index c507b4d607d..8250b5b5e80 100644
--- a/src/server/scripts/Commands/cs_lookup.cpp
+++ b/src/server/scripts/Commands/cs_lookup.cpp
@@ -22,15 +22,20 @@ Comment: All lookup related commands
Category: commandscripts
EndScriptData */
+#include "ScriptMgr.h"
#include "AccountMgr.h"
#include "Chat.h"
+#include "DatabaseEnv.h"
+#include "DBCStores.h"
#include "GameEventMgr.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "ReputationMgr.h"
-#include "ScriptMgr.h"
#include "SpellInfo.h"
+#include "SpellMgr.h"
+#include "World.h"
+#include "WorldSession.h"
class lookup_commandscript : public CommandScript
{
@@ -62,9 +67,9 @@ public:
{ "itemset", rbac::RBAC_PERM_COMMAND_LOOKUP_ITEMSET, true, &HandleLookupItemSetCommand, "" },
{ "object", rbac::RBAC_PERM_COMMAND_LOOKUP_OBJECT, true, &HandleLookupObjectCommand, "" },
{ "quest", rbac::RBAC_PERM_COMMAND_LOOKUP_QUEST, true, &HandleLookupQuestCommand, "" },
- { "player", rbac::RBAC_PERM_COMMAND_LOOKUP_PLAYER, true, NULL, "", lookupPlayerCommandTable },
+ { "player", rbac::RBAC_PERM_COMMAND_LOOKUP_PLAYER, true, nullptr, "", lookupPlayerCommandTable },
{ "skill", rbac::RBAC_PERM_COMMAND_LOOKUP_SKILL, true, &HandleLookupSkillCommand, "" },
- { "spell", rbac::RBAC_PERM_COMMAND_LOOKUP_SPELL, true, NULL, "", lookupSpellCommandTable },
+ { "spell", rbac::RBAC_PERM_COMMAND_LOOKUP_SPELL, true, nullptr, "", lookupSpellCommandTable },
{ "taxinode", rbac::RBAC_PERM_COMMAND_LOOKUP_TAXINODE, true, &HandleLookupTaxiNodeCommand, "" },
{ "tele", rbac::RBAC_PERM_COMMAND_LOOKUP_TELE, true, &HandleLookupTeleCommand, "" },
{ "title", rbac::RBAC_PERM_COMMAND_LOOKUP_TITLE, true, &HandleLookupTitleCommand, "" },
@@ -73,7 +78,7 @@ public:
static std::vector<ChatCommand> commandTable =
{
- { "lookup", rbac::RBAC_PERM_COMMAND_LOOKUP, true, NULL, "", lookupCommandTable },
+ { "lookup", rbac::RBAC_PERM_COMMAND_LOOKUP, true, nullptr, "", lookupCommandTable },
};
return commandTable;
}
@@ -312,7 +317,7 @@ public:
FactionEntry const* factionEntry = sFactionStore.LookupEntry(id);
if (factionEntry)
{
- FactionState const* factionState = target ? target->GetReputationMgr().GetState(factionEntry) : NULL;
+ FactionState const* factionState = target ? target->GetReputationMgr().GetState(factionEntry) : nullptr;
int locale = handler->GetSessionDbcLocale();
std::string name = factionEntry->name[locale];
@@ -858,7 +863,7 @@ public:
uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
// Search in Spell.dbc
- for (uint32 id = 0; id < sSpellMgr->GetSpellInfoStoreSize(); id++)
+ for (uint32 id = 0; id < sSpellMgr->GetSpellInfoStoreSize(); ++id)
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(id);
if (spellInfo)
@@ -1323,7 +1328,7 @@ public:
else
{
ip = strtok((char*)args, " ");
- limitStr = strtok(NULL, " ");
+ limitStr = strtok(nullptr, " ");
limit = limitStr ? atoi(limitStr) : -1;
}
@@ -1340,7 +1345,7 @@ public:
return false;
std::string account = strtok((char*)args, " ");
- char* limitStr = strtok(NULL, " ");
+ char* limitStr = strtok(nullptr, " ");
int32 limit = limitStr ? atoi(limitStr) : -1;
if (!Utf8ToUpperOnlyLatin
@@ -1360,7 +1365,7 @@ public:
return false;
std::string email = strtok((char*)args, " ");
- char* limitStr = strtok(NULL, " ");
+ char* limitStr = strtok(nullptr, " ");
int32 limit = limitStr ? atoi(limitStr) : -1;
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_LIST_BY_EMAIL);
diff --git a/src/server/scripts/Commands/cs_message.cpp b/src/server/scripts/Commands/cs_message.cpp
index fe52ffc4a9a..f91155b949e 100644
--- a/src/server/scripts/Commands/cs_message.cpp
+++ b/src/server/scripts/Commands/cs_message.cpp
@@ -23,12 +23,18 @@ Category: commandscripts
EndScriptData */
#include "ScriptMgr.h"
-#include "Chat.h"
#include "Channel.h"
#include "ChannelMgr.h"
+#include "Chat.h"
+#include "DatabaseEnv.h"
+#include "DBCStores.h"
#include "Language.h"
-#include "Player.h"
+#include "ObjectAccessor.h"
#include "ObjectMgr.h"
+#include "Player.h"
+#include "RBAC.h"
+#include "World.h"
+#include "WorldSession.h"
class message_commandscript : public CommandScript
{
@@ -43,11 +49,11 @@ public:
};
static std::vector<ChatCommand> channelCommandTable =
{
- { "set", rbac::RBAC_PERM_COMMAND_CHANNEL_SET, true, NULL, "", channelSetCommandTable },
+ { "set", rbac::RBAC_PERM_COMMAND_CHANNEL_SET, true, nullptr, "", channelSetCommandTable },
};
static std::vector<ChatCommand> commandTable =
{
- { "channel", rbac::RBAC_PERM_COMMAND_CHANNEL, true, NULL, "", channelCommandTable },
+ { "channel", rbac::RBAC_PERM_COMMAND_CHANNEL, true, nullptr, "", channelCommandTable },
{ "nameannounce", rbac::RBAC_PERM_COMMAND_NAMEANNOUNCE, true, &HandleNameAnnounceCommand, "" },
{ "gmnameannounce", rbac::RBAC_PERM_COMMAND_GMNAMEANNOUNCE, true, &HandleGMNameAnnounceCommand, "" },
{ "announce", rbac::RBAC_PERM_COMMAND_ANNOUNCE, true, &HandleAnnounceCommand, "" },
@@ -232,7 +238,7 @@ public:
if (argStr == "remove")
{
- std::string name = strtok(NULL, " ");
+ std::string name = strtok(nullptr, " ");
if (normalizePlayerName(name))
{
if (Player* player = ObjectAccessor::FindPlayerByName(name))
diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp
index 0a1b0f75a7b..29f1a0763fb 100644
--- a/src/server/scripts/Commands/cs_misc.cpp
+++ b/src/server/scripts/Commands/cs_misc.cpp
@@ -15,29 +15,45 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "CharacterCache.h"
-#include "Chat.h"
#include "ScriptMgr.h"
#include "AccountMgr.h"
#include "ArenaTeamMgr.h"
#include "CellImpl.h"
+#include "CharacterCache.h"
+#include "Chat.h"
+#include "DatabaseEnv.h"
+#include "DisableMgr.h"
#include "GridNotifiers.h"
#include "Group.h"
+#include "GroupMgr.h"
#include "InstanceSaveMgr.h"
+#include "Item.h"
#include "Language.h"
+#include "LFG.h"
+#include "Log.h"
+#include "MMapFactory.h"
#include "MovementGenerator.h"
+#include "ObjectAccessor.h"
+#include "ObjectMgr.h"
#include "Opcodes.h"
-#include "SpellAuras.h"
-#include "TargetedMovementGenerator.h"
-#include "WeatherMgr.h"
-#include "Player.h"
#include "Pet.h"
-#include "LFG.h"
-#include "GroupMgr.h"
-#include "MMapFactory.h"
-#include "DisableMgr.h"
+#include "Player.h"
+#include "Realm.h"
+#include "SpellAuras.h"
#include "SpellHistory.h"
+#include "SpellMgr.h"
+#include "TargetedMovementGenerator.h"
#include "Transport.h"
+#include "Weather.h"
+#include "WeatherMgr.h"
+#include "World.h"
+#include "WorldSession.h"
+#include <boost/asio/ip/address_v4.hpp>
+
+// temporary hack until includes are sorted out (don't want to pull in Windows.h)
+#ifdef GetClassName
+#undef GetClassName
+#endif
class misc_commandscript : public CommandScript
{
@@ -410,7 +426,7 @@ public:
{
Group* group = _player->GetGroup();
// if no bind exists, create a solo bind
- InstanceGroupBind* gBind = group ? group->GetBoundInstance(target) : NULL; // if no bind exists, create a solo bind
+ InstanceGroupBind* gBind = group ? group->GetBoundInstance(target) : nullptr; // if no bind exists, create a solo bind
if (!gBind)
if (InstanceSave* save = sInstanceSaveMgr->GetInstanceSave(target->GetInstanceId()))
_player->BindToInstance(save, !save->CanReset());
@@ -444,7 +460,7 @@ public:
else
{
// check offline security
- if (handler->HasLowerSecurity(NULL, targetGuid))
+ if (handler->HasLowerSecurity(nullptr, targetGuid))
return false;
std::string nameLink = handler->playerLink(targetName);
@@ -573,7 +589,7 @@ public:
else
{
// check offline security
- if (handler->HasLowerSecurity(NULL, targetGuid))
+ if (handler->HasLowerSecurity(nullptr, targetGuid))
return false;
std::string nameLink = handler->playerLink(targetName);
@@ -620,7 +636,7 @@ public:
if (sWorld->getBoolConfig(CONFIG_DIE_COMMAND_MODE))
handler->GetSession()->GetPlayer()->Kill(target);
else
- handler->GetSession()->GetPlayer()->DealDamage(target, target->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
+ handler->GetSession()->GetPlayer()->DealDamage(target, target->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
}
return true;
@@ -713,7 +729,7 @@ public:
if (!param1)
return false;
- char const* param2 = strtok(NULL, " ");
+ char const* param2 = strtok(nullptr, " ");
if (!param2)
return false;
@@ -906,9 +922,9 @@ public:
// kick player
static bool HandleKickPlayerCommand(ChatHandler* handler, char const* args)
{
- Player* target = NULL;
+ Player* target = nullptr;
std::string playerName;
- if (!handler->extractPlayerTarget((char*)args, &target, NULL, &playerName))
+ if (!handler->extractPlayerTarget((char*)args, &target, nullptr, &playerName))
return false;
if (handler->GetSession() && target == handler->GetSession()->GetPlayer())
@@ -925,8 +941,8 @@ public:
std::string kickReasonStr = handler->GetTrinityString(LANG_NO_REASON);
if (*args != '\0')
{
- char const* kickReason = strtok(NULL, "\r");
- if (kickReason != NULL)
+ char const* kickReason = strtok(nullptr, "\r");
+ if (kickReason != nullptr)
kickReasonStr = kickReason;
}
@@ -959,10 +975,10 @@ public:
return false;
std::string location_str = "inn";
- if (char const* loc = strtok(NULL, " "))
+ if (char const* loc = strtok(nullptr, " "))
location_str = loc;
- Player* player = NULL;
+ Player* player = nullptr;
if (!handler->extractPlayerTarget(player_str, &player))
return false;
@@ -1014,7 +1030,7 @@ public:
uint32 team;
- char* px2 = strtok(NULL, " ");
+ char* px2 = strtok(nullptr, " ");
if (!px2)
team = 0;
@@ -1046,7 +1062,7 @@ public:
return false;
}
- if (sObjectMgr->AddGraveYardLink(graveyardId, zoneId, team))
+ if (sObjectMgr->AddGraveyardLink(graveyardId, zoneId, team))
handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDLINKED, graveyardId, zoneId);
else
handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDALRLINKED, graveyardId, zoneId);
@@ -1072,12 +1088,12 @@ public:
Player* player = handler->GetSession()->GetPlayer();
uint32 zone_id = player->GetZoneId();
- WorldSafeLocsEntry const* graveyard = sObjectMgr->GetClosestGraveYard(player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), team);
+ WorldSafeLocsEntry const* graveyard = sObjectMgr->GetClosestGraveyard(player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), team);
if (graveyard)
{
uint32 graveyardId = graveyard->ID;
- GraveYardData const* data = sObjectMgr->FindGraveYardData(graveyardId, zone_id);
+ GraveyardData const* data = sObjectMgr->FindGraveyardData(graveyardId, zone_id);
if (!data)
{
handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDERROR, graveyardId);
@@ -1229,12 +1245,12 @@ public:
itemId = atoul(id);
}
- char const* ccount = strtok(NULL, " ");
+ char const* ccount = strtok(nullptr, " ");
int32 count = 1;
if (ccount)
- count = strtol(ccount, NULL, 10);
+ count = strtol(ccount, nullptr, 10);
if (count == 0)
count = 1;
@@ -1278,7 +1294,7 @@ public:
return false;
}
- Item* item = playerTarget->StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId));
+ Item* item = playerTarget->StoreNewItem(dest, itemId, true, GenerateItemRandomPropertyId(itemId));
// remove binding (let GM give it to another player later)
if (player == playerTarget)
@@ -1348,7 +1364,7 @@ public:
}
else
{
- player->SendEquipError(msg, NULL, NULL, itr->second.ItemId);
+ player->SendEquipError(msg, nullptr, nullptr, itr->second.ItemId);
handler->PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itr->second.ItemId, 1);
}
}
@@ -1385,7 +1401,7 @@ public:
// *Change the weather of a cell
char const* px = strtok((char*)args, " ");
- char const* py = strtok(NULL, " ");
+ char const* py = strtok(nullptr, " ");
if (!px || !py)
return false;
@@ -1435,11 +1451,11 @@ public:
if (!skillStr)
return false;
- char const* levelStr = strtok(NULL, " ");
+ char const* levelStr = strtok(nullptr, " ");
if (!levelStr)
return false;
- char const* maxPureSkill = strtok(NULL, " ");
+ char const* maxPureSkill = strtok(nullptr, " ");
int32 skill = atoi(skillStr);
if (skill <= 0)
@@ -1508,7 +1524,7 @@ public:
Player* target;
ObjectGuid targetGuid;
std::string targetName;
- PreparedStatement* stmt = NULL;
+ PreparedStatement* stmt = nullptr;
// To make sure we get a target, we convert our guid to an omniversal...
ObjectGuid parseGUID(HighGuid::Player, uint32(atoul(args)));
@@ -1633,7 +1649,7 @@ public:
else
{
// check offline security
- if (handler->HasLowerSecurity(NULL, targetGuid))
+ if (handler->HasLowerSecurity(nullptr, targetGuid))
return false;
// Query informations from the DB
@@ -1684,7 +1700,7 @@ public:
lastIp = fields[4].GetString();
lastLogin = fields[5].GetString();
- uint32 ip = inet_addr(lastIp.c_str());
+ uint32 ip = boost::asio::ip::address_v4::from_string(lastIp).to_ulong();
EndianConvertReverse(ip);
// If ip2nation table is populated, it displays the country
@@ -1779,7 +1795,7 @@ public:
// Output III. LANG_PINFO_BANNED if ban exists and is applied
if (banTime >= 0)
- handler->PSendSysMessage(LANG_PINFO_BANNED, banType.c_str(), banReason.c_str(), banTime > 0 ? secsToTimeString(banTime - time(NULL), true).c_str() : handler->GetTrinityString(LANG_PERMANENTLY), bannedBy.c_str());
+ handler->PSendSysMessage(LANG_PINFO_BANNED, banType.c_str(), banReason.c_str(), banTime > 0 ? secsToTimeString(banTime - time(nullptr), true).c_str() : handler->GetTrinityString(LANG_PERMANENTLY), bannedBy.c_str());
// Output IV. LANG_PINFO_MUTED if mute is applied
if (muteTime > 0)
@@ -1910,9 +1926,9 @@ public:
if (!delayStr)
return false;
- char const* muteReason = strtok(NULL, "\r");
+ char const* muteReason = strtok(nullptr, "\r");
std::string muteReasonStr = handler->GetTrinityString(LANG_NO_REASON);
- if (muteReason != NULL)
+ if (muteReason != nullptr)
muteReasonStr = muteReason;
Player* target;
@@ -1944,7 +1960,7 @@ public:
if (target)
{
// Target is online, mute will be in effect right away.
- int64 muteTime = time(NULL) + notSpeakTime * MINUTE;
+ int64 muteTime = time(nullptr) + notSpeakTime * MINUTE;
target->GetSession()->m_muteTime = muteTime;
stmt->setInt64(0, muteTime);
std::string nameLink = handler->playerLink(targetName);
@@ -2131,7 +2147,7 @@ public:
break;
case CHASE_MOTION_TYPE:
{
- Unit* target = NULL;
+ Unit* target = nullptr;
if (unit->GetTypeId() == TYPEID_PLAYER)
target = static_cast<ChaseMovementGenerator<Player> const*>(movementGenerator)->GetTarget();
else
@@ -2147,7 +2163,7 @@ public:
}
case FOLLOW_MOTION_TYPE:
{
- Unit* target = NULL;
+ Unit* target = nullptr;
if (unit->GetTypeId() == TYPEID_PLAYER)
target = static_cast<FollowMovementGenerator<Player> const*>(movementGenerator)->GetTarget();
else
@@ -2220,7 +2236,7 @@ public:
if (strcmp(str, "go") == 0)
{
- char* guidStr = strtok(NULL, " ");
+ char* guidStr = strtok(nullptr, " ");
if (!guidStr)
{
handler->SendSysMessage(LANG_BAD_VALUE);
@@ -2236,7 +2252,7 @@ public:
return false;
}
- char* damageStr = strtok(NULL, " ");
+ char* damageStr = strtok(nullptr, " ");
if (!damageStr)
{
handler->SendSysMessage(LANG_BAD_VALUE);
@@ -2301,12 +2317,12 @@ public:
uint32 damage = damage_int;
- char* schoolStr = strtok((char*)NULL, " ");
+ char* schoolStr = strtok((char*)nullptr, " ");
// flat melee damage without resistence/etc reduction
if (!schoolStr)
{
- handler->GetSession()->GetPlayer()->DealDamage(target, damage, NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
+ handler->GetSession()->GetPlayer()->DealDamage(target, damage, nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
if (target != handler->GetSession()->GetPlayer())
handler->GetSession()->GetPlayer()->SendAttackStateUpdate (HITINFO_AFFECTS_VICTIM, target, 1, SPELL_SCHOOL_MASK_NORMAL, damage, 0, 0, VICTIMSTATE_HIT, 0);
return true;
@@ -2319,9 +2335,9 @@ public:
SpellSchoolMask schoolmask = SpellSchoolMask(1 << school);
if (Unit::IsDamageReducedByArmor(schoolmask))
- damage = handler->GetSession()->GetPlayer()->CalcArmorReducedDamage(target, damage, NULL, BASE_ATTACK);
+ damage = handler->GetSession()->GetPlayer()->CalcArmorReducedDamage(target, damage, nullptr, BASE_ATTACK);
- char* spellStr = strtok((char*)NULL, " ");
+ char* spellStr = strtok((char*)nullptr, " ");
// melee damage by specific school
if (!spellStr)
@@ -2368,7 +2384,7 @@ public:
static bool HandleCombatStopCommand(ChatHandler* handler, char const* args)
{
- Player* target = NULL;
+ Player* target = nullptr;
if (args && args[0] != '\0')
{
@@ -2448,7 +2464,7 @@ public:
{
// Get the args that we might have (up to 2)
char const* arg1 = strtok((char*)args, " ");
- char const* arg2 = strtok(NULL, " ");
+ char const* arg2 = strtok(nullptr, " ");
// Analyze them to see if we got either a playerName or duration or both
if (arg1)
diff --git a/src/server/scripts/Commands/cs_mmaps.cpp b/src/server/scripts/Commands/cs_mmaps.cpp
index acee88ce4d5..4a709de2560 100644
--- a/src/server/scripts/Commands/cs_mmaps.cpp
+++ b/src/server/scripts/Commands/cs_mmaps.cpp
@@ -24,18 +24,17 @@
*/
#include "ScriptMgr.h"
+#include "CellImpl.h"
#include "Chat.h"
#include "DisableMgr.h"
-#include "ObjectMgr.h"
+#include "GridNotifiersImpl.h"
+#include "Map.h"
+#include "MMapFactory.h"
+#include "PathGenerator.h"
#include "Player.h"
#include "PointMovementGenerator.h"
-#include "PathGenerator.h"
-#include "MMapFactory.h"
-#include "Map.h"
+#include "RBAC.h"
#include "TargetedMovementGenerator.h"
-#include "GridNotifiers.h"
-#include "GridNotifiersImpl.h"
-#include "CellImpl.h"
class mmaps_commandscript : public CommandScript
{
@@ -55,7 +54,7 @@ public:
static std::vector<ChatCommand> commandTable =
{
- { "mmap", rbac::RBAC_PERM_COMMAND_MMAP, true, NULL, "", mmapCommandTable },
+ { "mmap", rbac::RBAC_PERM_COMMAND_MMAP, true, nullptr, "", mmapCommandTable },
};
return commandTable;
}
@@ -103,9 +102,9 @@ public:
handler->PSendSysMessage("Building: %s", useStraightPath ? "StraightPath" : useStraightLine ? "Raycast" : "SmoothPath");
handler->PSendSysMessage("Result: %s - Length: %zu - Type: %u", (result ? "true" : "false"), pointPath.size(), path.GetPathType());
- G3D::Vector3 const &start = path.GetStartPosition();
- G3D::Vector3 const &end = path.GetEndPosition();
- G3D::Vector3 const &actualEnd = path.GetActualEndPosition();
+ G3D::Vector3 const& start = path.GetStartPosition();
+ G3D::Vector3 const& end = path.GetEndPosition();
+ G3D::Vector3 const& actualEnd = path.GetActualEndPosition();
handler->PSendSysMessage("StartPosition (%.3f, %.3f, %.3f)", start.x, start.y, start.z);
handler->PSendSysMessage("EndPosition (%.3f, %.3f, %.3f)", end.x, end.y, end.z);
@@ -156,7 +155,7 @@ public:
// navmesh poly -> navmesh tile location
dtQueryFilter filter = dtQueryFilter();
dtPolyRef polyRef = INVALID_POLYREF;
- if (dtStatusFailed(navmeshquery->findNearestPoly(location, extents, &filter, &polyRef, NULL)))
+ if (dtStatusFailed(navmeshquery->findNearestPoly(location, extents, &filter, &polyRef, nullptr)))
{
handler->PSendSysMessage("Dt [??,??] (invalid poly, probably no tile loaded)");
return true;
diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp
index 5b2507482dd..af8e5c12268 100644
--- a/src/server/scripts/Commands/cs_modify.cpp
+++ b/src/server/scripts/Commands/cs_modify.cpp
@@ -22,14 +22,17 @@ Comment: All modify related commands
Category: commandscripts
EndScriptData */
+#include "ScriptMgr.h"
#include "Chat.h"
+#include "DBCStores.h"
+#include "Log.h"
#include "ObjectMgr.h"
#include "Opcodes.h"
#include "Pet.h"
#include "Player.h"
+#include "RBAC.h"
#include "ReputationMgr.h"
-#include "ScriptMgr.h"
-
+#include "WorldSession.h"
class modify_commandscript : public CommandScript
{
@@ -65,7 +68,7 @@ public:
{ "reputation", rbac::RBAC_PERM_COMMAND_MODIFY_REPUTATION, false, &HandleModifyRepCommand, "" },
{ "runicpower", rbac::RBAC_PERM_COMMAND_MODIFY_RUNICPOWER, false, &HandleModifyRunicPowerCommand, "" },
{ "scale", rbac::RBAC_PERM_COMMAND_MODIFY_SCALE, false, &HandleModifyScaleCommand, "" },
- { "speed", rbac::RBAC_PERM_COMMAND_MODIFY_SPEED, false, NULL, "", modifyspeedCommandTable },
+ { "speed", rbac::RBAC_PERM_COMMAND_MODIFY_SPEED, false, nullptr, "", modifyspeedCommandTable },
{ "spell", rbac::RBAC_PERM_COMMAND_MODIFY_SPELL, false, &HandleModifySpellCommand, "" },
{ "standstate", rbac::RBAC_PERM_COMMAND_MODIFY_STANDSTATE, false, &HandleModifyStandStateCommand, "" },
{ "talentpoints", rbac::RBAC_PERM_COMMAND_MODIFY_TALENTPOINTS, false, &HandleModifyTalentCommand, "" },
@@ -75,7 +78,7 @@ public:
{
{ "morph", rbac::RBAC_PERM_COMMAND_MORPH, false, &HandleModifyMorphCommand, "" },
{ "demorph", rbac::RBAC_PERM_COMMAND_DEMORPH, false, &HandleDeMorphCommand, "" },
- { "modify", rbac::RBAC_PERM_COMMAND_MODIFY, false, NULL, "", modifyCommandTable },
+ { "modify", rbac::RBAC_PERM_COMMAND_MODIFY, false, nullptr, "", modifyCommandTable },
};
return commandTable;
}
@@ -91,7 +94,7 @@ public:
}
}
- static bool CheckModifyResources(ChatHandler* handler, const char* args, Player* target, int32& res, int32& resmax, int8 const multiplier = 1)
+ static bool CheckModifyResources(ChatHandler* handler, char const* args, Player* target, int32& res, int32& resmax, int8 const multiplier = 1)
{
if (!*args)
return false;
@@ -120,7 +123,7 @@ public:
}
//Edit Player HP
- static bool HandleModifyHPCommand(ChatHandler* handler, const char* args)
+ static bool HandleModifyHPCommand(ChatHandler* handler, char const* args)
{
int32 hp, hpmax;
Player* target = handler->getSelectedPlayerOrSelf();
@@ -135,7 +138,7 @@ public:
}
//Edit Player Mana
- static bool HandleModifyManaCommand(ChatHandler* handler, const char* args)
+ static bool HandleModifyManaCommand(ChatHandler* handler, char const* args)
{
int32 mana, manamax;
Player* target = handler->getSelectedPlayerOrSelf();
@@ -151,7 +154,7 @@ public:
}
//Edit Player Energy
- static bool HandleModifyEnergyCommand(ChatHandler* handler, const char* args)
+ static bool HandleModifyEnergyCommand(ChatHandler* handler, char const* args)
{
int32 energy, energymax;
Player* target = handler->getSelectedPlayerOrSelf();
@@ -168,7 +171,7 @@ public:
}
//Edit Player Rage
- static bool HandleModifyRageCommand(ChatHandler* handler, const char* args)
+ static bool HandleModifyRageCommand(ChatHandler* handler, char const* args)
{
int32 rage, ragemax;
Player* target = handler->getSelectedPlayerOrSelf();
@@ -184,7 +187,7 @@ public:
}
// Edit Player Runic Power
- static bool HandleModifyRunicPowerCommand(ChatHandler* handler, const char* args)
+ static bool HandleModifyRunicPowerCommand(ChatHandler* handler, char const* args)
{
int32 rune, runemax;
Player* target = handler->getSelectedPlayerOrSelf();
@@ -200,7 +203,7 @@ public:
}
//Edit Player Faction
- static bool HandleModifyFactionCommand(ChatHandler* handler, const char* args)
+ static bool HandleModifyFactionCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -228,13 +231,13 @@ public:
uint32 factionid = atoi(pfactionid);
uint32 flag;
- char *pflag = strtok(NULL, " ");
+ char *pflag = strtok(nullptr, " ");
if (!pflag)
flag = target->GetUInt32Value(UNIT_FIELD_FLAGS);
else
flag = atoi(pflag);
- char* pnpcflag = strtok(NULL, " ");
+ char* pnpcflag = strtok(nullptr, " ");
uint32 npcflag;
if (!pnpcflag)
@@ -242,7 +245,7 @@ public:
else
npcflag = atoi(pnpcflag);
- char* pdyflag = strtok(NULL, " ");
+ char* pdyflag = strtok(nullptr, " ");
uint32 dyflag;
if (!pdyflag)
@@ -268,7 +271,7 @@ public:
}
//Edit Player Spell
- static bool HandleModifySpellCommand(ChatHandler* handler, const char* args)
+ static bool HandleModifySpellCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -277,17 +280,17 @@ public:
if (!pspellflatid)
return false;
- char* pop = strtok(NULL, " ");
+ char* pop = strtok(nullptr, " ");
if (!pop)
return false;
- char* pval = strtok(NULL, " ");
+ char* pval = strtok(nullptr, " ");
if (!pval)
return false;
uint16 mark;
- char* pmark = strtok(NULL, " ");
+ char* pmark = strtok(nullptr, " ");
uint8 spellflatid = atoi(pspellflatid);
uint8 op = atoi(pop);
@@ -298,7 +301,7 @@ public:
mark = atoi(pmark);
Player* target = handler->getSelectedPlayerOrSelf();
- if (target == NULL)
+ if (target == nullptr)
{
handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
handler->SetSentErrorMessage(true);
@@ -318,13 +321,13 @@ public:
data << uint8(op);
data << uint16(val);
data << uint16(mark);
- target->GetSession()->SendPacket(&data);
+ target->SendDirectMessage(&data);
return true;
}
//Edit Player TP
- static bool HandleModifyTalentCommand (ChatHandler* handler, const char* args)
+ static bool HandleModifyTalentCommand (ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -369,7 +372,7 @@ public:
return false;
}
- static bool CheckModifySpeed(ChatHandler* handler, const char* args, Unit* target, float& speed, float minimumBound, float maximumBound, bool checkInFlight = true)
+ static bool CheckModifySpeed(ChatHandler* handler, char const* args, Unit* target, float& speed, float minimumBound, float maximumBound, bool checkInFlight = true)
{
if (!*args)
return false;
@@ -407,7 +410,7 @@ public:
}
//Edit Player Aspeed
- static bool HandleModifyASpeedCommand(ChatHandler* handler, const char* args)
+ static bool HandleModifyASpeedCommand(ChatHandler* handler, char const* args)
{
float allSpeed;
Player* target = handler->getSelectedPlayerOrSelf();
@@ -424,7 +427,7 @@ public:
}
//Edit Player Speed
- static bool HandleModifySpeedCommand(ChatHandler* handler, const char* args)
+ static bool HandleModifySpeedCommand(ChatHandler* handler, char const* args)
{
float Speed;
Player* target = handler->getSelectedPlayerOrSelf();
@@ -438,7 +441,7 @@ public:
}
//Edit Player Swim Speed
- static bool HandleModifySwimCommand(ChatHandler* handler, const char* args)
+ static bool HandleModifySwimCommand(ChatHandler* handler, char const* args)
{
float swimSpeed;
Player* target = handler->getSelectedPlayerOrSelf();
@@ -452,7 +455,7 @@ public:
}
//Edit Player Backwards Walk Speed
- static bool HandleModifyBWalkCommand(ChatHandler* handler, const char* args)
+ static bool HandleModifyBWalkCommand(ChatHandler* handler, char const* args)
{
float backSpeed;
Player* target = handler->getSelectedPlayerOrSelf();
@@ -466,7 +469,7 @@ public:
}
//Edit Player Fly
- static bool HandleModifyFlyCommand(ChatHandler* handler, const char* args)
+ static bool HandleModifyFlyCommand(ChatHandler* handler, char const* args)
{
float flySpeed;
Player* target = handler->getSelectedPlayerOrSelf();
@@ -480,7 +483,7 @@ public:
}
//Edit Player or Creature Scale
- static bool HandleModifyScaleCommand(ChatHandler* handler, const char* args)
+ static bool HandleModifyScaleCommand(ChatHandler* handler, char const* args)
{
float Scale;
Unit* target = handler->getSelectedUnit();
@@ -494,7 +497,7 @@ public:
}
//Enable Player mount
- static bool HandleModifyMountCommand(ChatHandler* handler, const char* args)
+ static bool HandleModifyMountCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -753,7 +756,7 @@ public:
}
//Edit Player money
- static bool HandleModifyMoneyCommand(ChatHandler* handler, const char* args)
+ static bool HandleModifyMoneyCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -817,7 +820,7 @@ public:
}
//Edit Unit field
- static bool HandleModifyBitCommand(ChatHandler* handler, const char* args)
+ static bool HandleModifyBitCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -838,7 +841,7 @@ public:
if (!pField)
return false;
- char* pBit = strtok(NULL, " ");
+ char* pBit = strtok(nullptr, " ");
if (!pBit)
return false;
@@ -871,7 +874,7 @@ public:
return true;
}
- static bool HandleModifyHonorCommand (ChatHandler* handler, const char* args)
+ static bool HandleModifyHonorCommand (ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -897,7 +900,7 @@ public:
return true;
}
- static bool HandleModifyDrunkCommand(ChatHandler* handler, const char* args)
+ static bool HandleModifyDrunkCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -912,7 +915,7 @@ public:
return true;
}
- static bool HandleModifyRepCommand(ChatHandler* handler, const char* args)
+ static bool HandleModifyRepCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -936,7 +939,7 @@ public:
uint32 factionId = atoi(factionTxt);
int32 amount = 0;
- char *rankTxt = strtok(NULL, " ");
+ char *rankTxt = strtok(nullptr, " ");
if (!factionId || !rankTxt)
return false;
@@ -965,7 +968,7 @@ public:
if (wrank.substr(0, wrankStr.size()) == wrankStr)
{
- char *deltaTxt = strtok(NULL, " ");
+ char *deltaTxt = strtok(nullptr, " ");
if (deltaTxt)
{
int32 delta = atoi(deltaTxt);
@@ -1013,7 +1016,7 @@ public:
}
//morph creature or player
- static bool HandleModifyMorphCommand(ChatHandler* handler, const char* args)
+ static bool HandleModifyMorphCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -1034,7 +1037,7 @@ public:
}
//set temporary phase mask for player
- static bool HandleModifyPhaseCommand(ChatHandler* handler, const char* args)
+ static bool HandleModifyPhaseCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -1055,7 +1058,7 @@ public:
}
//change standstate
- static bool HandleModifyStandStateCommand(ChatHandler* handler, const char* args)
+ static bool HandleModifyStandStateCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -1066,7 +1069,7 @@ public:
return true;
}
- static bool HandleModifyArenaCommand(ChatHandler* handler, const char* args)
+ static bool HandleModifyArenaCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -1088,7 +1091,7 @@ public:
return true;
}
- static bool HandleModifyGenderCommand(ChatHandler* handler, const char* args)
+ static bool HandleModifyGenderCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -1149,7 +1152,7 @@ public:
return true;
}
//demorph player or unit
- static bool HandleDeMorphCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleDeMorphCommand(ChatHandler* handler, char const* /*args*/)
{
Unit* target = handler->getSelectedUnit();
if (!target)
@@ -1165,7 +1168,7 @@ public:
}
// mod xp command
- static bool HandleModifyXPCommand(ChatHandler *handler, const char* args)
+ static bool HandleModifyXPCommand(ChatHandler *handler, char const* args)
{
if (!*args)
return false;
diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp
index 5eea88f13c8..dfb9ddb66a6 100644
--- a/src/server/scripts/Commands/cs_npc.cpp
+++ b/src/server/scripts/Commands/cs_npc.cpp
@@ -23,15 +23,22 @@ Category: commandscripts
EndScriptData */
#include "ScriptMgr.h"
-#include "ObjectMgr.h"
#include "Chat.h"
-#include "Transport.h"
+#include "CreatureAI.h"
#include "CreatureGroups.h"
+#include "DatabaseEnv.h"
#include "Language.h"
-#include "TargetedMovementGenerator.h" // for HandleNpcUnFollowCommand
-#include "CreatureAI.h"
-#include "Player.h"
+#include "Log.h"
+#include "Map.h"
+#include "ObjectAccessor.h"
+#include "ObjectMgr.h"
#include "Pet.h"
+#include "Player.h"
+#include "RBAC.h"
+#include "TargetedMovementGenerator.h" // for HandleNpcUnFollowCommand
+#include "Transport.h"
+#include "World.h"
+#include "WorldSession.h"
template<typename E, typename T = char const*>
struct EnumName
@@ -683,7 +690,7 @@ public:
uint32 nativeid = target->GetNativeDisplayId();
uint32 Entry = target->GetEntry();
- int64 curRespawnDelay = target->GetRespawnTimeEx()-time(NULL);
+ int64 curRespawnDelay = target->GetRespawnTimeEx()-time(nullptr);
if (curRespawnDelay < 0)
curRespawnDelay = 0;
std::string curRespawnDelayStr = secsToTimeString(uint64(curRespawnDelay), true);
@@ -1457,7 +1464,7 @@ public:
if (!name)
name = "Unknown item";
handler->PSendSysMessage(alternateString ? LANG_COMMAND_NPC_SHOWLOOT_ENTRY_2 : LANG_COMMAND_NPC_SHOWLOOT_ENTRY,
- itemCount, ItemQualityColors[itemTemplate ? itemTemplate->Quality : ITEM_QUALITY_POOR], itemId, name, itemId);
+ itemCount, ItemQualityColors[itemTemplate ? itemTemplate->Quality : uint32(ITEM_QUALITY_POOR)], itemId, name, itemId);
}
static void _IterateNotNormalLootMap(ChatHandler* handler, NotNormalLootItemMap const& map, std::vector<LootItem> const& items)
{
diff --git a/src/server/scripts/Commands/cs_pet.cpp b/src/server/scripts/Commands/cs_pet.cpp
index 552bf15d0c4..3f75e44b5ca 100644
--- a/src/server/scripts/Commands/cs_pet.cpp
+++ b/src/server/scripts/Commands/cs_pet.cpp
@@ -15,14 +15,19 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "ScriptMgr.h"
#include "Chat.h"
#include "Language.h"
+#include "Log.h"
+#include "Map.h"
+#include "ObjectMgr.h"
#include "Pet.h"
#include "Player.h"
-#include "ObjectMgr.h"
-#include "ScriptMgr.h"
+#include "RBAC.h"
+#include "SpellMgr.h"
+#include "WorldSession.h"
-static inline Pet* GetSelectedPlayerPetOrOwn(ChatHandler* handler)
+inline Pet* GetSelectedPlayerPetOrOwn(ChatHandler* handler)
{
if (Unit* target = handler->getSelectedUnit())
{
@@ -35,6 +40,7 @@ static inline Pet* GetSelectedPlayerPetOrOwn(ChatHandler* handler)
Player* player = handler->GetSession()->GetPlayer();
return player ? player->GetPet() : nullptr;
}
+
class pet_commandscript : public CommandScript
{
public:
@@ -52,7 +58,7 @@ public:
static std::vector<ChatCommand> commandTable =
{
- { "pet", rbac::RBAC_PERM_COMMAND_PET, false, NULL, "", petCommandTable },
+ { "pet", rbac::RBAC_PERM_COMMAND_PET, false, nullptr, "", petCommandTable },
};
return commandTable;
}
diff --git a/src/server/scripts/Commands/cs_quest.cpp b/src/server/scripts/Commands/cs_quest.cpp
index 36134848d81..cd21909a872 100644
--- a/src/server/scripts/Commands/cs_quest.cpp
+++ b/src/server/scripts/Commands/cs_quest.cpp
@@ -22,11 +22,15 @@ Comment: All quest related commands
Category: commandscripts
EndScriptData */
+#include "ScriptMgr.h"
#include "Chat.h"
+#include "DatabaseEnv.h"
+#include "DBCStores.h"
#include "ObjectMgr.h"
#include "Player.h"
+#include "RBAC.h"
#include "ReputationMgr.h"
-#include "ScriptMgr.h"
+#include "World.h"
class quest_commandscript : public CommandScript
{
@@ -44,12 +48,12 @@ public:
};
static std::vector<ChatCommand> commandTable =
{
- { "quest", rbac::RBAC_PERM_COMMAND_QUEST, false, NULL, "", questCommandTable },
+ { "quest", rbac::RBAC_PERM_COMMAND_QUEST, false, nullptr, "", questCommandTable },
};
return commandTable;
}
- static bool HandleQuestAdd(ChatHandler* handler, const char* args)
+ static bool HandleQuestAdd(ChatHandler* handler, char const* args)
{
Player* player = handler->getSelectedPlayerOrSelf();
if (!player)
@@ -78,7 +82,10 @@ public:
// check item starting quest (it can work incorrectly if added without item in inventory)
ItemTemplateContainer const* itc = sObjectMgr->GetItemTemplateStore();
- ItemTemplateContainer::const_iterator result = find_if (itc->begin(), itc->end(), Finder<uint32, ItemTemplate>(entry, &ItemTemplate::StartQuest));
+ ItemTemplateContainer::const_iterator result = std::find_if(itc->begin(), itc->end(), [quest](ItemTemplateContainer::value_type const& value)
+ {
+ return value.second.StartQuest == quest->GetQuestId();
+ });
if (result != itc->end())
{
@@ -89,12 +96,12 @@ public:
// ok, normal (creature/GO starting) quest
if (player->CanAddQuest(quest, true))
- player->AddQuestAndCheckCompletion(quest, NULL);
+ player->AddQuestAndCheckCompletion(quest, nullptr);
return true;
}
- static bool HandleQuestRemove(ChatHandler* handler, const char* args)
+ static bool HandleQuestRemove(ChatHandler* handler, char const* args)
{
Player* player = handler->getSelectedPlayer();
if (!player)
@@ -149,7 +156,7 @@ public:
return true;
}
- static bool HandleQuestComplete(ChatHandler* handler, const char* args)
+ static bool HandleQuestComplete(ChatHandler* handler, char const* args)
{
Player* player = handler->getSelectedPlayerOrSelf();
if (!player)
diff --git a/src/server/scripts/Commands/cs_rbac.cpp b/src/server/scripts/Commands/cs_rbac.cpp
index eb646d8bcd8..bfc01c0bc47 100644
--- a/src/server/scripts/Commands/cs_rbac.cpp
+++ b/src/server/scripts/Commands/cs_rbac.cpp
@@ -22,16 +22,19 @@ Comment: All role based access control related commands (including account relat
Category: commandscripts
EndScriptData */
+#include "ScriptMgr.h"
#include "AccountMgr.h"
-#include "Config.h"
#include "Chat.h"
+#include "Config.h"
#include "Language.h"
#include "Player.h"
-#include "ScriptMgr.h"
+#include "Realm.h"
+#include "World.h"
+#include "WorldSession.h"
struct RBACCommandData
{
- RBACCommandData(): id(0), realmId(0), rbac(NULL), needDelete(false) { }
+ RBACCommandData(): id(0), realmId(0), rbac(nullptr), needDelete(false) { }
~RBACCommandData()
{
if (needDelete)
@@ -61,13 +64,13 @@ public:
static std::vector<ChatCommand> rbacCommandTable =
{
- { "account", rbac::RBAC_PERM_COMMAND_RBAC_ACC, true, NULL, "", rbacAccountCommandTable },
+ { "account", rbac::RBAC_PERM_COMMAND_RBAC_ACC, true, nullptr, "", rbacAccountCommandTable },
{ "list", rbac::RBAC_PERM_COMMAND_RBAC_LIST, true, &HandleRBACListPermissionsCommand, "" },
};
static std::vector<ChatCommand> commandTable =
{
- { "rbac", rbac::RBAC_PERM_COMMAND_RBAC, true, NULL, "", rbacCommandTable },
+ { "rbac", rbac::RBAC_PERM_COMMAND_RBAC, true, nullptr, "", rbacCommandTable },
};
return commandTable;
@@ -76,18 +79,18 @@ public:
static RBACCommandData* ReadParams(ChatHandler* handler, char const* args, bool checkParams = true)
{
if (!args)
- return NULL;
+ return nullptr;
char* param1 = strtok((char*)args, " ");
- char* param2 = strtok(NULL, " ");
- char* param3 = strtok(NULL, " ");
+ char* param2 = strtok(nullptr, " ");
+ char* param3 = strtok(nullptr, " ");
int32 realmId = -1;
uint32 accountId = 0;
std::string accountName;
uint32 id = 0;
- RBACCommandData* data = NULL;
- rbac::RBACData* rdata = NULL;
+ RBACCommandData* data = nullptr;
+ rbac::RBACData* rdata = nullptr;
bool useSelectedPlayer = false;
if (checkParams)
@@ -112,14 +115,14 @@ public:
{
handler->PSendSysMessage(LANG_RBAC_WRONG_PARAMETER_ID, id);
handler->SetSentErrorMessage(true);
- return NULL;
+ return nullptr;
}
if (realmId < -1 || !realmId)
{
handler->PSendSysMessage(LANG_RBAC_WRONG_PARAMETER_REALM, realmId);
handler->SetSentErrorMessage(true);
- return NULL;
+ return nullptr;
}
}
else if (!param1)
@@ -129,7 +132,7 @@ public:
{
Player* player = handler->getSelectedPlayer();
if (!player)
- return NULL;
+ return nullptr;
rdata = player->GetSession()->GetRBACData();
accountId = rdata->GetId();
@@ -146,12 +149,12 @@ public:
{
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
handler->SetSentErrorMessage(true);
- return NULL;
+ return nullptr;
}
}
- if (checkParams && handler->HasLowerSecurityAccount(NULL, accountId, true))
- return NULL;
+ if (checkParams && handler->HasLowerSecurityAccount(nullptr, accountId, true))
+ return nullptr;
data = new RBACCommandData();
diff --git a/src/server/scripts/Commands/cs_reload.cpp b/src/server/scripts/Commands/cs_reload.cpp
index 46f71972242..faeb77cccec 100644
--- a/src/server/scripts/Commands/cs_reload.cpp
+++ b/src/server/scripts/Commands/cs_reload.cpp
@@ -22,18 +22,22 @@ Comment: All reload related commands
Category: commandscripts
EndScriptData */
+#include "ScriptMgr.h"
#include "AccountMgr.h"
#include "AchievementMgr.h"
#include "AuctionHouseMgr.h"
#include "BattlegroundMgr.h"
#include "Chat.h"
#include "CreatureTextMgr.h"
+#include "DatabaseEnv.h"
#include "DisableMgr.h"
+#include "ItemEnchantmentMgr.h"
#include "Language.h"
#include "LFGMgr.h"
+#include "Log.h"
+#include "LootMgr.h"
#include "MapManager.h"
#include "ObjectMgr.h"
-#include "ScriptMgr.h"
#include "SkillDiscovery.h"
#include "SkillExtraItems.h"
#include "SmartAI.h"
@@ -41,6 +45,7 @@ EndScriptData */
#include "TicketMgr.h"
#include "WardenCheckMgr.h"
#include "WaypointManager.h"
+#include "World.h"
class reload_commandscript : public CommandScript
{
@@ -69,7 +74,7 @@ public:
{ "access_requirement", rbac::RBAC_PERM_COMMAND_RELOAD_ACCESS_REQUIREMENT, true, &HandleReloadAccessRequirementCommand, "" },
{ "achievement_criteria_data", rbac::RBAC_PERM_COMMAND_RELOAD_ACHIEVEMENT_CRITERIA_DATA, true, &HandleReloadAchievementCriteriaDataCommand, "" },
{ "achievement_reward", rbac::RBAC_PERM_COMMAND_RELOAD_ACHIEVEMENT_REWARD, true, &HandleReloadAchievementRewardCommand, "" },
- { "all", rbac::RBAC_PERM_COMMAND_RELOAD_ALL, true, NULL, "", reloadAllCommandTable },
+ { "all", rbac::RBAC_PERM_COMMAND_RELOAD_ALL, true, nullptr, "", reloadAllCommandTable },
{ "areatrigger_involvedrelation", rbac::RBAC_PERM_COMMAND_RELOAD_AREATRIGGER_INVOLVEDRELATION, true, &HandleReloadQuestAreaTriggersCommand, "" },
{ "areatrigger_tavern", rbac::RBAC_PERM_COMMAND_RELOAD_AREATRIGGER_TAVERN, true, &HandleReloadAreaTriggerTavernCommand, "" },
{ "areatrigger_teleport", rbac::RBAC_PERM_COMMAND_RELOAD_AREATRIGGER_TELEPORT, true, &HandleReloadAreaTriggerTeleportCommand, "" },
@@ -158,19 +163,19 @@ public:
};
static std::vector<ChatCommand> commandTable =
{
- { "reload", rbac::RBAC_PERM_COMMAND_RELOAD, true, NULL, "", reloadCommandTable },
+ { "reload", rbac::RBAC_PERM_COMMAND_RELOAD, true, nullptr, "", reloadCommandTable },
};
return commandTable;
}
//reload commands
- static bool HandleReloadGMTicketsCommand(ChatHandler* /*handler*/, const char* /*args*/)
+ static bool HandleReloadGMTicketsCommand(ChatHandler* /*handler*/, char const* /*args*/)
{
sTicketMgr->LoadTickets();
return true;
}
- static bool HandleReloadAllCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadAllCommand(ChatHandler* handler, char const* /*args*/)
{
HandleReloadSkillFishingBaseLevelCommand(handler, "");
@@ -201,14 +206,14 @@ public:
return true;
}
- static bool HandleReloadAllAchievementCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadAllAchievementCommand(ChatHandler* handler, char const* /*args*/)
{
HandleReloadAchievementCriteriaDataCommand(handler, "");
HandleReloadAchievementRewardCommand(handler, "");
return true;
}
- static bool HandleReloadAllAreaCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadAllAreaCommand(ChatHandler* handler, char const* /*args*/)
{
//HandleReloadQuestAreaTriggersCommand(handler, ""); -- reloaded in HandleReloadAllQuestCommand
HandleReloadAreaTriggerTeleportCommand(handler, "");
@@ -217,7 +222,7 @@ public:
return true;
}
- static bool HandleReloadAllLootCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadAllLootCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Loot Tables...");
LoadLootTables();
@@ -226,7 +231,7 @@ public:
return true;
}
- static bool HandleReloadAllNpcCommand(ChatHandler* handler, const char* args)
+ static bool HandleReloadAllNpcCommand(ChatHandler* handler, char const* args)
{
if (*args != 'a') // will be reloaded from all_gossips
HandleReloadNpcTrainerCommand(handler, "a");
@@ -236,7 +241,7 @@ public:
return true;
}
- static bool HandleReloadAllQuestCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadAllQuestCommand(ChatHandler* handler, char const* /*args*/)
{
HandleReloadQuestAreaTriggersCommand(handler, "a");
HandleReloadQuestPOICommand(handler, "a");
@@ -248,7 +253,7 @@ public:
return true;
}
- static bool HandleReloadAllScriptsCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadAllScriptsCommand(ChatHandler* handler, char const* /*args*/)
{
if (sMapMgr->IsScriptScheduled())
{
@@ -266,7 +271,7 @@ public:
return true;
}
- static bool HandleReloadAllSpellCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadAllSpellCommand(ChatHandler* handler, char const* /*args*/)
{
HandleReloadSkillDiscoveryTemplateCommand(handler, "a");
HandleReloadSkillExtraItemTemplateCommand(handler, "a");
@@ -284,7 +289,7 @@ public:
return true;
}
- static bool HandleReloadAllGossipsCommand(ChatHandler* handler, const char* args)
+ static bool HandleReloadAllGossipsCommand(ChatHandler* handler, char const* args)
{
HandleReloadGossipMenuCommand(handler, "a");
HandleReloadGossipMenuOptionCommand(handler, "a");
@@ -293,14 +298,14 @@ public:
return true;
}
- static bool HandleReloadAllItemCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadAllItemCommand(ChatHandler* handler, char const* /*args*/)
{
HandleReloadPageTextsCommand(handler, "a");
HandleReloadItemEnchantementsCommand(handler, "a");
return true;
}
- static bool HandleReloadAllLocalesCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadAllLocalesCommand(ChatHandler* handler, char const* /*args*/)
{
HandleReloadLocalesAchievementRewardCommand(handler, "a");
HandleReloadLocalesCreatureCommand(handler, "a");
@@ -315,7 +320,7 @@ public:
return true;
}
- static bool HandleReloadConfigCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadConfigCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading config settings...");
sWorld->LoadConfigSettings(true);
@@ -324,7 +329,7 @@ public:
return true;
}
- static bool HandleReloadAccessRequirementCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadAccessRequirementCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Access Requirement definitions...");
sObjectMgr->LoadAccessRequirements();
@@ -332,7 +337,7 @@ public:
return true;
}
- static bool HandleReloadAchievementCriteriaDataCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadAchievementCriteriaDataCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Additional Achievement Criteria Data...");
sAchievementMgr->LoadAchievementCriteriaData();
@@ -340,7 +345,7 @@ public:
return true;
}
- static bool HandleReloadAchievementRewardCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadAchievementRewardCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Achievement Reward Data...");
sAchievementMgr->LoadRewards();
@@ -348,7 +353,7 @@ public:
return true;
}
- static bool HandleReloadAreaTriggerTavernCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadAreaTriggerTavernCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Tavern Area Triggers...");
sObjectMgr->LoadTavernAreaTriggers();
@@ -356,7 +361,7 @@ public:
return true;
}
- static bool HandleReloadAreaTriggerTeleportCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadAreaTriggerTeleportCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading AreaTrigger teleport definitions...");
sObjectMgr->LoadAreaTriggerTeleports();
@@ -364,7 +369,7 @@ public:
return true;
}
- static bool HandleReloadAutobroadcastCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadAutobroadcastCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Autobroadcasts...");
sWorld->LoadAutobroadcasts();
@@ -380,7 +385,7 @@ public:
return true;
}
- static bool HandleReloadBroadcastTextCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadBroadcastTextCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Broadcast texts...");
sObjectMgr->LoadBroadcastTexts();
@@ -389,14 +394,14 @@ public:
return true;
}
- static bool HandleReloadCommandCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadCommandCommand(ChatHandler* handler, char const* /*args*/)
{
ChatHandler::invalidateCommandTable();
handler->SendGlobalGMSysMessage("DB table `command` will be reloaded at next chat command use.");
return true;
}
- static bool HandleReloadOnKillReputationCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadOnKillReputationCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading creature award reputation definitions...");
sObjectMgr->LoadReputationOnKill();
@@ -404,7 +409,7 @@ public:
return true;
}
- static bool HandleReloadCreatureSummonGroupsCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadCreatureSummonGroupsCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Reloading creature summon groups...");
sObjectMgr->LoadTempSummons();
@@ -412,7 +417,7 @@ public:
return true;
}
- static bool HandleReloadCreatureTemplateCommand(ChatHandler* handler, const char* args)
+ static bool HandleReloadCreatureTemplateCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -452,7 +457,7 @@ public:
return true;
}
- static bool HandleReloadCreatureQuestStarterCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadCreatureQuestStarterCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Loading Quests Relations... (`creature_queststarter`)");
sObjectMgr->LoadCreatureQuestStarters();
@@ -460,7 +465,7 @@ public:
return true;
}
- static bool HandleReloadLinkedRespawnCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadLinkedRespawnCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Loading Linked Respawns... (`creature_linked_respawn`)");
sObjectMgr->LoadLinkedRespawn();
@@ -468,7 +473,7 @@ public:
return true;
}
- static bool HandleReloadCreatureQuestEnderCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadCreatureQuestEnderCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Loading Quests Relations... (`creature_questender`)");
sObjectMgr->LoadCreatureQuestEnders();
@@ -476,7 +481,7 @@ public:
return true;
}
- static bool HandleReloadGossipMenuCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadGossipMenuCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading `gossip_menu` Table!");
sObjectMgr->LoadGossipMenu();
@@ -485,7 +490,7 @@ public:
return true;
}
- static bool HandleReloadGossipMenuOptionCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadGossipMenuOptionCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading `gossip_menu_option` Table!");
sObjectMgr->LoadGossipMenuItems();
@@ -494,7 +499,7 @@ public:
return true;
}
- static bool HandleReloadGOQuestStarterCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadGOQuestStarterCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Loading Quests Relations... (`gameobject_queststarter`)");
sObjectMgr->LoadGameobjectQuestStarters();
@@ -502,7 +507,7 @@ public:
return true;
}
- static bool HandleReloadGOQuestEnderCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadGOQuestEnderCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Loading Quests Relations... (`gameobject_questender`)");
sObjectMgr->LoadGameobjectQuestEnders();
@@ -510,7 +515,7 @@ public:
return true;
}
- static bool HandleReloadQuestAreaTriggersCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadQuestAreaTriggersCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Quest Area Triggers...");
sObjectMgr->LoadQuestAreaTriggers();
@@ -518,7 +523,7 @@ public:
return true;
}
- static bool HandleReloadQuestTemplateCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadQuestTemplateCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Quest Templates...");
sObjectMgr->LoadQuests();
@@ -532,7 +537,7 @@ public:
return true;
}
- static bool HandleReloadLootTemplatesCreatureCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadLootTemplatesCreatureCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Loot Tables... (`creature_loot_template`)");
LoadLootTemplates_Creature();
@@ -542,7 +547,7 @@ public:
return true;
}
- static bool HandleReloadLootTemplatesDisenchantCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadLootTemplatesDisenchantCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Loot Tables... (`disenchant_loot_template`)");
LoadLootTemplates_Disenchant();
@@ -552,7 +557,7 @@ public:
return true;
}
- static bool HandleReloadLootTemplatesFishingCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadLootTemplatesFishingCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Loot Tables... (`fishing_loot_template`)");
LoadLootTemplates_Fishing();
@@ -562,7 +567,7 @@ public:
return true;
}
- static bool HandleReloadLootTemplatesGameobjectCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadLootTemplatesGameobjectCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Loot Tables... (`gameobject_loot_template`)");
LoadLootTemplates_Gameobject();
@@ -572,7 +577,7 @@ public:
return true;
}
- static bool HandleReloadLootTemplatesItemCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadLootTemplatesItemCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Loot Tables... (`item_loot_template`)");
LoadLootTemplates_Item();
@@ -582,7 +587,7 @@ public:
return true;
}
- static bool HandleReloadLootTemplatesMillingCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadLootTemplatesMillingCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Loot Tables... (`milling_loot_template`)");
LoadLootTemplates_Milling();
@@ -592,7 +597,7 @@ public:
return true;
}
- static bool HandleReloadLootTemplatesPickpocketingCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadLootTemplatesPickpocketingCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Loot Tables... (`pickpocketing_loot_template`)");
LoadLootTemplates_Pickpocketing();
@@ -602,7 +607,7 @@ public:
return true;
}
- static bool HandleReloadLootTemplatesProspectingCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadLootTemplatesProspectingCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Loot Tables... (`prospecting_loot_template`)");
LoadLootTemplates_Prospecting();
@@ -612,7 +617,7 @@ public:
return true;
}
- static bool HandleReloadLootTemplatesMailCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadLootTemplatesMailCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Loot Tables... (`mail_loot_template`)");
LoadLootTemplates_Mail();
@@ -622,7 +627,7 @@ public:
return true;
}
- static bool HandleReloadLootTemplatesReferenceCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadLootTemplatesReferenceCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Loot Tables... (`reference_loot_template`)");
LoadLootTemplates_Reference();
@@ -631,7 +636,7 @@ public:
return true;
}
- static bool HandleReloadLootTemplatesSkinningCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadLootTemplatesSkinningCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Loot Tables... (`skinning_loot_template`)");
LoadLootTemplates_Skinning();
@@ -641,7 +646,7 @@ public:
return true;
}
- static bool HandleReloadLootTemplatesSpellCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadLootTemplatesSpellCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Loot Tables... (`spell_loot_template`)");
LoadLootTemplates_Spell();
@@ -651,7 +656,7 @@ public:
return true;
}
- static bool HandleReloadTrinityStringCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadTrinityStringCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading trinity_string Table!");
sObjectMgr->LoadTrinityStrings();
@@ -659,7 +664,7 @@ public:
return true;
}
- static bool HandleReloadWardenactionCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadWardenactionCommand(ChatHandler* handler, char const* /*args*/)
{
if (!sWorld->getBoolConfig(CONFIG_WARDEN_ENABLED))
{
@@ -674,7 +679,7 @@ public:
return true;
}
- static bool HandleReloadNpcTrainerCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadNpcTrainerCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading `npc_trainer` Table!");
sObjectMgr->LoadTrainerSpell();
@@ -682,7 +687,7 @@ public:
return true;
}
- static bool HandleReloadNpcVendorCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadNpcVendorCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading `npc_vendor` Table!");
sObjectMgr->LoadVendors();
@@ -690,7 +695,7 @@ public:
return true;
}
- static bool HandleReloadPointsOfInterestCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadPointsOfInterestCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading `points_of_interest` Table!");
sObjectMgr->LoadPointsOfInterest();
@@ -698,7 +703,7 @@ public:
return true;
}
- static bool HandleReloadQuestPOICommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadQuestPOICommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Quest POI ..." );
sObjectMgr->LoadQuestPOI();
@@ -707,7 +712,7 @@ public:
return true;
}
- static bool HandleReloadSpellClickSpellsCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadSpellClickSpellsCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading `npc_spellclick_spells` Table!");
sObjectMgr->LoadNPCSpellClickSpells();
@@ -715,7 +720,7 @@ public:
return true;
}
- static bool HandleReloadReservedNameCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadReservedNameCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Loading ReservedNames... (`reserved_name`)");
sObjectMgr->LoadReservedPlayersNames();
@@ -723,7 +728,7 @@ public:
return true;
}
- static bool HandleReloadReputationRewardRateCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadReputationRewardRateCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading `reputation_reward_rate` Table!" );
sObjectMgr->LoadReputationRewardRate();
@@ -731,7 +736,7 @@ public:
return true;
}
- static bool HandleReloadReputationSpilloverTemplateCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadReputationSpilloverTemplateCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading `reputation_spillover_template` Table!" );
sObjectMgr->LoadReputationSpilloverTemplate();
@@ -739,7 +744,7 @@ public:
return true;
}
- static bool HandleReloadSkillDiscoveryTemplateCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadSkillDiscoveryTemplateCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Skill Discovery Table...");
LoadSkillDiscoveryTable();
@@ -747,7 +752,7 @@ public:
return true;
}
- static bool HandleReloadSkillPerfectItemTemplateCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadSkillPerfectItemTemplateCommand(ChatHandler* handler, char const* /*args*/)
{ // latched onto HandleReloadSkillExtraItemTemplateCommand as it's part of that table group (and i don't want to chance all the command IDs)
TC_LOG_INFO("misc", "Re-Loading Skill Perfection Data Table...");
LoadSkillPerfectItemTable();
@@ -755,7 +760,7 @@ public:
return true;
}
- static bool HandleReloadSkillExtraItemTemplateCommand(ChatHandler* handler, const char* args)
+ static bool HandleReloadSkillExtraItemTemplateCommand(ChatHandler* handler, char const* args)
{
TC_LOG_INFO("misc", "Re-Loading Skill Extra Item Table...");
LoadSkillExtraItemTable();
@@ -764,7 +769,7 @@ public:
return HandleReloadSkillPerfectItemTemplateCommand(handler, args);
}
- static bool HandleReloadSkillFishingBaseLevelCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadSkillFishingBaseLevelCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Skill Fishing base level requirements...");
sObjectMgr->LoadFishingBaseSkillLevel();
@@ -772,7 +777,7 @@ public:
return true;
}
- static bool HandleReloadSpellAreaCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadSpellAreaCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading SpellArea Data...");
sSpellMgr->LoadSpellAreas();
@@ -780,7 +785,7 @@ public:
return true;
}
- static bool HandleReloadSpellRequiredCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadSpellRequiredCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Spell Required Data... ");
sSpellMgr->LoadSpellRequired();
@@ -788,7 +793,7 @@ public:
return true;
}
- static bool HandleReloadSpellGroupsCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadSpellGroupsCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Spell Groups...");
sSpellMgr->LoadSpellGroups();
@@ -796,7 +801,7 @@ public:
return true;
}
- static bool HandleReloadSpellLearnSpellCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadSpellLearnSpellCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Spell Learn Spells...");
sSpellMgr->LoadSpellLearnSpells();
@@ -804,7 +809,7 @@ public:
return true;
}
- static bool HandleReloadSpellLinkedSpellCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadSpellLinkedSpellCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Spell Linked Spells...");
sSpellMgr->LoadSpellLinked();
@@ -812,7 +817,7 @@ public:
return true;
}
- static bool HandleReloadSpellProcsCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadSpellProcsCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Spell Proc conditions and data...");
sSpellMgr->LoadSpellProcs();
@@ -820,7 +825,7 @@ public:
return true;
}
- static bool HandleReloadSpellBonusesCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadSpellBonusesCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Spell Bonus Data...");
sSpellMgr->LoadSpellBonusess();
@@ -828,7 +833,7 @@ public:
return true;
}
- static bool HandleReloadSpellTargetPositionCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadSpellTargetPositionCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Spell target coordinates...");
sSpellMgr->LoadSpellTargetPositions();
@@ -836,7 +841,7 @@ public:
return true;
}
- static bool HandleReloadSpellThreatsCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadSpellThreatsCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Aggro Spells Definitions...");
sSpellMgr->LoadSpellThreats();
@@ -844,7 +849,7 @@ public:
return true;
}
- static bool HandleReloadSpellGroupStackRulesCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadSpellGroupStackRulesCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Spell Group Stack Rules...");
sSpellMgr->LoadSpellGroupStackRules();
@@ -852,7 +857,7 @@ public:
return true;
}
- static bool HandleReloadSpellPetAurasCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadSpellPetAurasCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Spell pet auras...");
sSpellMgr->LoadSpellPetAuras();
@@ -860,7 +865,7 @@ public:
return true;
}
- static bool HandleReloadPageTextsCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadPageTextsCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Page Text...");
sObjectMgr->LoadPageTexts();
@@ -868,7 +873,7 @@ public:
return true;
}
- static bool HandleReloadItemEnchantementsCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadItemEnchantementsCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Item Random Enchantments Table...");
LoadRandomEnchantmentsTable();
@@ -876,7 +881,7 @@ public:
return true;
}
- static bool HandleReloadItemSetNamesCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadItemSetNamesCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Item set names...");
sObjectMgr->LoadItemSetNames();
@@ -884,7 +889,7 @@ public:
return true;
}
- static bool HandleReloadEventScriptsCommand(ChatHandler* handler, const char* args)
+ static bool HandleReloadEventScriptsCommand(ChatHandler* handler, char const* args)
{
if (sMapMgr->IsScriptScheduled())
{
@@ -904,7 +909,7 @@ public:
return true;
}
- static bool HandleReloadWpScriptsCommand(ChatHandler* handler, const char* args)
+ static bool HandleReloadWpScriptsCommand(ChatHandler* handler, char const* args)
{
if (sMapMgr->IsScriptScheduled())
{
@@ -924,7 +929,7 @@ public:
return true;
}
- static bool HandleReloadWpCommand(ChatHandler* handler, const char* args)
+ static bool HandleReloadWpCommand(ChatHandler* handler, char const* args)
{
if (*args != 'a')
TC_LOG_INFO("misc", "Re-Loading Waypoints data from 'waypoints_data'");
@@ -937,7 +942,7 @@ public:
return true;
}
- static bool HandleReloadSpellScriptsCommand(ChatHandler* handler, const char* args)
+ static bool HandleReloadSpellScriptsCommand(ChatHandler* handler, char const* args)
{
if (sMapMgr->IsScriptScheduled())
{
@@ -957,7 +962,7 @@ public:
return true;
}
- static bool HandleReloadGameGraveyardZoneCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadGameGraveyardZoneCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Graveyard-zone links...");
@@ -968,7 +973,7 @@ public:
return true;
}
- static bool HandleReloadGameTeleCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadGameTeleCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Game Tele coordinates...");
@@ -979,7 +984,7 @@ public:
return true;
}
- static bool HandleReloadDisablesCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadDisablesCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading disables table...");
DisableMgr::LoadDisables();
@@ -989,7 +994,7 @@ public:
return true;
}
- static bool HandleReloadLocalesAchievementRewardCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadLocalesAchievementRewardCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Achievement Reward Data Locale...");
sAchievementMgr->LoadRewardLocales();
@@ -997,7 +1002,7 @@ public:
return true;
}
- static bool HandleReloadLfgRewardsCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadLfgRewardsCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading lfg dungeon rewards...");
sLFGMgr->LoadRewards();
@@ -1005,7 +1010,7 @@ public:
return true;
}
- static bool HandleReloadLocalesCreatureCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadLocalesCreatureCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Creature Template Locale...");
sObjectMgr->LoadCreatureLocales();
@@ -1013,7 +1018,7 @@ public:
return true;
}
- static bool HandleReloadLocalesCreatureTextCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadLocalesCreatureTextCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Creature Texts Locale...");
sCreatureTextMgr->LoadCreatureTextLocales();
@@ -1021,7 +1026,7 @@ public:
return true;
}
- static bool HandleReloadLocalesGameobjectCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadLocalesGameobjectCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Gameobject Template Locale... ");
sObjectMgr->LoadGameObjectLocales();
@@ -1029,7 +1034,7 @@ public:
return true;
}
- static bool HandleReloadLocalesGossipMenuOptionCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadLocalesGossipMenuOptionCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Gossip Menu Option Locale... ");
sObjectMgr->LoadGossipMenuItemsLocales();
@@ -1037,7 +1042,7 @@ public:
return true;
}
- static bool HandleReloadLocalesItemCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadLocalesItemCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Item Template Locale... ");
sObjectMgr->LoadItemLocales();
@@ -1045,7 +1050,7 @@ public:
return true;
}
- static bool HandleReloadLocalesItemSetNameCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadLocalesItemSetNameCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Item set name Locale... ");
sObjectMgr->LoadItemSetNameLocales();
@@ -1053,7 +1058,7 @@ public:
return true;
}
- static bool HandleReloadLocalesNpcTextCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadLocalesNpcTextCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading NPC Text Locale... ");
sObjectMgr->LoadNpcTextLocales();
@@ -1061,7 +1066,7 @@ public:
return true;
}
- static bool HandleReloadLocalesPageTextCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadLocalesPageTextCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Page Text Locale... ");
sObjectMgr->LoadPageTextLocales();
@@ -1069,7 +1074,7 @@ public:
return true;
}
- static bool HandleReloadLocalesPointsOfInterestCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadLocalesPointsOfInterestCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Points Of Interest Locale... ");
sObjectMgr->LoadPointOfInterestLocales();
@@ -1077,7 +1082,7 @@ public:
return true;
}
- static bool HandleReloadLocalesQuestCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadLocalesQuestCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Quest Template Locale... ");
sObjectMgr->LoadQuestLocales();
@@ -1085,7 +1090,7 @@ public:
return true;
}
- static bool HandleReloadMailLevelRewardCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadMailLevelRewardCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Player level dependent mail rewards...");
sObjectMgr->LoadMailLevelRewards();
@@ -1093,7 +1098,7 @@ public:
return true;
}
- static bool HandleReloadAuctionsCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadAuctionsCommand(ChatHandler* handler, char const* /*args*/)
{
///- Reload dynamic data tables from the database
TC_LOG_INFO("misc", "Re-Loading Auctions...");
@@ -1103,7 +1108,7 @@ public:
return true;
}
- static bool HandleReloadConditions(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadConditions(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Conditions...");
sConditionMgr->LoadConditions(true);
@@ -1111,7 +1116,7 @@ public:
return true;
}
- static bool HandleReloadCreatureText(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadCreatureText(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Creature Texts...");
sCreatureTextMgr->LoadCreatureTexts();
@@ -1119,7 +1124,7 @@ public:
return true;
}
- static bool HandleReloadSmartScripts(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadSmartScripts(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Smart Scripts...");
sSmartScriptMgr->LoadSmartAIFromDB();
@@ -1127,7 +1132,7 @@ public:
return true;
}
- static bool HandleReloadVehicleAccessoryCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadVehicleAccessoryCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Reloading vehicle_accessory table...");
sObjectMgr->LoadVehicleAccessories();
@@ -1135,7 +1140,7 @@ public:
return true;
}
- static bool HandleReloadVehicleTemplateAccessoryCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadVehicleTemplateAccessoryCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Reloading vehicle_template_accessory table...");
sObjectMgr->LoadVehicleTemplateAccessories();
@@ -1143,7 +1148,7 @@ public:
return true;
}
- static bool HandleReloadRBACCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleReloadRBACCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Reloading RBAC tables...");
sAccountMgr->LoadRBAC();
diff --git a/src/server/scripts/Commands/cs_reset.cpp b/src/server/scripts/Commands/cs_reset.cpp
index 40399e8f309..fd6694c1099 100644
--- a/src/server/scripts/Commands/cs_reset.cpp
+++ b/src/server/scripts/Commands/cs_reset.cpp
@@ -22,13 +22,20 @@ Comment: All reset related commands
Category: commandscripts
EndScriptData */
+#include "ScriptMgr.h"
#include "AchievementMgr.h"
#include "Chat.h"
+#include "DatabaseEnv.h"
#include "Language.h"
+#include "Log.h"
#include "ObjectAccessor.h"
-#include "Player.h"
#include "Pet.h"
-#include "ScriptMgr.h"
+#include "Player.h"
+#include "RBAC.h"
+#include "World.h"
+#include "WorldSession.h"
+#include <boost/thread/locks.hpp>
+#include <boost/thread/shared_mutex.hpp>
class reset_commandscript : public CommandScript
{
@@ -49,7 +56,7 @@ public:
};
static std::vector<ChatCommand> commandTable =
{
- { "reset", rbac::RBAC_PERM_COMMAND_RESET, true, NULL, "", resetCommandTable },
+ { "reset", rbac::RBAC_PERM_COMMAND_RESET, true, nullptr, "", resetCommandTable },
};
return commandTable;
}
diff --git a/src/server/scripts/Commands/cs_send.cpp b/src/server/scripts/Commands/cs_send.cpp
index 0289b713c6f..2e2fb383a07 100644
--- a/src/server/scripts/Commands/cs_send.cpp
+++ b/src/server/scripts/Commands/cs_send.cpp
@@ -15,12 +15,17 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "ScriptMgr.h"
#include "Chat.h"
+#include "DatabaseEnv.h"
+#include "Item.h"
#include "Language.h"
+#include "Mail.h"
+#include "ObjectMgr.h"
#include "Pet.h"
#include "Player.h"
-#include "ObjectMgr.h"
-#include "ScriptMgr.h"
+#include "RBAC.h"
+#include "WorldSession.h"
class send_commandscript : public CommandScript
{
@@ -39,7 +44,7 @@ public:
static std::vector<ChatCommand> commandTable =
{
- { "send", rbac::RBAC_PERM_COMMAND_SEND, false, NULL, "", sendCommandTable },
+ { "send", rbac::RBAC_PERM_COMMAND_SEND, false, nullptr, "", sendCommandTable },
};
return commandTable;
}
@@ -54,7 +59,7 @@ public:
if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
return false;
- char* tail1 = strtok(NULL, "");
+ char* tail1 = strtok(nullptr, "");
if (!tail1)
return false;
@@ -62,7 +67,7 @@ public:
if (!msgSubject)
return false;
- char* tail2 = strtok(NULL, "");
+ char* tail2 = strtok(nullptr, "");
if (!tail2)
return false;
@@ -99,7 +104,7 @@ public:
if (!handler->extractPlayerTarget((char*)args, &receiver, &receiverGuid, &receiverName))
return false;
- char* tail1 = strtok(NULL, "");
+ char* tail1 = strtok(nullptr, "");
if (!tail1)
return false;
@@ -107,7 +112,7 @@ public:
if (!msgSubject)
return false;
- char* tail2 = strtok(NULL, "");
+ char* tail2 = strtok(nullptr, "");
if (!tail2)
return false;
@@ -125,17 +130,17 @@ public:
ItemPairs items;
// get all tail string
- char* tail = strtok(NULL, "");
+ char* tail = strtok(nullptr, "");
// get from tail next item str
while (char* itemStr = strtok(tail, " "))
{
// and get new tail
- tail = strtok(NULL, "");
+ tail = strtok(nullptr, "");
// parse item str
char const* itemIdStr = strtok(itemStr, ":");
- char const* itemCountStr = strtok(NULL, " ");
+ char const* itemCountStr = strtok(nullptr, " ");
uint32 itemId = atoi(itemIdStr);
if (!itemId)
@@ -208,7 +213,7 @@ public:
if (!handler->extractPlayerTarget((char*)args, &receiver, &receiverGuid, &receiverName))
return false;
- char* tail1 = strtok(NULL, "");
+ char* tail1 = strtok(nullptr, "");
if (!tail1)
return false;
@@ -216,7 +221,7 @@ public:
if (!msgSubject)
return false;
- char* tail2 = strtok(NULL, "");
+ char* tail2 = strtok(nullptr, "");
if (!tail2)
return false;
@@ -224,7 +229,7 @@ public:
if (!msgText)
return false;
- char* moneyStr = strtok(NULL, "");
+ char* moneyStr = strtok(nullptr, "");
int32 money = moneyStr ? atoi(moneyStr) : 0;
if (money <= 0)
return false;
@@ -256,7 +261,7 @@ public:
if (!handler->extractPlayerTarget((char*)args, &player))
return false;
- char* msgStr = strtok(NULL, "");
+ char* msgStr = strtok(nullptr, "");
if (!msgStr)
return false;
diff --git a/src/server/scripts/Commands/cs_server.cpp b/src/server/scripts/Commands/cs_server.cpp
index 620c70599e5..9be78607c62 100644
--- a/src/server/scripts/Commands/cs_server.cpp
+++ b/src/server/scripts/Commands/cs_server.cpp
@@ -22,17 +22,21 @@ Comment: All server related commands
Category: commandscripts
EndScriptData */
+#include "ScriptMgr.h"
#include "Chat.h"
#include "Config.h"
+#include "GameTime.h"
+#include "GitRevision.h"
#include "Language.h"
+#include "Log.h"
#include "ObjectAccessor.h"
#include "Player.h"
-#include "ScriptMgr.h"
-#include "GitRevision.h"
-#include "Util.h"
+#include "RBAC.h"
#include "ServerMotd.h"
-#include "GameTime.h"
#include "UpdateTime.h"
+#include "Util.h"
+#include "World.h"
+#include "WorldSession.h"
class server_commandscript : public CommandScript
{
diff --git a/src/server/scripts/Commands/cs_tele.cpp b/src/server/scripts/Commands/cs_tele.cpp
index b880b1130c1..7a5d7e61fcf 100644
--- a/src/server/scripts/Commands/cs_tele.cpp
+++ b/src/server/scripts/Commands/cs_tele.cpp
@@ -22,13 +22,18 @@ Comment: All tele related commands
Category: commandscripts
EndScriptData */
+#include "ScriptMgr.h"
#include "Chat.h"
+#include "DatabaseEnv.h"
+#include "DBCStores.h"
#include "Group.h"
#include "Language.h"
#include "MapManager.h"
+#include "MotionMaster.h"
#include "ObjectMgr.h"
#include "Player.h"
-#include "ScriptMgr.h"
+#include "RBAC.h"
+#include "WorldSession.h"
class tele_commandscript : public CommandScript
{
@@ -47,12 +52,12 @@ public:
};
static std::vector<ChatCommand> commandTable =
{
- { "tele", rbac::RBAC_PERM_COMMAND_TELE, false, NULL, "", teleCommandTable },
+ { "tele", rbac::RBAC_PERM_COMMAND_TELE, false, nullptr, "", teleCommandTable },
};
return commandTable;
}
- static bool HandleTeleAddCommand(ChatHandler* handler, const char* args)
+ static bool HandleTeleAddCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -92,7 +97,7 @@ public:
return true;
}
- static bool HandleTeleDelCommand(ChatHandler* handler, const char* args)
+ static bool HandleTeleDelCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -112,7 +117,7 @@ public:
}
// teleport player to given game_tele.entry
- static bool HandleTeleNameCommand(ChatHandler* handler, const char* args)
+ static bool HandleTeleNameCommand(ChatHandler* handler, char const* args)
{
char* nameStr;
char* teleStr;
@@ -193,7 +198,7 @@ public:
else
{
// check offline security
- if (handler->HasLowerSecurity(NULL, target_guid))
+ if (handler->HasLowerSecurity(nullptr, target_guid))
return false;
std::string nameLink = handler->playerLink(target_name);
@@ -209,7 +214,7 @@ public:
}
//Teleport group to given game_tele.entry
- static bool HandleTeleGroupCommand(ChatHandler* handler, const char* args)
+ static bool HandleTeleGroupCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -253,7 +258,7 @@ public:
return false;
}
- for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
+ for (GroupReference* itr = grp->GetFirstMember(); itr != nullptr; itr = itr->next())
{
Player* player = itr->GetSource();
@@ -292,7 +297,7 @@ public:
return true;
}
- static bool HandleTeleCommand(ChatHandler* handler, const char* args)
+ static bool HandleTeleCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
diff --git a/src/server/scripts/Commands/cs_ticket.cpp b/src/server/scripts/Commands/cs_ticket.cpp
index a8ed1d20a0b..31d0897493d 100644
--- a/src/server/scripts/Commands/cs_ticket.cpp
+++ b/src/server/scripts/Commands/cs_ticket.cpp
@@ -22,15 +22,19 @@ Comment: All ticket related commands
Category: commandscripts
EndScriptData */
+#include "ScriptMgr.h"
#include "AccountMgr.h"
#include "CharacterCache.h"
#include "Chat.h"
#include "Language.h"
+#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Opcodes.h"
#include "Player.h"
+#include "Realm.h"
#include "TicketMgr.h"
-#include "ScriptMgr.h"
+#include "World.h"
+#include "WorldSession.h"
class ticket_commandscript : public CommandScript
{
@@ -57,7 +61,7 @@ public:
{ "list", rbac::RBAC_PERM_COMMAND_TICKET_LIST, true, &HandleGMTicketListCommand, "" },
{ "onlinelist", rbac::RBAC_PERM_COMMAND_TICKET_ONLINELIST, true, &HandleGMTicketListOnlineCommand, "" },
{ "reset", rbac::RBAC_PERM_COMMAND_TICKET_RESET, true, &HandleGMTicketResetCommand, "" },
- { "response", rbac::RBAC_PERM_COMMAND_TICKET_RESPONSE, true, NULL, "", ticketResponseCommandTable },
+ { "response", rbac::RBAC_PERM_COMMAND_TICKET_RESPONSE, true, nullptr, "", ticketResponseCommandTable },
{ "togglesystem", rbac::RBAC_PERM_COMMAND_TICKET_TOGGLESYSTEM, true, &HandleToggleGMTicketSystem, "" },
{ "unassign", rbac::RBAC_PERM_COMMAND_TICKET_UNASSIGN, true, &HandleGMTicketUnAssignCommand, "" },
{ "viewid", rbac::RBAC_PERM_COMMAND_TICKET_VIEWID, true, &HandleGMTicketGetByIdCommand, "" },
@@ -65,7 +69,7 @@ public:
};
static std::vector<ChatCommand> commandTable =
{
- { "ticket", rbac::RBAC_PERM_COMMAND_TICKET, false, NULL, "", ticketCommandTable },
+ { "ticket", rbac::RBAC_PERM_COMMAND_TICKET, false, nullptr, "", ticketCommandTable },
};
return commandTable;
}
@@ -78,7 +82,7 @@ public:
char* ticketIdStr = strtok((char*)args, " ");
uint32 ticketId = atoi(ticketIdStr);
- char* targetStr = strtok(NULL, " ");
+ char* targetStr = strtok(nullptr, " ");
if (!targetStr)
return false;
@@ -119,12 +123,12 @@ public:
}
// Assign ticket
- SQLTransaction trans = SQLTransaction(NULL);
+ SQLTransaction trans = SQLTransaction(nullptr);
ticket->SetAssignedTo(targetGuid, AccountMgr::IsAdminAccount(AccountMgr::GetSecurity(accountId, realm.Id.Realm)));
ticket->SaveToDB(trans);
sTicketMgr->UpdateLastChange();
- std::string msg = ticket->FormatMessageString(*handler, NULL, target.c_str(), NULL, NULL, NULL);
+ std::string msg = ticket->FormatMessageString(*handler, nullptr, target.c_str(), nullptr, nullptr, nullptr);
handler->SendGlobalGMSysMessage(msg.c_str());
return true;
}
@@ -154,7 +158,7 @@ public:
sTicketMgr->ResolveAndCloseTicket(ticket->GetId(), player ? player->GetGUID() : ObjectGuid(uint64(0)));
sTicketMgr->UpdateLastChange();
- std::string msg = ticket->FormatMessageString(*handler, player ? player->GetName().c_str() : "Console", NULL, NULL, NULL, NULL);
+ std::string msg = ticket->FormatMessageString(*handler, player ? player->GetName().c_str() : "Console", nullptr, nullptr, nullptr, nullptr);
handler->SendGlobalGMSysMessage(msg.c_str());
// Inform player, who submitted this ticket, that it is closed
@@ -162,7 +166,7 @@ public:
{
WorldPacket data(SMSG_GMTICKET_DELETETICKET, 4);
data << uint32(GMTICKET_RESPONSE_TICKET_DELETED);
- submitter->GetSession()->SendPacket(&data);
+ submitter->SendDirectMessage(&data);
}
return true;
}
@@ -175,7 +179,7 @@ public:
char* ticketIdStr = strtok((char*)args, " ");
uint32 ticketId = atoi(ticketIdStr);
- char* comment = strtok(NULL, "\n");
+ char* comment = strtok(nullptr, "\n");
if (!comment)
return false;
@@ -195,7 +199,7 @@ public:
return true;
}
- SQLTransaction trans = SQLTransaction(NULL);
+ SQLTransaction trans = SQLTransaction(nullptr);
ticket->SetComment(comment);
ticket->SaveToDB(trans);
sTicketMgr->UpdateLastChange();
@@ -233,7 +237,7 @@ public:
return true;
}
- char* response = strtok(NULL, "\n");
+ char* response = strtok(nullptr, "\n");
if (response)
{
// Cannot add response to ticket, assigned to someone else
@@ -253,13 +257,13 @@ public:
Player* gm = handler->GetSession() ? handler->GetSession()->GetPlayer() : nullptr;
- SQLTransaction trans = SQLTransaction(NULL);
+ SQLTransaction trans = SQLTransaction(nullptr);
ticket->SetResolvedBy(gm ? gm->GetGUID() : ObjectGuid(uint64(0)));
ticket->SetCompleted();
ticket->SaveToDB(trans);
- std::string msg = ticket->FormatMessageString(*handler, NULL, NULL,
- NULL, NULL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetName().c_str() : "Console");
+ std::string msg = ticket->FormatMessageString(*handler, nullptr, nullptr,
+ nullptr, nullptr, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetName().c_str() : "Console");
handler->SendGlobalGMSysMessage(msg.c_str());
sTicketMgr->UpdateLastChange();
return true;
@@ -284,7 +288,7 @@ public:
return true;
}
- std::string msg = ticket->FormatMessageString(*handler, NULL, NULL, NULL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetName().c_str() : "Console", NULL);
+ std::string msg = ticket->FormatMessageString(*handler, nullptr, nullptr, nullptr, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetName().c_str() : "Console", nullptr);
handler->SendGlobalGMSysMessage(msg.c_str());
sTicketMgr->RemoveTicket(ticket->GetId());
@@ -295,7 +299,7 @@ public:
// Force abandon ticket
WorldPacket data(SMSG_GMTICKET_DELETETICKET, 4);
data << uint32(GMTICKET_RESPONSE_TICKET_DELETED);
- player->GetSession()->SendPacket(&data);
+ player->SendDirectMessage(&data);
}
return true;
@@ -406,13 +410,13 @@ public:
}
std::string assignedTo = ticket->GetAssignedToName(); // copy assignedto name because we need it after the ticket has been unnassigned
- SQLTransaction trans = SQLTransaction(NULL);
+ SQLTransaction trans = SQLTransaction(nullptr);
ticket->SetUnassigned();
ticket->SaveToDB(trans);
sTicketMgr->UpdateLastChange();
- std::string msg = ticket->FormatMessageString(*handler, NULL, assignedTo.c_str(),
- handler->GetSession() ? handler->GetSession()->GetPlayer()->GetName().c_str() : "Console", NULL, NULL);
+ std::string msg = ticket->FormatMessageString(*handler, nullptr, assignedTo.c_str(),
+ handler->GetSession() ? handler->GetSession()->GetPlayer()->GetName().c_str() : "Console", nullptr, nullptr);
handler->SendGlobalGMSysMessage(msg.c_str());
return true;
@@ -431,7 +435,7 @@ public:
return true;
}
- SQLTransaction trans = SQLTransaction(NULL);
+ SQLTransaction trans = SQLTransaction(nullptr);
ticket->SetViewed();
ticket->SaveToDB(trans);
@@ -470,7 +474,7 @@ public:
return true;
}
- SQLTransaction trans = SQLTransaction(NULL);
+ SQLTransaction trans = SQLTransaction(nullptr);
ticket->SetViewed();
ticket->SaveToDB(trans);
@@ -486,7 +490,7 @@ public:
char* ticketIdStr = strtok((char*)args, " ");
uint32 ticketId = atoi(ticketIdStr);
- char* response = strtok(NULL, "\n");
+ char* response = strtok(nullptr, "\n");
if (!response)
return false;
@@ -506,7 +510,7 @@ public:
return true;
}
- SQLTransaction trans = SQLTransaction(NULL);
+ SQLTransaction trans = SQLTransaction(nullptr);
ticket->AppendResponse(response);
if (newLine)
ticket->AppendResponse("\n");
diff --git a/src/server/scripts/Commands/cs_titles.cpp b/src/server/scripts/Commands/cs_titles.cpp
index d5d6e6ce8db..0a074f6390f 100644
--- a/src/server/scripts/Commands/cs_titles.cpp
+++ b/src/server/scripts/Commands/cs_titles.cpp
@@ -22,11 +22,12 @@ Comment: All titles related commands
Category: commandscripts
EndScriptData */
+#include "ScriptMgr.h"
#include "Chat.h"
+#include "DBCStores.h"
#include "Language.h"
-#include "ObjectMgr.h"
#include "Player.h"
-#include "ScriptMgr.h"
+#include "RBAC.h"
class titles_commandscript : public CommandScript
{
@@ -44,11 +45,11 @@ public:
{ "add", rbac::RBAC_PERM_COMMAND_TITLES_ADD, false, &HandleTitlesAddCommand, "" },
{ "current", rbac::RBAC_PERM_COMMAND_TITLES_CURRENT, false, &HandleTitlesCurrentCommand, "" },
{ "remove", rbac::RBAC_PERM_COMMAND_TITLES_REMOVE, false, &HandleTitlesRemoveCommand, "" },
- { "set", rbac::RBAC_PERM_COMMAND_TITLES_SET, false, NULL, "", titlesSetCommandTable },
+ { "set", rbac::RBAC_PERM_COMMAND_TITLES_SET, false, nullptr, "", titlesSetCommandTable },
};
static std::vector<ChatCommand> commandTable =
{
- { "titles", rbac::RBAC_PERM_COMMAND_TITLES, false, NULL, "", titlesCommandTable },
+ { "titles", rbac::RBAC_PERM_COMMAND_TITLES, false, nullptr, "", titlesCommandTable },
};
return commandTable;
}
diff --git a/src/server/scripts/Commands/cs_wp.cpp b/src/server/scripts/Commands/cs_wp.cpp
index ffbc4da5d57..efd02314d0e 100644
--- a/src/server/scripts/Commands/cs_wp.cpp
+++ b/src/server/scripts/Commands/cs_wp.cpp
@@ -22,12 +22,17 @@ Comment: All wp related commands
Category: commandscripts
EndScriptData */
+#include "ScriptMgr.h"
#include "Chat.h"
+#include "Creature.h"
+#include "DatabaseEnv.h"
#include "Language.h"
-#include "ObjectMgr.h"
+#include "Map.h"
+#include "MotionMaster.h"
#include "Player.h"
-#include "ScriptMgr.h"
+#include "RBAC.h"
#include "WaypointManager.h"
+#include "WorldSession.h"
class wp_commandscript : public CommandScript
{
@@ -48,7 +53,7 @@ public:
};
static std::vector<ChatCommand> commandTable =
{
- { "wp", rbac::RBAC_PERM_COMMAND_WP, false, NULL, "", wpCommandTable },
+ { "wp", rbac::RBAC_PERM_COMMAND_WP, false, nullptr, "", wpCommandTable },
};
return commandTable;
}
@@ -73,10 +78,10 @@ public:
*
* @return true - command did succeed, false - something went wrong
*/
- static bool HandleWpAddCommand(ChatHandler* handler, const char* args)
+ static bool HandleWpAddCommand(ChatHandler* handler, char const* args)
{
// optional
- char* path_number = NULL;
+ char* path_number = nullptr;
uint32 pathid = 0;
if (*args)
@@ -136,13 +141,13 @@ public:
return true;
} // HandleWpAddCommand
- static bool HandleWpLoadCommand(ChatHandler* handler, const char* args)
+ static bool HandleWpLoadCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
// optional
- char* path_number = NULL;
+ char* path_number = nullptr;
if (*args)
path_number = strtok((char*)args, " ");
@@ -217,7 +222,7 @@ public:
return true;
}
- static bool HandleWpReloadCommand(ChatHandler* handler, const char* args)
+ static bool HandleWpReloadCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -232,11 +237,11 @@ public:
return true;
}
- static bool HandleWpUnLoadCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleWpUnLoadCommand(ChatHandler* handler, char const* /*args*/)
{
Creature* target = handler->getSelectedCreature();
- PreparedStatement* stmt = NULL;
+ PreparedStatement* stmt = nullptr;
if (!target)
{
@@ -274,20 +279,20 @@ public:
return true;
}
- static bool HandleWpEventCommand(ChatHandler* handler, const char* args)
+ static bool HandleWpEventCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
char* show_str = strtok((char*)args, " ");
std::string show = show_str;
- PreparedStatement* stmt = NULL;
+ PreparedStatement* stmt = nullptr;
// Check
if ((show != "add") && (show != "mod") && (show != "del") && (show != "listid"))
return false;
- char* arg_id = strtok(NULL, " ");
+ char* arg_id = strtok(nullptr, " ");
uint32 id = 0;
if (show == "add")
@@ -416,7 +421,7 @@ public:
return true;
}
- char* arg_2 = strtok(NULL, " ");
+ char* arg_2 = strtok(nullptr, " ");
if (!arg_2)
{
@@ -436,7 +441,7 @@ public:
char* arg_3;
std::string arg_str_2 = arg_2;
- arg_3 = strtok(NULL, " ");
+ arg_3 = strtok(nullptr, " ");
if (!arg_3)
{
@@ -531,7 +536,7 @@ public:
return true;
}
- static bool HandleWpModifyCommand(ChatHandler* handler, const char* args)
+ static bool HandleWpModifyCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -554,7 +559,7 @@ public:
}
// Next arg is: <PATHID> <WPNUM> <ARGUMENT>
- char* arg_str = NULL;
+ char* arg_str = nullptr;
// Did user provide a GUID
// or did the user select a creature?
@@ -562,7 +567,7 @@ public:
uint32 pathid = 0;
uint32 point = 0;
Creature* target = handler->getSelectedCreature();
- PreparedStatement* stmt = NULL;
+ PreparedStatement* stmt = nullptr;
// User did select a visual waypoint?
if (!target || target->GetEntry() != VISUAL_WAYPOINT)
@@ -613,10 +618,10 @@ public:
// We have the waypoint number and the GUID of the "master npc"
// Text is enclosed in "<>", all other arguments not
- arg_str = strtok((char*)NULL, " ");
+ arg_str = strtok((char*)nullptr, " ");
// Check for argument
- if (show != "del" && show != "move" && arg_str == NULL)
+ if (show != "del" && show != "move" && arg_str == nullptr)
{
handler->PSendSysMessage(LANG_WAYPOINT_ARGUMENTREQ, show_str);
return false;
@@ -705,7 +710,7 @@ public:
return true;
}
- static bool HandleWpShowCommand(ChatHandler* handler, const char* args)
+ static bool HandleWpShowCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -716,11 +721,11 @@ public:
return false;
// second arg: GUID (optional, if a creature is selected)
- char* guid_str = strtok((char*)NULL, " ");
+ char* guid_str = strtok((char*)nullptr, " ");
uint32 pathid = 0;
Creature* target = handler->getSelectedCreature();
- PreparedStatement* stmt = NULL;
+ PreparedStatement* stmt = nullptr;
// Did player provide a PathID?
diff --git a/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp b/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp
index 9b18098417f..cc0ff3fd650 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/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp
index 3b727fd1bc1..bcd4a915595 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 "GameObjectAI.h"
#include "blackrock_depths.h"
+#include "GameObject.h"
+#include "GameObjectAI.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
@@ -54,7 +58,7 @@ class go_shadowforge_brazier : public GameObjectScript
GameObjectAI* GetAI(GameObject* go) const override
{
- return GetInstanceAI<go_shadowforge_brazierAI>(go);
+ return GetBlackrockDepthsAI<go_shadowforge_brazierAI>(go);
}
};
@@ -93,7 +97,7 @@ class at_ring_of_law : public AreaTriggerScript
public:
at_ring_of_law() : AreaTriggerScript("at_ring_of_law") { }
- bool OnTrigger(Player* player, const AreaTriggerEntry* /*at*/) override
+ bool OnTrigger(Player* player, AreaTriggerEntry const* /*at*/) override
{
if (InstanceScript* instance = player->GetInstanceScript())
{
@@ -128,7 +132,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_grimstoneAI>(creature);
+ return GetBlackrockDepthsAI<npc_grimstoneAI>(creature);
}
struct npc_grimstoneAI : public npc_escortAI
@@ -224,7 +228,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;
@@ -365,7 +369,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_phalanxAI(creature);
+ return GetBlackrockDepthsAI<npc_phalanxAI>(creature);
}
struct npc_phalanxAI : public ScriptedAI
@@ -489,7 +493,7 @@ class npc_lokhtos_darkbargainer : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_lokhtos_darkbargainerAI(creature);
+ return GetBlackrockDepthsAI<npc_lokhtos_darkbargainerAI>(creature);
}
};
@@ -535,7 +539,7 @@ public:
void DoGo(uint32 id, uint32 state)
{
- if (GameObject* go = instance->instance->GetGameObject(instance->GetGuidData(id)))
+ if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(id)))
go->SetGoState((GOState)state);
}
@@ -622,7 +626,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_rocknotAI>(creature);
+ return GetBlackrockDepthsAI<npc_rocknotAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.h b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.h
index 9944300d7f1..5102c58b9b6 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.h
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.h
@@ -19,6 +19,9 @@
#ifndef DEF_BRD_H
#define DEF_BRD_H
+#include "CreatureAIImpl.h"
+
+#define BRDScriptName "instance_blackrock_depths"
#define DataHeader "BRD"
enum BRDFactionIds
@@ -64,4 +67,10 @@ enum BRDDataTypes
DATA_COREN = 28
};
+template <class AI, class T>
+inline AI* GetBlackrockDepthsAI(T* obj)
+{
+ return GetInstanceAI<AI>(obj, BRDScriptName);
+}
+
#endif
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_ambassador_flamelash.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_ambassador_flamelash.cpp
index 41beda843e4..83c3f7037c4 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_ambassador_flamelash.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_ambassador_flamelash.cpp
@@ -16,6 +16,7 @@
*/
#include "ScriptMgr.h"
+#include "blackrock_depths.h"
#include "ScriptedCreature.h"
enum Spells
@@ -89,7 +90,7 @@ class boss_ambassador_flamelash : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_ambassador_flamelashAI(creature);
+ return GetBlackrockDepthsAI<boss_ambassador_flamelashAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_coren_direbrew.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_coren_direbrew.cpp
index 37b7e892ae5..7d3d77f52b1 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_coren_direbrew.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_coren_direbrew.cpp
@@ -16,16 +16,20 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
#include "blackrock_depths.h"
+#include "GameObjectAI.h"
+#include "GridNotifiers.h"
+#include "Group.h"
+#include "InstanceScript.h"
+#include "LFGMgr.h"
+#include "Map.h"
+#include "ObjectAccessor.h"
#include "Player.h"
-#include "SpellScript.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "SpellAuras.h"
-#include "LFGMgr.h"
-#include "Group.h"
-#include "GridNotifiers.h"
-#include "GameObjectAI.h"
+#include "SpellScript.h"
+#include "TemporarySummon.h"
enum DirebrewSays
{
@@ -274,7 +278,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_coren_direbrewAI>(creature);
+ return GetBlackrockDepthsAI<boss_coren_direbrewAI>(creature);
}
};
@@ -338,7 +342,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_coren_direbrew_sistersAI>(creature);
+ return GetBlackrockDepthsAI<npc_coren_direbrew_sistersAI>(creature);
}
};
@@ -370,7 +374,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_direbrew_minionAI>(creature);
+ return GetBlackrockDepthsAI<npc_direbrew_minionAI>(creature);
}
};
@@ -412,7 +416,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_direbrew_antagonistAI>(creature);
+ return GetBlackrockDepthsAI<npc_direbrew_antagonistAI>(creature);
}
};
@@ -455,7 +459,7 @@ public:
GameObjectAI* GetAI(GameObject* go) const override
{
- return GetInstanceAI<go_direbrew_mole_machineAI>(go);
+ return GetBlackrockDepthsAI<go_direbrew_mole_machineAI>(go);
}
};
@@ -471,10 +475,7 @@ class spell_direbrew_disarm : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DIREBREW_DISARM)
- || !sSpellMgr->GetSpellInfo(SPELL_DIREBREW_DISARM_GROW))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DIREBREW_DISARM, SPELL_DIREBREW_DISARM_GROW });
}
void PeriodicTick(AuraEffect const* /*aurEff*/)
@@ -517,9 +518,7 @@ class spell_direbrew_summon_mole_machine_target_picker : public SpellScriptLoade
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_MOLE_MACHINE_MINION_SUMMONER))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_MOLE_MACHINE_MINION_SUMMONER });
}
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
@@ -603,9 +602,7 @@ class spell_request_second_mug : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SEND_SECOND_MUG))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SEND_SECOND_MUG });
}
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
@@ -637,9 +634,7 @@ class spell_send_mug_control_aura : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SEND_MUG_TARGET_PICKER))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SEND_MUG_TARGET_PICKER });
}
void PeriodicTick(AuraEffect const* /*aurEff*/)
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 b3b3a0f2b4c..0f518a8284a 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_general_angerforge.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_general_angerforge.cpp
index c17de75a6cf..b9883a1e9f0 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_general_angerforge.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_general_angerforge.cpp
@@ -16,6 +16,7 @@
*/
#include "ScriptMgr.h"
+#include "blackrock_depths.h"
#include "ScriptedCreature.h"
enum Spells
@@ -130,7 +131,7 @@ class boss_general_angerforge : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_general_angerforgeAI(creature);
+ return GetBlackrockDepthsAI<boss_general_angerforgeAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_high_interrogator_gerstahn.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_high_interrogator_gerstahn.cpp
index 691df9b587d..277af244871 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_high_interrogator_gerstahn.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_high_interrogator_gerstahn.cpp
@@ -16,6 +16,7 @@
*/
#include "ScriptMgr.h"
+#include "blackrock_depths.h"
#include "ScriptedCreature.h"
enum Spells
@@ -99,7 +100,7 @@ class boss_high_interrogator_gerstahn : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_high_interrogator_gerstahnAI(creature);
+ return GetBlackrockDepthsAI<boss_high_interrogator_gerstahnAI>(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..68441159eaa 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
{
@@ -105,7 +106,7 @@ class boss_magmus : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_magmusAI(creature);
+ return GetBlackrockDepthsAI<boss_magmusAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_moira_bronzebeard.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_moira_bronzebeard.cpp
index b1cc51e37a9..461322596cc 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_moira_bronzebeard.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_moira_bronzebeard.cpp
@@ -16,6 +16,7 @@
*/
#include "ScriptMgr.h"
+#include "blackrock_depths.h"
#include "ScriptedCreature.h"
enum Spells
@@ -93,7 +94,7 @@ class boss_moira_bronzebeard : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_moira_bronzebeardAI(creature);
+ return GetBlackrockDepthsAI<boss_moira_bronzebeardAI>(creature);
}
};
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 31dd2ffd487..787de8711f2 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
{
@@ -102,7 +103,7 @@ class boss_gloomrel : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_gloomrelAI>(creature);
+ return GetBlackrockDepthsAI<boss_gloomrelAI>(creature);
}
};
@@ -265,7 +266,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 1bc8d78b79a..1ac6dfd542c 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp
@@ -17,9 +17,14 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "InstanceScript.h"
#include "blackrock_depths.h"
+#include "Creature.h"
+#include "CreatureAI.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "Log.h"
+#include "Map.h"
+#include "MotionMaster.h"
#define TIMER_TOMBOFTHESEVEN 15000
#define MAX_ENCOUNTER 6
@@ -68,7 +73,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
{
@@ -130,22 +135,22 @@ public:
{
switch (creature->GetEntry())
{
- case NPC_EMPEROR: EmperorGUID = creature->GetGUID(); break;
- case NPC_PHALANX: PhalanxGUID = creature->GetGUID(); break;
- case NPC_MOIRA: MoiraGUID = creature->GetGUID(); break;
- case NPC_COREN: CorenGUID = creature->GetGUID(); break;
- case NPC_DOOMREL: TombBossGUIDs[0] = creature->GetGUID(); break;
- case NPC_DOPEREL: TombBossGUIDs[1] = creature->GetGUID(); break;
- case NPC_HATEREL: TombBossGUIDs[2] = creature->GetGUID(); break;
- case NPC_VILEREL: TombBossGUIDs[3] = creature->GetGUID(); break;
- case NPC_SEETHREL: TombBossGUIDs[4] = creature->GetGUID(); break;
- case NPC_GLOOMREL: TombBossGUIDs[5] = creature->GetGUID(); break;
- case NPC_ANGERREL: TombBossGUIDs[6] = creature->GetGUID(); break;
- case NPC_MAGMUS:
- MagmusGUID = creature->GetGUID();
- if (!creature->IsAlive())
- HandleGameObject(GetGuidData(DATA_THRONE_DOOR), true); // if Magmus is dead open door to last boss
- break;
+ case NPC_EMPEROR: EmperorGUID = creature->GetGUID(); break;
+ case NPC_PHALANX: PhalanxGUID = creature->GetGUID(); break;
+ case NPC_MOIRA: MoiraGUID = creature->GetGUID(); break;
+ case NPC_COREN: CorenGUID = creature->GetGUID(); break;
+ case NPC_DOOMREL: TombBossGUIDs[0] = creature->GetGUID(); break;
+ case NPC_DOPEREL: TombBossGUIDs[1] = creature->GetGUID(); break;
+ case NPC_HATEREL: TombBossGUIDs[2] = creature->GetGUID(); break;
+ case NPC_VILEREL: TombBossGUIDs[3] = creature->GetGUID(); break;
+ case NPC_SEETHREL: TombBossGUIDs[4] = creature->GetGUID(); break;
+ case NPC_GLOOMREL: TombBossGUIDs[5] = creature->GetGUID(); break;
+ case NPC_ANGERREL: TombBossGUIDs[6] = creature->GetGUID(); break;
+ case NPC_MAGMUS:
+ MagmusGUID = creature->GetGUID();
+ if (!creature->IsAlive())
+ HandleGameObject(GetGuidData(DATA_THRONE_DOOR), true); // if Magmus is dead open door to last boss
+ break;
}
}
@@ -153,33 +158,33 @@ public:
{
switch (go->GetEntry())
{
- case GO_ARENA1: GoArena1GUID = go->GetGUID(); break;
- case GO_ARENA2: GoArena2GUID = go->GetGUID(); break;
- case GO_ARENA3: GoArena3GUID = go->GetGUID(); break;
- case GO_ARENA4: GoArena4GUID = go->GetGUID(); break;
- case GO_SHADOW_LOCK: GoShadowLockGUID = go->GetGUID(); break;
- case GO_SHADOW_MECHANISM: GoShadowMechGUID = go->GetGUID(); break;
- case GO_SHADOW_GIANT_DOOR: GoShadowGiantGUID = go->GetGUID(); break;
- case GO_SHADOW_DUMMY: GoShadowDummyGUID = go->GetGUID(); break;
- case GO_BAR_KEG_SHOT: GoBarKegGUID = go->GetGUID(); break;
- case GO_BAR_KEG_TRAP: GoBarKegTrapGUID = go->GetGUID(); break;
- case GO_BAR_DOOR: GoBarDoorGUID = go->GetGUID(); break;
- case GO_TOMB_ENTER: GoTombEnterGUID = go->GetGUID(); break;
- case GO_TOMB_EXIT:
- GoTombExitGUID = go->GetGUID();
- if (GhostKillCount >= 7)
- HandleGameObject(ObjectGuid::Empty, true, go);
- else
- HandleGameObject(ObjectGuid::Empty, false, go);
- break;
- case GO_LYCEUM: GoLyceumGUID = go->GetGUID(); break;
- case GO_SF_S: GoSFSGUID = go->GetGUID(); break;
- case GO_SF_N: GoSFNGUID = go->GetGUID(); break;
- case GO_GOLEM_ROOM_N: GoGolemNGUID = go->GetGUID(); break;
- case GO_GOLEM_ROOM_S: GoGolemSGUID = go->GetGUID(); break;
- case GO_THRONE_ROOM: GoThroneGUID = go->GetGUID(); break;
- case GO_CHEST_SEVEN: GoChestGUID = go->GetGUID(); break;
- case GO_SPECTRAL_CHALICE: GoSpectralChaliceGUID = go->GetGUID(); break;
+ case GO_ARENA1: GoArena1GUID = go->GetGUID(); break;
+ case GO_ARENA2: GoArena2GUID = go->GetGUID(); break;
+ case GO_ARENA3: GoArena3GUID = go->GetGUID(); break;
+ case GO_ARENA4: GoArena4GUID = go->GetGUID(); break;
+ case GO_SHADOW_LOCK: GoShadowLockGUID = go->GetGUID(); break;
+ case GO_SHADOW_MECHANISM: GoShadowMechGUID = go->GetGUID(); break;
+ case GO_SHADOW_GIANT_DOOR: GoShadowGiantGUID = go->GetGUID(); break;
+ case GO_SHADOW_DUMMY: GoShadowDummyGUID = go->GetGUID(); break;
+ case GO_BAR_KEG_SHOT: GoBarKegGUID = go->GetGUID(); break;
+ case GO_BAR_KEG_TRAP: GoBarKegTrapGUID = go->GetGUID(); break;
+ case GO_BAR_DOOR: GoBarDoorGUID = go->GetGUID(); break;
+ case GO_TOMB_ENTER: GoTombEnterGUID = go->GetGUID(); break;
+ case GO_TOMB_EXIT:
+ GoTombExitGUID = go->GetGUID();
+ if (GhostKillCount >= 7)
+ HandleGameObject(ObjectGuid::Empty, true, go);
+ else
+ HandleGameObject(ObjectGuid::Empty, false, go);
+ break;
+ case GO_LYCEUM: GoLyceumGUID = go->GetGUID(); break;
+ case GO_SF_S: GoSFSGUID = go->GetGUID(); break;
+ case GO_SF_N: GoSFNGUID = go->GetGUID(); break;
+ case GO_GOLEM_ROOM_N: GoGolemNGUID = go->GetGUID(); break;
+ case GO_GOLEM_ROOM_S: GoGolemSGUID = go->GetGUID(); break;
+ case GO_THRONE_ROOM: GoThroneGUID = go->GetGUID(); break;
+ case GO_CHEST_SEVEN: GoChestGUID = go->GetGUID(); break;
+ case GO_SPECTRAL_CHALICE: GoSpectralChaliceGUID = go->GetGUID(); break;
}
}
@@ -205,30 +210,30 @@ public:
switch (type)
{
- case TYPE_RING_OF_LAW:
- encounter[0] = data;
- break;
- case TYPE_VAULT:
- encounter[1] = data;
- break;
- case TYPE_BAR:
- if (data == SPECIAL)
- ++BarAleCount;
- else
- encounter[2] = data;
- break;
- case TYPE_TOMB_OF_SEVEN:
- encounter[3] = data;
- break;
- case TYPE_LYCEUM:
- encounter[4] = data;
- break;
- case TYPE_IRON_HALL:
- encounter[5] = data;
- break;
- case DATA_GHOSTKILL:
- GhostKillCount += data;
- break;
+ case TYPE_RING_OF_LAW:
+ encounter[0] = data;
+ break;
+ case TYPE_VAULT:
+ encounter[1] = data;
+ break;
+ case TYPE_BAR:
+ if (data == SPECIAL)
+ ++BarAleCount;
+ else
+ encounter[2] = data;
+ break;
+ case TYPE_TOMB_OF_SEVEN:
+ encounter[3] = data;
+ break;
+ case TYPE_LYCEUM:
+ encounter[4] = data;
+ break;
+ case TYPE_IRON_HALL:
+ encounter[5] = data;
+ break;
+ case DATA_GHOSTKILL:
+ GhostKillCount += data;
+ break;
}
if (data == DONE || GhostKillCount >= 7)
@@ -250,23 +255,23 @@ public:
{
switch (type)
{
- case TYPE_RING_OF_LAW:
- return encounter[0];
- case TYPE_VAULT:
- return encounter[1];
- case TYPE_BAR:
- if (encounter[2] == IN_PROGRESS && BarAleCount == 3)
- return SPECIAL;
- else
- return encounter[2];
- case TYPE_TOMB_OF_SEVEN:
- return encounter[3];
- case TYPE_LYCEUM:
- return encounter[4];
- case TYPE_IRON_HALL:
- return encounter[5];
- case DATA_GHOSTKILL:
- return GhostKillCount;
+ case TYPE_RING_OF_LAW:
+ return encounter[0];
+ case TYPE_VAULT:
+ return encounter[1];
+ case TYPE_BAR:
+ if (encounter[2] == IN_PROGRESS && BarAleCount == 3)
+ return SPECIAL;
+ else
+ return encounter[2];
+ case TYPE_TOMB_OF_SEVEN:
+ return encounter[3];
+ case TYPE_LYCEUM:
+ return encounter[4];
+ case TYPE_IRON_HALL:
+ return encounter[5];
+ case DATA_GHOSTKILL:
+ return GhostKillCount;
}
return 0;
}
@@ -275,42 +280,42 @@ public:
{
switch (data)
{
- case DATA_EMPEROR:
- return EmperorGUID;
- case DATA_PHALANX:
- return PhalanxGUID;
- case DATA_MOIRA:
- return MoiraGUID;
- case DATA_COREN:
- return CorenGUID;
- case DATA_ARENA1:
- return GoArena1GUID;
- case DATA_ARENA2:
- return GoArena2GUID;
- case DATA_ARENA3:
- return GoArena3GUID;
- case DATA_ARENA4:
- return GoArena4GUID;
- case DATA_GO_BAR_KEG:
- return GoBarKegGUID;
- case DATA_GO_BAR_KEG_TRAP:
- return GoBarKegTrapGUID;
- case DATA_GO_BAR_DOOR:
- return GoBarDoorGUID;
- case DATA_EVENSTARTER:
- return TombEventStarterGUID;
- case DATA_SF_BRAZIER_N:
- return GoSFNGUID;
- case DATA_SF_BRAZIER_S:
- return GoSFSGUID;
- case DATA_THRONE_DOOR:
- return GoThroneGUID;
- case DATA_GOLEM_DOOR_N:
- return GoGolemNGUID;
- case DATA_GOLEM_DOOR_S:
- return GoGolemSGUID;
- case DATA_GO_CHALICE:
- return GoSpectralChaliceGUID;
+ case DATA_EMPEROR:
+ return EmperorGUID;
+ case DATA_PHALANX:
+ return PhalanxGUID;
+ case DATA_MOIRA:
+ return MoiraGUID;
+ case DATA_COREN:
+ return CorenGUID;
+ case DATA_ARENA1:
+ return GoArena1GUID;
+ case DATA_ARENA2:
+ return GoArena2GUID;
+ case DATA_ARENA3:
+ return GoArena3GUID;
+ case DATA_ARENA4:
+ return GoArena4GUID;
+ case DATA_GO_BAR_KEG:
+ return GoBarKegGUID;
+ case DATA_GO_BAR_KEG_TRAP:
+ return GoBarKegTrapGUID;
+ case DATA_GO_BAR_DOOR:
+ return GoBarDoorGUID;
+ case DATA_EVENSTARTER:
+ return TombEventStarterGUID;
+ case DATA_SF_BRAZIER_N:
+ return GoSFNGUID;
+ case DATA_SF_BRAZIER_S:
+ return GoSFSGUID;
+ case DATA_THRONE_DOOR:
+ return GoThroneGUID;
+ case DATA_GOLEM_DOOR_N:
+ return GoGolemNGUID;
+ case DATA_GOLEM_DOOR_S:
+ return GoGolemSGUID;
+ case DATA_GO_CHALICE:
+ return GoSpectralChaliceGUID;
}
return ObjectGuid::Empty;
}
@@ -320,7 +325,7 @@ public:
return str_data;
}
- void Load(const char* in) override
+ void Load(char const* in) override
{
if (!in)
{
@@ -375,7 +380,7 @@ public:
boss->CombatStop(true);
boss->LoadCreaturesAddon();
boss->GetMotionMaster()->MoveTargetedHome();
- boss->SetLootRecipient(NULL);
+ boss->SetLootRecipient(nullptr);
}
boss->SetFaction(FACTION_FRIENDLY);
}
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/blackrock_spire.h b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/blackrock_spire.h
index 8251d96dc58..8d9b2c393bb 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"
@@ -120,4 +122,10 @@ enum BRSGameObjectsIds
GO_PORTCULLIS_TOBOSSROOMS = 175186
};
+template <class AI, class T>
+inline AI* GetBlackrockSpireAI(T* obj)
+{
+ return GetInstanceAI<AI>(obj, 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..6dac4937a8a 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
{
@@ -105,7 +105,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_drakkisathAI(creature);
+ return GetBlackrockSpireAI<boss_drakkisathAI>(creature);
}
};
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..a62da8ea9ed 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,9 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "blackrock_spire.h"
+#include "MotionMaster.h"
+#include "ScriptedCreature.h"
#include "TemporarySummon.h"
enum Spells
@@ -105,7 +106,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..4a469a3b716 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_gyth.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_gyth.cpp
@@ -16,8 +16,11 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "blackrock_spire.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
+#include "ScriptedCreature.h"
enum Spells
{
@@ -176,7 +179,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 9dcaf290cb8..61aa94b4d02 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_pyroguard_emberseer.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_pyroguard_emberseer.cpp
@@ -15,12 +15,15 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ObjectMgr.h"
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "Player.h"
-#include "Spell.h"
#include "blackrock_spire.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
+#include "ScriptedCreature.h"
+#include "SpellInfo.h"
enum Text
{
@@ -104,10 +107,10 @@ public:
break;
case 2:
// Close these two doors on Blackhand Incarcerators aggro
- if (GameObject* door1 = me->GetMap()->GetGameObject(instance->GetGuidData(GO_EMBERSEER_IN)))
+ if (GameObject* door1 = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_EMBERSEER_IN)))
if (door1->GetGoState() == GO_STATE_ACTIVE)
door1->SetGoState(GO_STATE_READY);
- if (GameObject* door2 = me->GetMap()->GetGameObject(instance->GetGuidData(GO_DOORS)))
+ if (GameObject* door2 = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_DOORS)))
if (door2->GetGoState() == GO_STATE_ACTIVE)
door2->SetGoState(GO_STATE_READY);
break;
@@ -166,33 +169,33 @@ public:
void OpenDoors(bool Boss_Killed)
{
// These two doors reopen on reset or boss kill
- if (GameObject* door1 = me->GetMap()->GetGameObject(instance->GetGuidData(GO_EMBERSEER_IN)))
+ if (GameObject* door1 = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_EMBERSEER_IN)))
door1->SetGoState(GO_STATE_ACTIVE);
- if (GameObject* door2 = me->GetMap()->GetGameObject(instance->GetGuidData(GO_DOORS)))
+ if (GameObject* door2 = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_DOORS)))
door2->SetGoState(GO_STATE_ACTIVE);
// This door opens on boss kill
if (Boss_Killed)
- if (GameObject* door3 = me->GetMap()->GetGameObject(instance->GetGuidData(GO_EMBERSEER_OUT)))
+ if (GameObject* door3 = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_EMBERSEER_OUT)))
door3->SetGoState(GO_STATE_ACTIVE);
}
void UpdateRunes(GOState state)
{
// update all runes
- if (GameObject* rune1 = me->GetMap()->GetGameObject(instance->GetGuidData(GO_EMBERSEER_RUNE_1)))
+ if (GameObject* rune1 = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_EMBERSEER_RUNE_1)))
rune1->SetGoState(state);
- if (GameObject* rune2 = me->GetMap()->GetGameObject(instance->GetGuidData(GO_EMBERSEER_RUNE_2)))
+ if (GameObject* rune2 = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_EMBERSEER_RUNE_2)))
rune2->SetGoState(state);
- if (GameObject* rune3 = me->GetMap()->GetGameObject(instance->GetGuidData(GO_EMBERSEER_RUNE_3)))
+ if (GameObject* rune3 = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_EMBERSEER_RUNE_3)))
rune3->SetGoState(state);
- if (GameObject* rune4 = me->GetMap()->GetGameObject(instance->GetGuidData(GO_EMBERSEER_RUNE_4)))
+ if (GameObject* rune4 = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_EMBERSEER_RUNE_4)))
rune4->SetGoState(state);
- if (GameObject* rune5 = me->GetMap()->GetGameObject(instance->GetGuidData(GO_EMBERSEER_RUNE_5)))
+ if (GameObject* rune5 = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_EMBERSEER_RUNE_5)))
rune5->SetGoState(state);
- if (GameObject* rune6 = me->GetMap()->GetGameObject(instance->GetGuidData(GO_EMBERSEER_RUNE_6)))
+ if (GameObject* rune6 = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_EMBERSEER_RUNE_6)))
rune6->SetGoState(state);
- if (GameObject* rune7 = me->GetMap()->GetGameObject(instance->GetGuidData(GO_EMBERSEER_RUNE_7)))
+ if (GameObject* rune7 = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_EMBERSEER_RUNE_7)))
rune7->SetGoState(state);
}
@@ -250,7 +253,7 @@ public:
{
// Check to see if all players in instance have aura SPELL_EMBERSEER_START before starting event
bool _hasAura = true;
- Map::PlayerList const &players = me->GetMap()->GetPlayers();
+ Map::PlayerList const& players = me->GetMap()->GetPlayers();
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
if (Player* player = itr->GetSource()->ToPlayer())
if (!player->HasAura(SPELL_EMBERSEER_OBJECT_VISUAL))
@@ -312,7 +315,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_pyroguard_emberseerAI>(creature);
+ return GetBlackrockSpireAI<boss_pyroguard_emberseerAI>(creature);
}
};
@@ -436,7 +439,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_blackhand_incarceratorAI(creature);
+ return GetBlackrockSpireAI<npc_blackhand_incarceratorAI>(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..1f5bd2a4cd0 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,12 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "Player.h"
#include "blackrock_spire.h"
+#include "GameObject.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
+#include "ScriptedCreature.h"
enum Spells
{
@@ -372,37 +375,37 @@ public:
me->SummonCreature(NPC_GYTH, 211.762f, -397.5885f, 111.1817f, 4.747295f);
break;
case EVENT_WAVE_1:
- if (GameObject* portcullis = me->GetMap()->GetGameObject(portcullisGUID))
+ if (GameObject* portcullis = ObjectAccessor::GetGameObject(*me, portcullisGUID))
portcullis->UseDoorOrButton();
// move wave
break;
case EVENT_WAVE_2:
// spawn wave
- if (GameObject* portcullis = me->GetMap()->GetGameObject(portcullisGUID))
+ if (GameObject* portcullis = ObjectAccessor::GetGameObject(*me, portcullisGUID))
portcullis->UseDoorOrButton();
// move wave
break;
case EVENT_WAVE_3:
// spawn wave
- if (GameObject* portcullis = me->GetMap()->GetGameObject(portcullisGUID))
+ if (GameObject* portcullis = ObjectAccessor::GetGameObject(*me, portcullisGUID))
portcullis->UseDoorOrButton();
// move wave
break;
case EVENT_WAVE_4:
// spawn wave
- if (GameObject* portcullis = me->GetMap()->GetGameObject(portcullisGUID))
+ if (GameObject* portcullis = ObjectAccessor::GetGameObject(*me, portcullisGUID))
portcullis->UseDoorOrButton();
// move wave
break;
case EVENT_WAVE_5:
// spawn wave
- if (GameObject* portcullis = me->GetMap()->GetGameObject(portcullisGUID))
+ if (GameObject* portcullis = ObjectAccessor::GetGameObject(*me, portcullisGUID))
portcullis->UseDoorOrButton();
// move wave
break;
case EVENT_WAVE_6:
// spawn wave
- if (GameObject* portcullis = me->GetMap()->GetGameObject(portcullisGUID))
+ if (GameObject* portcullis = ObjectAccessor::GetGameObject(*me, portcullisGUID))
portcullis->UseDoorOrButton();
// move wave
break;
@@ -452,7 +455,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 bf6197110fa..21fe1450a3b 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,14 @@
* 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 "ObjectAccessor.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 };
@@ -120,7 +119,7 @@ public:
switch (go->GetEntry())
{
case GO_WHELP_SPAWNER:
- go->CastSpell(NULL, SPELL_SUMMON_ROOKERY_WHELP);
+ go->CastSpell(nullptr, SPELL_SUMMON_ROOKERY_WHELP);
break;
case GO_EMBERSEER_IN:
go_emberseerin = go->GetGUID();
@@ -419,8 +418,8 @@ public:
void Dragonspireroomcheck()
{
- Creature* mob = NULL;
- GameObject* rune = NULL;
+ Creature* mob = nullptr;
+ GameObject* rune = nullptr;
for (uint8 i = 0; i < 7; ++i)
{
@@ -528,7 +527,7 @@ class at_dragonspire_hall : public AreaTriggerScript
public:
at_dragonspire_hall() : AreaTriggerScript("at_dragonspire_hall") { }
- bool OnTrigger(Player* player, const AreaTriggerEntry* /*at*/) override
+ bool OnTrigger(Player* player, AreaTriggerEntry const* /*at*/) override
{
if (player && player->IsAlive())
{
@@ -552,7 +551,7 @@ class at_blackrock_stadium : public AreaTriggerScript
public:
at_blackrock_stadium() : AreaTriggerScript("at_blackrock_stadium") { }
- bool OnTrigger(Player* player, const AreaTriggerEntry* /*at*/) override
+ bool OnTrigger(Player* player, AreaTriggerEntry const* /*at*/) override
{
if (player && player->IsAlive())
{
@@ -576,10 +575,12 @@ class at_nearby_scarshield_infiltrator : public AreaTriggerScript
public:
at_nearby_scarshield_infiltrator() : AreaTriggerScript("at_nearby_scarshield_infiltrator") { }
- bool OnTrigger(Player* player, const AreaTriggerEntry* /*at*/) override
+ bool OnTrigger(Player* player, AreaTriggerEntry const* /*at*/) override
{
if (player->IsAlive())
+ {
if (InstanceScript* instance = player->GetInstanceScript())
+ {
if (Creature* infiltrator = ObjectAccessor::GetCreature(*player, instance->GetGuidData(DATA_SCARSHIELD_INFILTRATOR)))
{
if (player->getLevel() >= 57)
@@ -589,6 +590,8 @@ public:
return true;
}
+ }
+ }
return false;
}
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/blackwing_lair.h b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/blackwing_lair.h
index 79f47eeb412..ce31344222d 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 <class AI, class T>
+inline AI* GetBlackwingLairAI(T* obj)
+{
+ return GetInstanceAI<AI>(obj, 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..d8403641dfa 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_broodlord_lashlayer.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_broodlord_lashlayer.cpp
@@ -17,8 +17,8 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "blackwing_lair.h"
+#include "ScriptedCreature.h"
enum Say
{
@@ -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..26619a9b730 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_chromaggus.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_chromaggus.cpp
@@ -17,9 +17,10 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "Player.h"
#include "blackwing_lair.h"
+#include "Map.h"
+#include "Player.h"
+#include "ScriptedCreature.h"
enum Emotes
{
@@ -240,7 +241,7 @@ public:
break;
case EVENT_AFFLICTION:
{
- Map::PlayerList const &players = me->GetMap()->GetPlayers();
+ Map::PlayerList const& players = me->GetMap()->GetPlayers();
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
{
if (Player* player = itr->GetSource()->ToPlayer())
@@ -290,7 +291,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..d31b9f84778 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_ebonroc.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_ebonroc.cpp
@@ -17,8 +17,8 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "blackwing_lair.h"
+#include "ScriptedCreature.h"
enum Spells
{
@@ -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..024fc54e6a0 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_firemaw.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_firemaw.cpp
@@ -17,8 +17,8 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "blackwing_lair.h"
+#include "ScriptedCreature.h"
enum Spells
{
@@ -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..31d606975bb 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_flamegor.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_flamegor.cpp
@@ -17,8 +17,8 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "blackwing_lair.h"
+#include "ScriptedCreature.h"
enum Emotes
{
@@ -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 1d4ce755908..f213a2be37c 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp
@@ -17,10 +17,14 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedGossip.h"
-#include "ScriptedCreature.h"
#include "blackwing_lair.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
#include "Player.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
+#include "TemporarySummon.h"
enum Events
{
@@ -351,7 +355,7 @@ public:
nefarian->setActive(true);
nefarian->SetCanFly(true);
nefarian->SetDisableGravity(true);
- nefarian->CastSpell((Unit*)NULL, SPELL_SHADOWFLAME_INITIAL);
+ nefarian->CastSpell((Unit*)nullptr, SPELL_SHADOWFLAME_INITIAL);
nefarian->GetMotionMaster()->MovePoint(1, NefarianLoc[1]);
}
events.CancelEvent(EVENT_MIND_CONTROL);
@@ -388,7 +392,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_victor_nefariusAI>(creature);
+ return GetBlackwingLairAI<boss_victor_nefariusAI>(creature);
}
};
@@ -594,7 +598,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 b425f234df9..b7c4e32188d 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_razorgore.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_razorgore.cpp
@@ -17,11 +17,13 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "SpellScript.h"
-#include "GameObjectAI.h"
#include "blackwing_lair.h"
+#include "InstanceScript.h"
+#include "GameObject.h"
+#include "GameObjectAI.h"
#include "Player.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
enum Say
{
@@ -169,7 +171,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_razorgoreAI>(creature);
+ return GetBlackwingLairAI<boss_razorgoreAI>(creature);
}
};
@@ -200,7 +202,7 @@ class go_orb_of_domination : public GameObjectScript
GameObjectAI* GetAI(GameObject* go) const override
{
- return GetInstanceAI<go_orb_of_dominationAI>(go);
+ return GetBlackwingLairAI<go_orb_of_dominationAI>(go);
}
};
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp
index b8993354501..491d37f59c4 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp
@@ -17,12 +17,13 @@
*/
#include "ScriptMgr.h"
-#include "SpellScript.h"
-#include "SpellAuraEffects.h"
-#include "ScriptedCreature.h"
#include "blackwing_lair.h"
-#include "ScriptedGossip.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
+#include "SpellAuraEffects.h"
+#include "SpellScript.h"
enum Says
{
@@ -239,7 +240,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 a65620d7dca..bfd3d2ef3be 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,15 @@
* 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 "Map.h"
+#include "MotionMaster.h"
+#include "Player.h"
+#include "ScriptedCreature.h"
+#include "TemporarySummon.h"
DoorData const doorData[] =
{
@@ -63,7 +68,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..ef9378df968 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_baron_geddon.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_baron_geddon.cpp
@@ -23,12 +23,12 @@ SDComment:
SDCategory: Molten Core
EndScriptData */
-#include "ObjectMgr.h"
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "molten_core.h"
+#include "ScriptedCreature.h"
#include "SpellAuraEffects.h"
#include "SpellScript.h"
+#include "ObjectMgr.h"
enum Emotes
{
@@ -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..580495bd6c7 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_garr.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_garr.cpp
@@ -23,10 +23,10 @@ SDComment: Adds NYI
SDCategory: Molten Core
EndScriptData */
-#include "ObjectMgr.h"
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "molten_core.h"
+#include "ObjectMgr.h"
+#include "ScriptedCreature.h"
enum Spells
{
@@ -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..43454e9b840 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_gehennas.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_gehennas.cpp
@@ -23,10 +23,10 @@ SDComment: Adds MC NYI
SDCategory: Molten Core
EndScriptData */
-#include "ObjectMgr.h"
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "molten_core.h"
+#include "ObjectMgr.h"
+#include "ScriptedCreature.h"
enum Spells
{
@@ -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..c05454daea7 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 "ObjectMgr.h"
+#include "ScriptedCreature.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..5a5baf50b79 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_lucifron.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_lucifron.cpp
@@ -23,10 +23,10 @@ SDComment:
SDCategory: Molten Core
EndScriptData */
-#include "ObjectMgr.h"
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "molten_core.h"
+#include "ObjectMgr.h"
+#include "ScriptedCreature.h"
enum Spells
{
@@ -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..1fa9bfeec25 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_magmadar.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_magmadar.cpp
@@ -23,10 +23,10 @@ SDComment: Conflag on ground nyi
SDCategory: Molten Core
EndScriptData */
-#include "ObjectMgr.h"
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "molten_core.h"
+#include "ObjectMgr.h"
+#include "ScriptedCreature.h"
enum Texts
{
@@ -115,7 +115,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 7bf91173432..73c1664e71f 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,14 @@ 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 "Map.h"
#include "molten_core.h"
+#include "ObjectMgr.h"
#include "Player.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
enum Texts
{
@@ -108,7 +110,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 +210,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 481472f854e..49bb5f11ecc 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..778e4bd9069 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_sulfuron_harbinger.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_sulfuron_harbinger.cpp
@@ -23,10 +23,10 @@ SDComment: Adds NYI
SDCategory: Molten Core
EndScriptData */
-#include "ObjectMgr.h"
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "molten_core.h"
+#include "ObjectMgr.h"
+#include "ScriptedCreature.h"
enum Spells
{
@@ -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 47797d09332..a3f990ea34d 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 "molten_core.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "Map.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..9e582985088 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 <class AI, class T>
+inline AI* GetMoltenCoreAI(T* obj)
+{
+ return GetInstanceAI<AI>(obj, 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 b9d3a96f338..89239a8fb24 100644
--- a/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp
+++ b/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp
@@ -22,8 +22,12 @@ 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 "MotionMaster.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
enum Spells
{
@@ -53,7 +57,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.cpp b/src/server/scripts/EasternKingdoms/Deadmines/deadmines.cpp
index c9e83cf2bfe..d8887dea5a7 100644
--- a/src/server/scripts/EasternKingdoms/Deadmines/deadmines.cpp
+++ b/src/server/scripts/EasternKingdoms/Deadmines/deadmines.cpp
@@ -24,10 +24,13 @@ SDCategory: Deadmines
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "deadmines.h"
-#include "Spell.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "Item.h"
#include "Player.h"
+#include "ScriptedCreature.h"
+#include "Spell.h"
#include "WorldSession.h"
/*#####
diff --git a/src/server/scripts/EasternKingdoms/Deadmines/deadmines.h b/src/server/scripts/EasternKingdoms/Deadmines/deadmines.h
index 33abf4b8eee..a2778fb38c0 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
@@ -61,4 +64,10 @@ enum DMInstanceTexts
SAY_ALARM2 = 1
};
+template <class AI, class T>
+inline AI* GetDeadminesAI(T* obj)
+{
+ return GetInstanceAI<AI>(obj, DMScriptName);
+}
+
#endif
diff --git a/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp b/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp
index 877ffd70a1b..d87274818b1 100644
--- a/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp
+++ b/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp
@@ -24,10 +24,13 @@ SDCategory: Deadmines
EndScriptData */
#include "ScriptMgr.h"
-#include "InstanceScript.h"
+#include "CreatureAI.h"
#include "deadmines.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "MotionMaster.h"
#include "TemporarySummon.h"
-#include "WorldPacket.h"
enum Sounds
{
@@ -45,8 +48,7 @@ enum Misc
class instance_deadmines : public InstanceMapScript
{
public:
- instance_deadmines()
- : InstanceMapScript("instance_deadmines", 36)
+ instance_deadmines() : InstanceMapScript(DMScriptName, 36)
{
}
@@ -213,15 +215,15 @@ class instance_deadmines : public InstanceMapScript
{
switch (type)
{
- case EVENT_STATE:
- if (DefiasCannonGUID && IronCladDoorGUID)
- State=data;
- break;
- case EVENT_RHAHKZOR:
- if (data == DONE)
- if (GameObject* go = instance->GetGameObject(FactoryDoorGUID))
- go->SetGoState(GO_STATE_ACTIVE);
- break;
+ case EVENT_STATE:
+ if (DefiasCannonGUID && IronCladDoorGUID)
+ State = data;
+ break;
+ case EVENT_RHAHKZOR:
+ if (data == DONE)
+ if (GameObject* go = instance->GetGameObject(FactoryDoorGUID))
+ go->SetGoState(GO_STATE_ACTIVE);
+ break;
}
}
diff --git a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp
index bf781c171e5..f787da07308 100644
--- a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp
+++ b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp
@@ -23,12 +23,16 @@ 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 "Map.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptedEscortAI.h"
#include "ScriptedGossip.h"
#include "SpellScript.h"
-#include "Player.h"
-#include "gnomeregan.h"
+#include "TemporarySummon.h"
enum BlastmasterEmi
{
@@ -87,7 +91,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
@@ -201,7 +205,7 @@ public:
void AggroAllPlayers(Creature* temp)
{
- Map::PlayerList const &PlList = me->GetMap()->GetPlayers();
+ Map::PlayerList const& PlList = me->GetMap()->GetPlayers();
for (Map::PlayerList::const_iterator i = PlList.begin(); i != PlList.end(); ++i)
{
if (Player* player = i->GetSource())
@@ -304,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!
@@ -319,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);
@@ -333,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!
@@ -341,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!
@@ -353,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;
}
}
@@ -503,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..ad64a301e0a 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 <class AI, class T>
+inline AI* GetGnomereganAI(T* obj)
+{
+ return GetInstanceAI<AI>(obj, GNOScriptName);
+}
+
#endif
diff --git a/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp b/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp
index 9a8ec451232..2f5f80d0f0d 100644
--- a/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp
+++ b/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp
@@ -16,8 +16,12 @@
*/
#include "ScriptMgr.h"
-#include "InstanceScript.h"
+#include "Creature.h"
+#include "GameObject.h"
#include "gnomeregan.h"
+#include "InstanceScript.h"
+#include "Log.h"
+#include "Map.h"
#include "Player.h"
#define MAX_ENCOUNTER 1
@@ -25,7 +29,7 @@
class instance_gnomeregan : public InstanceMapScript
{
public:
- instance_gnomeregan() : InstanceMapScript("instance_gnomeregan", 90) { }
+ instance_gnomeregan() : InstanceMapScript(GNOScriptName, 90) { }
InstanceScript* GetInstanceScript(InstanceMap* map) const override
{
@@ -47,7 +51,7 @@ public:
ObjectGuid uiBastmasterEmiShortfuseGUID;
- void Load(const char* in) override
+ void Load(char const* in) override
{
if (!in)
{
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp
index 3c4025084d2..8676bbe9520 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp
@@ -16,8 +16,8 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "karazhan.h"
+#include "ScriptedCreature.h"
enum CuratorSays
{
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 2adb2d445e6..ef9dc5e2e98 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
{
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp
index 55b089842e0..fa7a27082d8 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp
@@ -24,9 +24,11 @@ SDCategory: Karazhan
EndScriptData */
#include "ScriptMgr.h"
+#include "karazhan.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
#include "SpellInfo.h"
-#include "karazhan.h"
enum Texts
{
@@ -171,7 +173,7 @@ public:
scheduler.Schedule(Seconds(10), Seconds(25), [this](TaskContext task)
{
Unit* target = nullptr;
- ThreatContainer::StorageType const &t_list = me->getThreatManager().getThreatList();
+ ThreatContainer::StorageType const& t_list = me->getThreatManager().getThreatList();
std::vector<Unit*> target_list;
for (ThreatContainer::StorageType::const_iterator itr = t_list.begin(); itr != t_list.end(); ++itr)
@@ -222,7 +224,7 @@ public:
std::bind(&BossAI::DoMeleeAttackIfReady, this));
}
- void SpellHit(Unit* /*source*/, const SpellInfo* spell) override
+ void SpellHit(Unit* /*source*/, SpellInfo const* spell) override
{
if (spell->Mechanic == MECHANIC_DISARM)
Talk(SAY_DISARMED);
@@ -275,7 +277,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_attumenAI(creature);
+ return GetKarazhanAI<boss_attumenAI>(creature);
}
};
@@ -377,7 +379,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 1adbbec120f..8b0f5a7a150 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 "karazhan.h"
+#include "InstanceScript.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
@@ -381,7 +384,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
@@ -452,7 +455,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
@@ -517,7 +520,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
@@ -595,7 +598,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
@@ -677,7 +680,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
@@ -741,7 +744,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..36777a5670c 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp
@@ -24,9 +24,14 @@ SDCategory: Karazhan
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
#include "karazhan.h"
+#include "Map.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "ScriptedCreature.h"
+#include "TemporarySummon.h"
enum Netherspite
{
@@ -71,7 +76,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 a5c968ce55a..95510202610 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp
@@ -16,11 +16,15 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "GameObject.h"
#include "GameObjectAI.h"
-#include "SpellScript.h"
-#include "SpellAuraEffects.h"
+#include "InstanceScript.h"
#include "karazhan.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
+#include "SpellAuraEffects.h"
+#include "SpellScript.h"
enum NightbaneSpells
{
@@ -375,7 +379,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_nightbaneAI>(creature);
+ return GetKarazhanAI<boss_nightbaneAI>(creature);
}
};
@@ -391,9 +395,7 @@ class spell_rain_of_bones : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_SKELETON))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SUMMON_SKELETON });
}
void OnTrigger(AuraEffect const* aurEff)
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp
index 3fc3dd1c8f8..e2843844076 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 "karazhan.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
#include "SpellInfo.h"
+#include "SpellMgr.h"
+#include "TemporarySummon.h"
// 18 Coordinates for Infernal spawns
struct InfernalPoint
@@ -104,13 +108,13 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new netherspite_infernalAI(creature);
+ return GetKarazhanAI<netherspite_infernalAI>(creature);
}
struct netherspite_infernalAI : public ScriptedAI
{
netherspite_infernalAI(Creature* creature) : ScriptedAI(creature),
- HellfireTimer(0), CleanupTimer(0), point(NULL) { }
+ HellfireTimer(0), CleanupTimer(0), point(nullptr) { }
uint32 HellfireTimer;
uint32 CleanupTimer;
@@ -151,7 +155,7 @@ public:
creature->AI()->KilledUnit(who);
}
- void SpellHit(Unit* /*who*/, const SpellInfo* spell) override
+ void SpellHit(Unit* /*who*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_INFERNAL_RELAY)
{
@@ -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())
@@ -356,7 +360,7 @@ public:
void SummonInfernal(const uint32 /*diff*/)
{
- InfernalPoint *point = NULL;
+ InfernalPoint *point = nullptr;
Position pos;
if ((me->GetMapId() != 532) || positions.empty())
pos = me->GetRandomNearPosition(60);
@@ -524,7 +528,7 @@ public:
{
if (SWPainTimer <= diff)
{
- Unit* target = NULL;
+ Unit* target = nullptr;
if (phase == 1)
target = me->GetVictim(); // the tank
else // anyone but the tank
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 d3a580f5159..0f44933caeb 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp
@@ -24,10 +24,13 @@ SDCategory: Karazhan
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "karazhan.h"
+#include "InstanceScript.h"
#include "GameObject.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
#include "SpellInfo.h"
+#include "TemporarySummon.h"
enum ShadeOfAran
{
@@ -86,7 +89,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_aranAI>(creature);
+ return GetKarazhanAI<boss_aranAI>(creature);
}
struct boss_aranAI : public ScriptedAI
@@ -182,7 +185,7 @@ public:
void FlameWreathEffect()
{
std::vector<Unit*> targets;
- ThreatContainer::StorageType const &t_list = me->getThreatManager().getThreatList();
+ ThreatContainer::StorageType const& t_list = me->getThreatManager().getThreatList();
if (t_list.empty())
return;
@@ -482,7 +485,7 @@ public:
DrinkInturrupted = true;
}
- void SpellHit(Unit* /*pAttacker*/, const SpellInfo* Spell) override
+ void SpellHit(Unit* /*pAttacker*/, SpellInfo const* Spell) override
{
//We only care about interrupt effects and only if they are durring a spell currently being cast
if ((Spell->Effects[0].Effect != SPELL_EFFECT_INTERRUPT_CAST &&
@@ -513,7 +516,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 d1743771363..37c944500e5 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp
@@ -16,9 +16,10 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "karazhan.h"
+#include "ObjectAccessor.h"
#include "PassiveAI.h"
+#include "ScriptedCreature.h"
#include "SpellInfo.h"
enum TerestianSays
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp
index 589fa02f1a2..9a01970f68b 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp
@@ -24,11 +24,16 @@ SDCategory: Karazhan
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
+#include "InstanceScript.h"
#include "karazhan.h"
+#include "Log.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "SpellInfo.h"
+#include "TemporarySummon.h"
/***********************************/
/*** OPERA WIZARD OF OZ EVENT *****/
@@ -118,7 +123,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_dorotheeAI>(creature);
+ return GetKarazhanAI<boss_dorotheeAI>(creature);
}
struct boss_dorotheeAI : public ScriptedAI
@@ -238,7 +243,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_titoAI(creature);
+ return GetKarazhanAI<npc_titoAI>(creature);
}
struct npc_titoAI : public ScriptedAI
@@ -312,7 +317,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_strawmanAI>(creature);
+ return GetKarazhanAI<boss_strawmanAI>(creature);
}
struct boss_strawmanAI : public ScriptedAI
@@ -368,7 +373,7 @@ public:
me->DespawnOrUnsummon();
}
- void SpellHit(Unit* /*caster*/, const SpellInfo* Spell) override
+ void SpellHit(Unit* /*caster*/, SpellInfo const* Spell) override
{
if ((Spell->SchoolMask == SPELL_SCHOOL_MASK_FIRE) && (!(rand32() % 10)))
{
@@ -432,7 +437,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_tinheadAI>(creature);
+ return GetKarazhanAI<boss_tinheadAI>(creature);
}
struct boss_tinheadAI : public ScriptedAI
@@ -547,7 +552,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_roarAI>(creature);
+ return GetKarazhanAI<boss_roarAI>(creature);
}
struct boss_roarAI : public ScriptedAI
@@ -661,7 +666,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_croneAI>(creature);
+ return GetKarazhanAI<boss_croneAI>(creature);
}
struct boss_croneAI : public ScriptedAI
@@ -745,7 +750,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_cycloneAI(creature);
+ return GetKarazhanAI<npc_cycloneAI>(creature);
}
struct npc_cycloneAI : public ScriptedAI
@@ -833,7 +838,7 @@ class npc_grandmother : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_grandmotherAI(creature);
+ return GetKarazhanAI<npc_grandmotherAI>(creature);
}
};
@@ -844,7 +849,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_bigbadwolfAI>(creature);
+ return GetKarazhanAI<boss_bigbadwolfAI>(creature);
}
struct boss_bigbadwolfAI : public ScriptedAI
@@ -1043,7 +1048,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_julianneAI>(creature);
+ return GetKarazhanAI<boss_julianneAI>(creature);
}
struct boss_julianneAI : public ScriptedAI
@@ -1131,7 +1136,7 @@ public:
me->DespawnOrUnsummon();
}
- void SpellHit(Unit* /*caster*/, const SpellInfo* Spell) override
+ void SpellHit(Unit* /*caster*/, SpellInfo const* Spell) override
{
if (Spell->Id == SPELL_DRINK_POISON)
{
@@ -1164,7 +1169,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 6e0dd3b1ee5..9daf041e54e 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
{
@@ -161,7 +164,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, nullptr);
}
break;
case DATA_CHESS:
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp
index 09dff7b6f0f..8c5f57e9a8e 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp
@@ -29,11 +29,16 @@ npc_image_of_medivh
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
+#include "InstanceScript.h"
#include "karazhan.h"
-#include "ScriptedEscortAI.h"
+#include "Log.h"
+#include "Map.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "ScriptedEscortAI.h"
+#include "ScriptedGossip.h"
+#include "TemporarySummon.h"
enum Spells
{
@@ -309,7 +314,7 @@ public:
{
if (WipeTimer <= diff)
{
- Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers();
+ Map::PlayerList const& PlayerList = me->GetMap()->GetPlayers();
if (PlayerList.isEmpty())
return;
@@ -429,7 +434,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
@@ -566,7 +571,7 @@ public:
me->SetVisible(false);
me->ClearInCombat();
- InstanceMap::PlayerList const &PlayerList = me->GetMap()->GetPlayers();
+ InstanceMap::PlayerList const& PlayerList = me->GetMap()->GetPlayers();
for (InstanceMap::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
{
if (i->GetSource()->IsAlive())
@@ -579,7 +584,7 @@ public:
}
case 15:
if (Creature* arca = ObjectAccessor::GetCreature(*me, ArcanagosGUID))
- arca->DealDamage(arca, arca->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
+ arca->DealDamage(arca, arca->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
return 5000;
default:
return 9999999;
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.h b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.h
index c36b99e6e49..e13e108eb4b 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.h
+++ b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.h
@@ -19,6 +19,8 @@
#ifndef DEF_KARAZHAN_H
#define DEF_KARAZHAN_H
+#include "CreatureAIImpl.h"
+
#define KZScriptName "instance_karazhan"
#define DataHeader "KZ"
@@ -111,7 +113,7 @@ enum KZMisc
OPTIONAL_BOSS_REQUIRED_DEATH_COUNT = 50
};
-template<class AI, class T>
+template <class AI, class T>
inline AI* GetKarazhanAI(T* obj)
{
return GetInstanceAI<AI>(obj, KZScriptName);
diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp
index 11e4fc35fdf..600ab5d379b 100644
--- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp
+++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp
@@ -24,10 +24,13 @@ 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 "MotionMaster.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
+#include "TemporarySummon.h"
enum Says
{
@@ -69,8 +72,6 @@ enum Spells
SPELL_POWER_FEEDBACK = 44233 // Stuns him, making him take 50% more damage for 10 seconds. Cast after Gravity Lapse
};
-
-
enum Creatures
{
CREATURE_PHOENIX = 24674,
@@ -96,7 +97,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
@@ -198,7 +199,7 @@ public:
if (!summonedUnit)
return;
- ThreatContainer::StorageType const &threatlist = me->getThreatManager().getThreatList();
+ ThreatContainer::StorageType const& threatlist = me->getThreatManager().getThreatList();
ThreatContainer::StorageType::const_iterator i = threatlist.begin();
for (i = threatlist.begin(); i != threatlist.end(); ++i)
{
@@ -251,11 +252,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->GetPackGUID();
- data << uint32(0);
- unit->SendMessageToSet(&data, true);
+ unit->SetCanFly(true);
}
}
}
@@ -271,11 +268,7 @@ public:
{
unit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_FLY);
unit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_DOT);
-
- WorldPacket data(SMSG_MOVE_UNSET_CAN_FLY, 12);
- data << unit->GetPackGUID();
- data << uint32(0);
- unit->SendMessageToSet(&data, true);
+ unit->SetCanFly(false);
}
}
}
@@ -399,7 +392,7 @@ public:
for (uint8 i = 0; i < 3; ++i)
{
- Unit* target = NULL;
+ Unit* target = nullptr;
target = SelectTarget(SELECT_TARGET_RANDOM, 0);
Creature* Orb = DoSpawnCreature(CREATURE_ARCANE_SPHERE, 5, 5, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000);
@@ -438,7 +431,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 +479,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
@@ -589,7 +582,7 @@ public:
{
//spell Burn should possible do this, but it doesn't, so do this for now.
uint16 dmg = urand(1650, 2050);
- me->DealDamage(me, dmg, 0, DOT, SPELL_SCHOOL_MASK_FIRE, NULL, false);
+ me->DealDamage(me, dmg, 0, DOT, SPELL_SCHOOL_MASK_FIRE, nullptr, false);
BurnTimer += 2000;
} BurnTimer -= diff;
@@ -605,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
@@ -649,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 ca816e8f512..8cddec4b58f 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 "magisters_terrace.h"
+#include "InstanceScript.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
@@ -315,7 +318,7 @@ public:
if (DispelTimer <= diff)
{
- Unit* target = NULL;
+ Unit* target = nullptr;
if (urand(0, 1))
target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true);
@@ -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
@@ -871,7 +874,7 @@ public:
if (Blink_Timer <= diff)
{
bool InMeleeRange = false;
- ThreatContainer::StorageType const &t_list = me->getThreatManager().getThreatList();
+ ThreatContainer::StorageType const& t_list = me->getThreatManager().getThreatList();
for (ThreatContainer::StorageType::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
{
if (Unit* target = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()))
@@ -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
@@ -965,7 +968,7 @@ public:
if (Intercept_Stun_Timer <= diff)
{
bool InMeleeRange = false;
- ThreatContainer::StorageType const &t_list = me->getThreatManager().getThreatList();
+ ThreatContainer::StorageType const& t_list = me->getThreatManager().getThreatList();
for (ThreatContainer::StorageType::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
{
if (Unit* target = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()))
@@ -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
@@ -1349,7 +1352,7 @@ public:
//CreatureAI* GetAI(Creature* creature) const override
//{
- // return new npc_high_explosive_sheepAI(creature);
+ // return GetMagistersTerraceAI<npc_high_explosive_sheepAI>(creature);
//};
};
*/
diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp
index 1d738d56984..86592f5677c 100644
--- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp
+++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp
@@ -16,8 +16,11 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "InstanceScript.h"
#include "magisters_terrace.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
enum Says
{
@@ -263,7 +266,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 +292,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..cf45d54cc22 100644
--- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp
+++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp
@@ -16,8 +16,9 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "magisters_terrace.h"
+#include "MotionMaster.h"
+#include "ScriptedCreature.h"
enum Yells
{
@@ -182,7 +183,7 @@ class boss_vexallus : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_vexallusAI>(creature);
+ return GetMagistersTerraceAI<boss_vexallusAI>(creature);
};
};
@@ -214,7 +215,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..8428762b109 100644
--- a/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp
+++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp
@@ -16,10 +16,14 @@
*/
#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 "MotionMaster.h"
+#include "ScriptedCreature.h"
+#include "TemporarySummon.h"
/*
0 - Selin Fireheart
@@ -43,7 +47,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
{
@@ -147,10 +151,10 @@ class instance_magisters_terrace : public InstanceMapScript
}
}
- void ProcessEvent(WorldObject* obj, uint32 eventId) override
+ 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));
}
@@ -159,11 +163,13 @@ class instance_magisters_terrace : public InstanceMapScript
Events.Update(diff);
if (Events.ExecuteEvent() == EVENT_SPAWN_KALECGOS)
+ {
if (Creature* kalecgos = instance->SummonCreature(NPC_KALECGOS, KalecgosSpawnPos))
{
kalecgos->GetMotionMaster()->MovePath(PATH_KALECGOS_FLIGHT, false);
kalecgos->AI()->Talk(SAY_KALECGOS_SPAWN);
}
+ }
}
bool SetBossState(uint32 type, EncounterState state) override
diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp
index 21e90d9a24d..8dd266c5613 100644
--- a/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp
+++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp
@@ -28,11 +28,11 @@ npc_kalecgos
EndContentData */
#include "ScriptMgr.h"
+#include "magisters_terrace.h"
+#include "MotionMaster.h"
+#include "Player.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
-#include "Player.h"
-#include "magisters_terrace.h"
-#include "EventMap.h"
/*######
## npc_kalecgos
@@ -155,7 +155,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_kalecgosAI(creature);
+ return GetMagistersTerraceAI<npc_kalecgosAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.h b/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.h
index cfdee423ef1..31716bcd478 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 <class AI, class T>
+inline AI* GetMagistersTerraceAI(T* obj)
+{
+ return GetInstanceAI<AI>(obj, MGTScriptName);
+}
+
#endif
diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
index c384419db06..630e362957b 100644
--- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
@@ -16,18 +16,21 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
-#include "Vehicle.h"
-#include "ObjectMgr.h"
-#include "ScriptedEscortAI.h"
#include "CombatAI.h"
-#include "PassiveAI.h"
+#include "CreatureTextMgr.h"
+#include "GameObject.h"
#include "GameObjectAI.h"
+#include "Log.h"
+#include "MotionMaster.h"
+#include "MoveSplineInit.h"
+#include "ObjectAccessor.h"
+#include "ObjectMgr.h"
+#include "PassiveAI.h"
#include "Player.h"
+#include "ScriptedEscortAI.h"
+#include "ScriptedGossip.h"
#include "SpellInfo.h"
-#include "CreatureTextMgr.h"
-#include "MoveSplineInit.h"
+#include "Vehicle.h"
/*######
##Quest 12848
@@ -191,7 +194,7 @@ public:
TC_LOG_ERROR("scripts", "npc_unworthy_initiateAI: unable to find anchor!");
float dist = 99.0f;
- GameObject* prison = NULL;
+ GameObject* prison = nullptr;
for (uint8 i = 0; i < 12; ++i)
{
@@ -512,7 +515,7 @@ public:
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_15);
}
- void SpellHit(Unit* pCaster, const SpellInfo* pSpell) override
+ void SpellHit(Unit* pCaster, SpellInfo const* pSpell) override
{
if (!m_bIsDuelInProgress && pSpell->Id == SPELL_DUEL)
{
@@ -767,7 +770,7 @@ public:
return false;
}
- void SpellHit(Unit* caster, const SpellInfo* spell) override
+ void SpellHit(Unit* caster, SpellInfo const* spell) override
{
if (spell->Id == SPELL_DELIVER_STOLEN_HORSE)
{
@@ -1068,7 +1071,7 @@ class npc_scarlet_miner_cart : public CreatureScript
if (apply)
{
_playerGUID = who->GetGUID();
- me->CastSpell((Unit*)NULL, SPELL_SUMMON_MINER, true);
+ me->CastSpell((Unit*)nullptr, SPELL_SUMMON_MINER, true);
}
else
{
diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp
index 8ee7049398e..2378d8ddad2 100644
--- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp
@@ -16,11 +16,13 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedEscortAI.h"
+#include "CreatureTextMgr.h"
+#include "GameObject.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "ScriptedEscortAI.h"
#include "SpellInfo.h"
-#include "CreatureTextMgr.h"
//How to win friends and influence enemies
// texts signed for creature 28939 but used for 28939, 28940, 28610
@@ -74,7 +76,7 @@ public:
me->RestoreFaction();
}
- void SpellHit(Unit* caster, const SpellInfo* spell) override
+ void SpellHit(Unit* caster, SpellInfo const* spell) override
{
if (spell->Id == SPELL_PERSUASIVE_STRIKE && caster->GetTypeId() == TYPEID_PLAYER && me->IsAlive() && !speechCounter)
{
@@ -91,7 +93,7 @@ public:
me->SetReactState(REACT_PASSIVE);
DoCastAOE(SPELL_THREAT_PULSE, true);
- sCreatureTextMgr->SendChat(me, SAY_PERSUADE_RAND, NULL, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_NORMAL, 0, TEAM_OTHER, false, player);
+ sCreatureTextMgr->SendChat(me, SAY_PERSUADE_RAND, nullptr, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_NORMAL, 0, TEAM_OTHER, false, player);
Talk(SAY_CRUSADER);
}
}
@@ -134,7 +136,7 @@ public:
break;
case 5:
- sCreatureTextMgr->SendChat(me, SAY_PERSUADED5, NULL, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_NORMAL, 0, TEAM_OTHER, false, player);
+ sCreatureTextMgr->SendChat(me, SAY_PERSUADED5, nullptr, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_NORMAL, 0, TEAM_OTHER, false, player);
speechTimer = 8000;
break;
diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp
index 319ac6b8ad3..bc950388ec7 100644
--- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp
@@ -16,10 +16,14 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
-#include "ScriptedEscortAI.h"
+#include "GameObject.h"
+#include "Map.h"
+#include "MotionMaster.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
@@ -1084,7 +1088,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))
@@ -1262,7 +1266,7 @@ public:
// go->SetPhaseMask(0, true);
{
// search players with in 50 yards for quest credit
- Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers();
+ Map::PlayerList const& PlayerList = me->GetMap()->GetPlayers();
if (!PlayerList.isEmpty())
{
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
@@ -1494,7 +1498,7 @@ public:
void SpawnNPC()
{
- Unit* temp = NULL;
+ Unit* temp = nullptr;
// Death
for (uint8 i = 0; i < ENCOUNTER_GHOUL_NUMBER; ++i)
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 6eb25dbd8f0..2adfea2f577 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,11 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "MotionMaster.h"
#include "PassiveAI.h"
#include "Player.h"
+#include "ScriptedCreature.h"
+#include "TemporarySummon.h"
/*####
## npc_valkyr_battle_maiden
@@ -83,7 +85,7 @@ public:
{
if (FlyBackTimer <= diff)
{
- Player* player = NULL;
+ Player* player = nullptr;
if (me->IsSummon())
if (Unit* summoner = me->ToTempSummon()->GetSummoner())
player = summoner->ToPlayer();
@@ -129,10 +131,11 @@ public:
break;
}
++phase;
- } else FlyBackTimer-=diff;
+ }
+ else
+ FlyBackTimer -= diff;
}
};
-
};
void AddSC_the_scarlet_enclave()
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp
index 697ff3b454e..5dcbf9490ec 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp
@@ -24,14 +24,20 @@ SDCategory: Scarlet Monastery
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "GameObject.h"
#include "GameObjectAI.h"
-#include "SpellMgr.h"
-#include "scarlet_monastery.h"
+#include "Group.h"
+#include "InstanceScript.h"
#include "LFGMgr.h"
+#include "Map.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "Player.h"
-#include "Group.h"
+#include "scarlet_monastery.h"
+#include "ScriptedCreature.h"
#include "SpellInfo.h"
+#include "SpellMgr.h"
+#include "TemporarySummon.h"
//this texts are already used by 3975 and 3976
enum Says
@@ -96,7 +102,7 @@ enum Spells
SPELL_DEATH = 42566 //not correct spell
};
-G3D::Vector3 const FlightPoint[]=
+Position const FlightPoint[]=
{
{1754.00f, 1346.00f, 17.50f},
{1765.00f, 1347.00f, 19.00f},
@@ -121,7 +127,7 @@ G3D::Vector3 const FlightPoint[]=
{1758.00f, 1367.00f, 19.51f}
};
-G3D::Vector3 const Spawn[]=
+Position const Spawn[]=
{
{1776.27f, 1348.74f, 19.20f}, //spawn point for pumpkin shrine mob
{1765.28f, 1347.46f, 17.55f} //spawn point for smoke
@@ -142,7 +148,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
@@ -183,7 +189,7 @@ public:
DoCast(me, _spell);
}
- void SpellHit(Unit* /*caster*/, const SpellInfo* spell) override
+ void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_WISP_FLIGHT_PORT && Creaturetype == 4)
me->SetDisplayId(2027);
@@ -221,7 +227,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_headAI(creature);
+ return GetScarletMonasteryAI<npc_headAI>(creature);
}
struct npc_headAI : public ScriptedAI
@@ -298,7 +304,7 @@ public:
}
}
- void SpellHit(Unit* caster, const SpellInfo* spell) override
+ void SpellHit(Unit* caster, SpellInfo const* spell) override
{
if (!withbody)
return;
@@ -374,7 +380,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
@@ -473,7 +479,7 @@ public:
break;
case 1:
{
- if (Creature* smoke = me->SummonCreature(HELPER, Spawn[1].x, Spawn[1].y, Spawn[1].z, 0, TEMPSUMMON_TIMED_DESPAWN, 20000))
+ if (Creature* smoke = me->SummonCreature(HELPER, Spawn[1], TEMPSUMMON_TIMED_DESPAWN, 20000))
ENSURE_AI(npc_wisp_invis::npc_wisp_invisAI, smoke->AI())->SetType(3);
DoCast(me, SPELL_RHYME_BIG);
break;
@@ -536,9 +542,9 @@ public:
Player* SelectRandomPlayer(float range = 0.0f, bool checkLoS = true)
{
- Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers();
+ Map::PlayerList const& PlayerList = me->GetMap()->GetPlayers();
if (PlayerList.isEmpty())
- return NULL;
+ return nullptr;
std::list<Player*> temp;
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
@@ -552,10 +558,10 @@ public:
advance(j, rand32() % temp.size());
return (*j);
}
- return NULL;
+ return nullptr;
}
- void SpellHitTarget(Unit* unit, const SpellInfo* spell) override
+ void SpellHitTarget(Unit* unit, SpellInfo const* spell) override
{
if (spell->Id == SPELL_CONFLAGRATION && unit->HasAura(SPELL_CONFLAGRATION))
SaySound(SAY_CONFLAGRATION, unit);
@@ -581,7 +587,7 @@ public:
}
}
- void SpellHit(Unit* caster, const SpellInfo* spell) override
+ void SpellHit(Unit* caster, SpellInfo const* spell) override
{
if (withhead)
return;
@@ -682,7 +688,7 @@ public:
{
wp_reached = false;
me->GetMotionMaster()->Clear(false);
- me->GetMotionMaster()->MovePoint(id, FlightPoint[id].x, FlightPoint[id].y, FlightPoint[id].z);
+ me->GetMotionMaster()->MovePoint(id, FlightPoint[id]);
}
}
}
@@ -692,7 +698,7 @@ public:
break;
if (burn <= diff)
{
- if (Creature* flame = me->SummonCreature(HELPER, Spawn[0].x, Spawn[0].y, Spawn[0].z, 0, TEMPSUMMON_TIMED_DESPAWN, 17000))
+ if (Creature* flame = me->SummonCreature(HELPER, Spawn[0], TEMPSUMMON_TIMED_DESPAWN, 17000))
ENSURE_AI(npc_wisp_invis::npc_wisp_invisAI, flame->AI())->SetType(2);
burned = true;
}
@@ -784,7 +790,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
@@ -820,7 +826,7 @@ public:
void EnterCombat(Unit* /*who*/) override { }
- void SpellHit(Unit* /*caster*/, const SpellInfo* spell) override
+ void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_SPROUTING)
{
@@ -900,7 +906,7 @@ class go_loosely_turned_soil : public GameObjectScript
return;
player->AreaExploredOrEventHappens(11405);
- if (Creature* horseman = me->SummonCreature(HH_MOUNTED, FlightPoint[20].x, FlightPoint[20].y, FlightPoint[20].z, 0, TEMPSUMMON_MANUAL_DESPAWN, 0))
+ if (Creature* horseman = me->SummonCreature(HH_MOUNTED, FlightPoint[20], TEMPSUMMON_MANUAL_DESPAWN, 0))
{
ENSURE_AI(boss_headless_horseman::boss_headless_horsemanAI, horseman->AI())->PlayerGUID = player->GetGUID();
ENSURE_AI(boss_headless_horseman::boss_headless_horsemanAI, horseman->AI())->FlyMode();
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp
index 7d3f0dd941c..509faae7957 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp
@@ -24,9 +24,9 @@ SDCategory: Scarlet Monastery
EndScriptData */
#include "ScriptMgr.h"
+#include "scarlet_monastery.h"
#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
-#include "scarlet_monastery.h"
enum Says
{
@@ -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..92db652813a 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 "scarlet_monastery.h"
+#include "InstanceScript.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_houndmaster_loksey.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_houndmaster_loksey.cpp
index 3ec1664ee74..3a68e3a01e5 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_houndmaster_loksey.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_houndmaster_loksey.cpp
@@ -16,8 +16,8 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "scarlet_monastery.h"
+#include "ScriptedCreature.h"
enum Yells
{
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp
index dd2443c12d7..eee97d1a134 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 "scarlet_monastery.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.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 cea8aa3b600..3f2a149771e 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,11 @@ SDCategory: Scarlet Monastery
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "scarlet_monastery.h"
+#include "ScriptedCreature.h"
#include "SpellInfo.h"
enum Says
@@ -65,7 +68,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
@@ -160,7 +163,7 @@ public:
}
}
- void SpellHit(Unit* /*who*/, const SpellInfo* spell) override
+ void SpellHit(Unit* /*who*/, SpellInfo const* spell) override
{
//When hit with resurrection say text
if (spell->Id == SPELL_SCARLETRESURRECTION)
@@ -228,7 +231,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
@@ -331,7 +334,7 @@ public:
//If we are <75% hp cast healing spells at self or Mograine
if (Heal_Timer <= diff)
{
- Creature* target = NULL;
+ Creature* target = nullptr;
if (!HealthAbovePct(75))
target = me;
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp
index cd07bedc628..bbce3417c02 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[] =
@@ -43,26 +46,13 @@ class instance_scarlet_monastery : public InstanceMapScript
void OnGameObjectCreate(GameObject* go) override
{
+ InstanceScript::OnGameObjectCreate(go);
+
switch (go->GetEntry())
{
case GO_PUMPKIN_SHRINE:
PumpkinShrineGUID = go->GetGUID();
break;
- case GO_HIGH_INQUISITORS_DOOR:
- AddDoor(go, true);
- break;
- default:
- break;
- }
- }
-
- void OnGameObjectRemove(GameObject* go) override
- {
- switch (go->GetEntry())
- {
- case GO_HIGH_INQUISITORS_DOOR:
- AddDoor(go, false);
- break;
default:
break;
}
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/scarlet_monastery.h b/src/server/scripts/EasternKingdoms/ScarletMonastery/scarlet_monastery.h
index 94db224f4ce..4653303cc21 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, class T>
+template <class AI, class T>
inline AI* GetScarletMonasteryAI(T* obj)
{
return GetInstanceAI<AI>(obj, SMScriptName);
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp
index 338aa2f62d0..dee7ea2a950 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp
@@ -23,9 +23,15 @@ Category: Scholomance
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "scholomance.h"
+#include "ScriptedCreature.h"
+#include "SpellInfo.h"
#include "SpellScript.h"
+#include "TemporarySummon.h"
enum Says
{
@@ -59,14 +65,14 @@ class boss_darkmaster_gandling : public CreatureScript
void Reset() override
{
_Reset();
- if (GameObject* gate = me->GetMap()->GetGameObject(instance->GetGuidData(GO_GATE_GANDLING)))
+ if (GameObject* gate = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_GATE_GANDLING)))
gate->SetGoState(GO_STATE_ACTIVE);
}
void JustDied(Unit* /*killer*/) override
{
_JustDied();
- if (GameObject* gate = me->GetMap()->GetGameObject(instance->GetGuidData(GO_GATE_GANDLING)))
+ if (GameObject* gate = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_GATE_GANDLING)))
gate->SetGoState(GO_STATE_ACTIVE);
}
@@ -78,7 +84,7 @@ class boss_darkmaster_gandling : public CreatureScript
events.ScheduleEvent(EVENT_CURSE, 2000);
events.ScheduleEvent(EVENT_SHADOW_PORTAL, 16000);
- if (GameObject* gate = me->GetMap()->GetGameObject(instance->GetGuidData(GO_GATE_GANDLING)))
+ if (GameObject* gate = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_GATE_GANDLING)))
gate->SetGoState(GO_STATE_READY);
}
@@ -131,7 +137,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);
}
};
@@ -165,17 +171,10 @@ class spell_shadow_portal : public SpellScriptLoader
{
PrepareSpellScript(spell_shadow_portal_SpellScript);
- public:
- spell_shadow_portal_SpellScript()
- {
- _instance = nullptr;
- }
-
- private:
bool Load() override
{
_instance = GetCaster()->GetInstanceScript();
- return _instance != nullptr;
+ return InstanceHasScript(GetCaster(), ScholomanceScriptName);
}
void HandleCast(SpellEffIndex /*effIndex*/)
@@ -232,7 +231,7 @@ class spell_shadow_portal : public SpellScriptLoader
OnEffectHitTarget += SpellEffectFn(spell_shadow_portal_SpellScript::HandleCast, EFFECT_0, SPELL_EFFECT_DUMMY);
}
- InstanceScript* _instance;
+ InstanceScript* _instance = nullptr;
};
SpellScript* GetSpellScript() const override
@@ -294,17 +293,10 @@ class spell_shadow_portal_rooms : public SpellScriptLoader
{
PrepareSpellScript(spell_shadow_portal_rooms_SpellScript);
- public:
- spell_shadow_portal_rooms_SpellScript()
- {
- _instance = nullptr;
- }
-
- private:
bool Load() override
{
_instance = GetCaster()->GetInstanceScript();
- return _instance != nullptr;
+ return InstanceHasScript(GetCaster(), ScholomanceScriptName);
}
void HandleSendEvent(SpellEffIndex effIndex)
@@ -353,7 +345,7 @@ class spell_shadow_portal_rooms : public SpellScriptLoader
break;
}
- if (gate_to_close && (caster->GetMap()->GetId() == 289))
+ if (gate_to_close)
{
for (uint8 i = 0; i < 3; ++i)
{
@@ -374,7 +366,7 @@ class spell_shadow_portal_rooms : public SpellScriptLoader
OnEffectHit += SpellEffectFn(spell_shadow_portal_rooms_SpellScript::HandleSendEvent, EFFECT_1, SPELL_EFFECT_SEND_EVENT);
}
- InstanceScript* _instance;
+ InstanceScript* _instance = nullptr;
};
SpellScript* GetSpellScript() const override
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..9eec06cbb33 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_doctor_theolen_krastinov.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_doctor_theolen_krastinov.cpp
@@ -23,8 +23,8 @@ Category: Scholomance
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "scholomance.h"
+#include "ScriptedCreature.h"
enum Say
{
@@ -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..8db6ade664d 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_illucia_barov.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_illucia_barov.cpp
@@ -23,8 +23,8 @@ Category: Scholomance
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "scholomance.h"
+#include "ScriptedCreature.h"
enum Spells
{
@@ -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..1627fd52c9b 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp
@@ -23,8 +23,8 @@ SDCategory: Scholomance
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "scholomance.h"
+#include "ScriptedCreature.h"
enum Spells
{
@@ -148,7 +148,7 @@ class boss_instructor_malicia : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_instructormaliciaAI(creature);
+ return GetScholomanceAI<boss_instructormaliciaAI>(creature);
}
};
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 4d7a8e599ab..33ad88e8d9e 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,15 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "scholomance.h"
-#include "MoveSplineInit.h"
+#include "GameObject.h"
#include "GameObjectAI.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
+#include "MoveSplineInit.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "scholomance.h"
+#include "ScriptedCreature.h"
enum Says
{
@@ -98,9 +102,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 +114,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);
@@ -137,9 +141,7 @@ class boss_kirtonos_the_herald : public CreatureScript
void MovementInform(uint32 type, uint32 id) override
{
if (type == WAYPOINT_MOTION_TYPE && id == POINT_KIRTONOS_LAND)
- {
events.ScheduleEvent(INTRO_2, 1500);
- }
}
void UpdateAI(uint32 diff) override
@@ -160,13 +162,13 @@ class boss_kirtonos_the_herald : public CreatureScript
events.ScheduleEvent(INTRO_3, 1000);
break;
case INTRO_3:
- 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_READY);
me->SetFacingTo(0.01745329f);
events.ScheduleEvent(INTRO_4, 3000);
break;
case INTRO_4:
- 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->SetGoState(GO_STATE_READY);
me->SetWalk(true);
me->SetDisableGravity(false);
@@ -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);
}
};
@@ -295,7 +297,7 @@ class go_brazier_of_the_herald : public GameObjectScript
GameObjectAI* GetAI(GameObject* go) const override
{
- return GetInstanceAI<go_brazier_of_the_heraldAI>(go);
+ return GetScholomanceAI<go_brazier_of_the_heraldAI>(go);
}
};
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..b5e64141aa8 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_lord_alexei_barov.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_lord_alexei_barov.cpp
@@ -22,9 +22,9 @@ SDComment: aura applied/defined in database
SDCategory: Scholomance
EndScriptData */
+#include "scholomance.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
-#include "scholomance.h"
enum Spells
{
@@ -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..4ffb4591e09 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp
@@ -22,9 +22,9 @@ Comment:
Category: Scholomance
*/
+#include "scholomance.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
-#include "scholomance.h"
enum Spells
{
@@ -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..f9994e6a3cf 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp
@@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "scholomance.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
@@ -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..75b9dc12ded 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_the_ravenian.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_the_ravenian.cpp
@@ -22,9 +22,9 @@ Comment:
Category: Scholomance
*/
+#include "scholomance.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
-#include "scholomance.h"
enum Spells
{
@@ -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..10beaee60ca 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_vectus.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_vectus.cpp
@@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "scholomance.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
@@ -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..3b88f54775b 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 <class AI, class T>
+inline AI* GetScholomanceAI(T* obj)
+{
+ return GetInstanceAI<AI>(obj, ScholomanceScriptName);
+}
+
#endif
diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/boss_apothecary_hummel.cpp b/src/server/scripts/EasternKingdoms/ShadowfangKeep/boss_apothecary_hummel.cpp
index 8e4eb61d322..e39bf1d83f3 100644
--- a/src/server/scripts/EasternKingdoms/ShadowfangKeep/boss_apothecary_hummel.cpp
+++ b/src/server/scripts/EasternKingdoms/ShadowfangKeep/boss_apothecary_hummel.cpp
@@ -16,15 +16,17 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
+#include "GridNotifiersImpl.h"
+#include "Group.h"
+#include "InstanceScript.h"
#include "LFGMgr.h"
+#include "Map.h"
+#include "MotionMaster.h"
#include "Player.h"
-#include "Group.h"
-#include "SpellScript.h"
-#include "SpellAuraEffects.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "shadowfang_keep.h"
-#include "GridNotifiersImpl.h"
+#include "SpellScript.h"
enum ApothecarySpells
{
@@ -275,7 +277,7 @@ class boss_apothecary_hummel : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_apothecary_hummelAI>(creature);
+ return GetShadowfangKeepAI<boss_apothecary_hummelAI>(creature);
}
};
@@ -325,7 +327,7 @@ class npc_apothecary_frye : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_apothecary_fryeAI>(creature);
+ return GetShadowfangKeepAI<npc_apothecary_fryeAI>(creature);
}
};
@@ -388,7 +390,7 @@ class npc_apothecary_baxter : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_apothecary_baxterAI>(creature);
+ return GetShadowfangKeepAI<npc_apothecary_baxterAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp b/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp
index 9e84eb6f59e..9ec2a58f742 100644
--- a/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp
+++ b/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp
@@ -23,10 +23,13 @@ SDComment:
SDCategory: Shadowfang Keep
EndScriptData */
-#include "ScriptedCreature.h"
#include "ScriptMgr.h"
-#include "InstanceScript.h"
#include "shadowfang_keep.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "Log.h"
+#include "Map.h"
+#include "ScriptedCreature.h"
#include "TemporarySummon.h"
#define MAX_ENCOUNTER 4
@@ -69,7 +72,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
{
@@ -214,7 +217,7 @@ public:
return str_data;
}
- void Load(const char* in) override
+ void Load(char const* in) override
{
if (!in)
{
diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp b/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp
index 077a5664b93..86ef68e8c4a 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 "ScriptedEscortAI.h"
#include "shadowfang_keep.h"
+#include "InstanceScript.h"
#include "Player.h"
+#include "ScriptedEscortAI.h"
+#include "ScriptedGossip.h"
+#include "SpellAuraEffects.h"
+#include "SpellScript.h"
/*######
## npc_shadowfang_prisoner
@@ -138,7 +138,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_shadowfang_prisonerAI>(creature);
+ return GetShadowfangKeepAI<npc_shadowfang_prisonerAI>(creature);
}
};
@@ -149,7 +149,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
@@ -312,7 +312,7 @@ class boss_archmage_arugal : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_archmage_arugalAI>(creature);
+ return GetShadowfangKeepAI<boss_archmage_arugalAI>(creature);
}
};
@@ -333,7 +333,7 @@ class spell_shadowfang_keep_haunting_spirits : public SpellScriptLoader
void HandleDummyTick(AuraEffect const* aurEff)
{
- GetTarget()->CastSpell((Unit*)NULL, aurEff->GetAmount(), true);
+ GetTarget()->CastSpell((Unit*)nullptr, aurEff->GetAmount(), true);
}
void HandleUpdatePeriodic(AuraEffect* aurEff)
diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.h b/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.h
index 7571f6f8fe3..3b2f6a7e105 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
@@ -31,4 +34,10 @@ enum SKDataTypes
DATA_APOTHECARY_HUMMEL = 6
};
+template <class AI, class T>
+inline AI* GetShadowfangKeepAI(T* obj)
+{
+ return GetInstanceAI<AI>(obj, 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..8824367fe4b 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,6 +24,7 @@ SDCategory: Stratholme
EndScriptData */
#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "ScriptedCreature.h"
#include "stratholme.h"
#include "Player.h"
@@ -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 e0edf1d189c..f55ed325148 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp
@@ -24,10 +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 "Log.h"
+#include "Map.h"
#include "Player.h"
+#include "stratholme.h"
enum Misc
{
@@ -43,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
{
@@ -349,7 +353,7 @@ class instance_stratholme : public InstanceMapScript
return saveStream.str();
}
- void Load(const char* in) override
+ void Load(char const* in) override
{
if (!in)
{
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp
index 7ce650779de..02cb2e71667 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp
@@ -31,12 +31,16 @@ npc_spectral_ghostly_citizen
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "GameObject.h"
#include "GameObjectAI.h"
-#include "stratholme.h"
#include "Group.h"
+#include "InstanceScript.h"
+#include "MotionMaster.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)
@@ -84,7 +88,7 @@ class go_gauntlet_gate : public GameObjectScript
GameObjectAI* GetAI(GameObject* go) const override
{
- return GetInstanceAI<go_gauntlet_gateAI>(go);
+ return GetStratholmeAI<go_gauntlet_gateAI>(go);
}
};
@@ -113,7 +117,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_restless_soulAI(creature);
+ return GetStratholmeAI<npc_restless_soulAI>(creature);
}
struct npc_restless_soulAI : public ScriptedAI
@@ -141,7 +145,7 @@ public:
void EnterCombat(Unit* /*who*/) override { }
- void SpellHit(Unit* caster, const SpellInfo* spell) override
+ void SpellHit(Unit* caster, SpellInfo const* spell) override
{
if (Tagged || spell->Id != SPELL_EGAN_BLASTER)
return;
@@ -206,7 +210,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_spectral_ghostly_citizenAI(creature);
+ return GetStratholmeAI<npc_spectral_ghostly_citizenAI>(creature);
}
struct npc_spectral_ghostly_citizenAI : public ScriptedAI
@@ -232,7 +236,7 @@ public:
void EnterCombat(Unit* /*who*/) override { }
- void SpellHit(Unit* /*caster*/, const SpellInfo* spell) override
+ void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
{
if (!Tagged && spell->Id == SPELL_EGAN_BLASTER)
Tagged = true;
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.h b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.h
index dd98843e6b5..e30d6feecdc 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,4 +84,10 @@ enum STRSpellIds
SPELL_BARON_ULTIMATUM = 27861
};
+template <class AI, class T>
+inline AI* GetStratholmeAI(T* obj)
+{
+ return GetInstanceAI<AI>(obj, 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 396d3f0c004..74d00fbc3ee 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
@@ -59,7 +61,7 @@ static Position const statuePositions[nStatues]
class instance_sunken_temple : public InstanceMapScript
{
public:
- instance_sunken_temple() : InstanceMapScript("instance_sunken_temple", 109) { }
+ instance_sunken_temple() : InstanceMapScript(STScriptName, 109) { }
InstanceScript* GetInstanceScript(InstanceMap* map) const override
{
@@ -176,14 +178,14 @@ 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);
}
void UseLastStatue(GameObject* go)
{
for (uint8 i = 0; i < nStatues; ++i)
- go->SummonGameObject(GO_ATALAI_LIGHT2, statuePositions[i], G3D::Quat(), 0);
+ go->SummonGameObject(GO_ATALAI_LIGHT2, statuePositions[i], QuaternionData(), 0);
go->SummonCreature(NPC_ATALALARION, atalalarianPos, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 7200);
}
diff --git a/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.cpp b/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.cpp
index a39f636ee86..f896f7ba17a 100644
--- a/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.cpp
+++ b/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.cpp
@@ -28,10 +28,13 @@ at_malfurion_Stormrage_trigger
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "GameObject.h"
#include "GameObjectAI.h"
-#include "sunken_temple.h"
+#include "InstanceScript.h"
+#include "Map.h"
#include "Player.h"
+#include "ScriptedCreature.h"
+#include "sunken_temple.h"
/*#####
# at_malfurion_Stormrage_trigger
@@ -49,7 +52,7 @@ class at_malfurion_stormrage : public AreaTriggerScript
public:
at_malfurion_stormrage() : AreaTriggerScript("at_malfurion_stormrage") { }
- bool OnTrigger(Player* player, const AreaTriggerEntry* /*at*/) override
+ bool OnTrigger(Player* player, AreaTriggerEntry const* /*at*/) override
{
if (player->GetInstanceScript() && !player->FindNearestCreature(NPC_MALFURION_STORMRAGE, 15.0f) &&
player->GetQuestStatus(QUEST_THE_CHARGE_OF_DRAGONFLIGHTS) == QUEST_STATUS_REWARDED && player->GetQuestStatus(QUEST_ERANIKUS_TYRANT_OF_DREAMS) != QUEST_STATUS_REWARDED)
@@ -82,7 +85,7 @@ class go_atalai_statue : public GameObjectScript
GameObjectAI* GetAI(GameObject* go) const override
{
- return GetInstanceAI<go_atalai_statueAI>(go);
+ return GetSunkenTempleAI<go_atalai_statueAI>(go);
}
};
diff --git a/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.h b/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.h
index c6c2f087850..f2687c5de68 100644
--- a/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.h
+++ b/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.h
@@ -19,6 +19,9 @@
#ifndef DEF_SUNKEN_TEMPLE_H
#define DEF_SUNKEN_TEMPLE_H
+#include "CreatureAIImpl.h"
+
+#define STScriptName "instance_sunken_temple"
#define DataHeader "ST"
enum STEvents
@@ -26,4 +29,10 @@ enum STEvents
EVENT_STATE = 1
};
+template <class AI, class T>
+inline AI* GetSunkenTempleAI(T* obj)
+{
+ return GetInstanceAI<AI>(obj, STScriptName);
+}
+
#endif
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp
index 924d00169c8..66ef84c2273 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp
@@ -23,6 +23,8 @@ SDComment: Find a way to start the intro, best code for the intro
EndScriptData */
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "Log.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 195fc2bf0a9..51aad495c37 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp
@@ -16,9 +16,10 @@
*/
#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "ScriptedCreature.h"
-#include "sunwell_plateau.h"
#include "SpellInfo.h"
+#include "sunwell_plateau.h"
enum Quotes
{
@@ -160,7 +161,7 @@ public:
me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
}
- void SpellHitTarget(Unit* target, const SpellInfo* spell) override
+ void SpellHitTarget(Unit* target, SpellInfo const* spell) override
{
switch (spell->Id)
{
@@ -266,8 +267,8 @@ public:
if (ShadowimageTimer <= diff)
{
- Unit* target = NULL;
- Creature* temp = NULL;
+ Unit* target = nullptr;
+ Creature* temp = nullptr;
for (uint8 i = 0; i<3; ++i)
{
target = SelectTarget(SELECT_TARGET_RANDOM, 0);
@@ -436,7 +437,7 @@ public:
me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
}
- void SpellHitTarget(Unit* target, const SpellInfo* spell) override
+ void SpellHitTarget(Unit* target, SpellInfo const* spell) override
{
switch (spell->Id)
{
@@ -673,7 +674,7 @@ public:
void EnterCombat(Unit* /*who*/) override { }
- void SpellHitTarget(Unit* target, const SpellInfo* spell) override
+ void SpellHitTarget(Unit* target, SpellInfo const* spell) override
{
switch (spell->Id)
{
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp
index aa5720bef4e..045f6d956bb 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp
@@ -22,12 +22,14 @@ 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 "MotionMaster.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
#include "sunwell_plateau.h"
+#include "TemporarySummon.h"
enum Yells
{
@@ -196,7 +198,7 @@ public:
instance->SetBossState(DATA_FELMYST, DONE);
}
- void SpellHit(Unit* caster, const SpellInfo* spell) override
+ void SpellHit(Unit* caster, SpellInfo const* spell) override
{
// workaround for linked aura
/*if (spell->Id == SPELL_VAPOR_FORCE)
@@ -215,7 +217,7 @@ public:
summon->CastSpell(summon, SPELL_FOG_CHARM, true);
summon->CastSpell(summon, SPELL_FOG_CHARM2, true);
}
- me->DealDamage(caster, caster->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
+ me->DealDamage(caster, caster->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
}
}
@@ -360,7 +362,7 @@ public:
}
case 6:
me->SetFacingTo(me->GetAngle(breathX, breathY));
- //DoTextEmote("takes a deep breath.", NULL);
+ //DoTextEmote("takes a deep breath.", nullptr);
events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 10000);
break;
case 7:
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp
index 83c8281a036..f6c02074774 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp
@@ -24,10 +24,17 @@ SDCategory: Sunwell_Plateau
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "GameObject.h"
#include "GameObjectAI.h"
-#include "sunwell_plateau.h"
+#include "InstanceScript.h"
+#include "Log.h"
+#include "Map.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "ScriptedCreature.h"
+#include "sunwell_plateau.h"
+#include "TemporarySummon.h"
#include "WorldSession.h"
enum Yells
@@ -548,7 +555,7 @@ public:
{
#if MAX_PLAYERS_IN_SPECTRAL_REALM > 0
uint8 SpectralPlayers = 0;
- Map::PlayerList const &PlayerList = go->GetMap()->GetPlayers();
+ Map::PlayerList const& PlayerList = go->GetMap()->GetPlayers();
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
{
if (i->GetSource() && i->GetSource()->GetPositionZ() < DEMON_REALM_Z + 5)
@@ -685,7 +692,7 @@ public:
void TeleportAllPlayersBack()
{
- Map::PlayerList const &playerList = me->GetMap()->GetPlayers();
+ Map::PlayerList const& playerList = me->GetMap()->GetPlayers();
Position const& homePos = me->GetHomePosition();
for (Map::PlayerList::const_iterator itr = playerList.begin(); itr != playerList.end(); ++itr)
{
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp
index 08bd7809f8e..4e841a82e14 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp
@@ -25,11 +25,16 @@ EndScriptData */
/// @todo rewrite Armageddon
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "GameObject.h"
#include "GameObjectAI.h"
-#include "sunwell_plateau.h"
-#include <math.h>
+#include "InstanceScript.h"
+#include "Log.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "ScriptedCreature.h"
+#include "sunwell_plateau.h"
+#include "TemporarySummon.h"
/*** Speech and sounds***/
enum Yells
@@ -280,7 +285,7 @@ public:
return ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_4));
}
- return NULL;
+ return nullptr;
}
void ResetOrbs()
@@ -701,7 +706,7 @@ public:
case TIMER_SPEECH:
if (SpeechBegins)
{
- SpeechBegins=false;
+ SpeechBegins = false;
switch (Phase)
{
case PHASE_NORMAL:
@@ -744,7 +749,7 @@ public:
case TIMER_LEGION_LIGHTNING:
if (!me->IsNonMeleeSpellCast(false))
{
- Unit* pRandomPlayer = NULL;
+ Unit* pRandomPlayer = nullptr;
me->RemoveAurasDueToSpell(SPELL_SOUL_FLAY);
for (uint8 z = 0; z < 6; ++z)
@@ -839,7 +844,7 @@ public:
TimerIsDeactivated[TIMER_ORBS_EMPOWER] = true;
break;
case TIMER_ARMAGEDDON: //Phase 4
- Unit* target = NULL;
+ Unit* target = nullptr;
for (uint8 z = 0; z < 6; ++z)
{
target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true);
@@ -987,7 +992,7 @@ public:
{
if (Creature* pPortal = DoSpawnCreature(NPC_FELFIRE_PORTAL, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN, 20000))
{
- ThreatContainer::StorageType const &threatlist = me->getThreatManager().getThreatList();
+ ThreatContainer::StorageType const& threatlist = me->getThreatManager().getThreatList();
for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
{
Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid());
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp
index fed97fc8488..f0bcb9dd3de 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 "SpellAuras.h"
#include "SpellScript.h"
-#include "SpellAuraEffects.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 17325e9e00f..6b3c2b1bcaf 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp
@@ -17,6 +17,8 @@
#include "ScriptMgr.h"
#include "InstanceScript.h"
+#include "Log.h"
+#include "Map.h"
#include "Player.h"
#include "sunwell_plateau.h"
@@ -89,7 +91,7 @@ class instance_sunwell_plateau : public InstanceMapScript
else
TC_LOG_DEBUG("scripts", "Instance Sunwell Plateau: GetPlayerInMap, but PlayerList is empty!");
- return NULL;
+ return nullptr;
}
ObjectGuid GetGuidData(uint32 id) const override
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.h b/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.h
index a25ed5b0ca2..cec43582958 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,7 +114,7 @@ enum SWPGameObjectIds
GO_MURUS_GATE_2 = 188118
};
-template<class AI, class T>
+template <class AI, class T>
AI* GetSunwellPlateauAI(T* obj)
{
return GetInstanceAI<AI>(obj, 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 af8ef8f4f39..c96d86aff57 100644
--- a/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp
+++ b/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp
@@ -27,10 +27,14 @@ On his death the vault door opens.
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "GameObject.h"
#include "GameObjectAI.h"
-#include "uldaman.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "ScriptedCreature.h"
+#include "SpellInfo.h"
+#include "uldaman.h"
enum Says
{
@@ -125,10 +129,10 @@ class boss_archaedas : public CreatureScript
me->SetControlled(false, UNIT_STATE_ROOT);
}
- void SpellHit(Unit* /*caster*/, const SpellInfo* spell) override
+ void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
{
// Being woken up from the altar, start the awaken sequence
- if (spell == sSpellMgr->GetSpellInfo(SPELL_ARCHAEDAS_AWAKEN))
+ if (spell->Id == SPELL_ARCHAEDAS_AWAKEN)
{
Talk(SAY_AGGRO);
iAwakenTimer = 4000;
@@ -212,7 +216,7 @@ class boss_archaedas : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_archaedasAI>(creature);
+ return GetUldamanAI<boss_archaedasAI>(creature);
}
};
@@ -276,10 +280,10 @@ class npc_archaedas_minions : public CreatureScript
bAmIAwake = true;
}
- void SpellHit(Unit * /*caster*/, const SpellInfo* spell) override
+ void SpellHit(Unit * /*caster*/, SpellInfo const* spell) override
{
// time to wake up, start animation
- if (spell == sSpellMgr->GetSpellInfo(SPELL_ARCHAEDAS_AWAKEN))
+ if (spell->Id == SPELL_ARCHAEDAS_AWAKEN)
{
iAwakenTimer = 5000;
bWakingUp = true;
@@ -318,7 +322,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);
}
};
@@ -381,7 +385,7 @@ class npc_stonekeepers : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_stonekeepersAI>(creature);
+ return GetUldamanAI<npc_stonekeepersAI>(creature);
}
};
@@ -414,7 +418,7 @@ class go_altar_of_archaedas : public GameObjectScript
GameObjectAI* GetAI(GameObject* go) const override
{
- return GetInstanceAI<go_altar_of_archaedasAI>(go);
+ return GetUldamanAI<go_altar_of_archaedasAI>(go);
}
};
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 360794facf6..a72acba44b3 100644
--- a/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp
+++ b/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp
@@ -24,8 +24,14 @@ SDCategory: Uldaman
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "Creature.h"
+#include "CreatureAI.h"
+#include "GameObject.h"
#include "InstanceScript.h"
+#include "Log.h"
+#include "Map.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "uldaman.h"
enum Spells
@@ -51,7 +57,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
{
@@ -416,7 +422,7 @@ class instance_uldaman : public InstanceMapScript
return str_data;
}
- void Load(const char* in) override
+ void Load(char const* in) override
{
if (!in)
{
diff --git a/src/server/scripts/EasternKingdoms/Uldaman/uldaman.cpp b/src/server/scripts/EasternKingdoms/Uldaman/uldaman.cpp
index 14fb5a06d43..9c84b399e43 100644
--- a/src/server/scripts/EasternKingdoms/Uldaman/uldaman.cpp
+++ b/src/server/scripts/EasternKingdoms/Uldaman/uldaman.cpp
@@ -30,10 +30,12 @@ at_map_chamber
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "GameObject.h"
#include "GameObjectAI.h"
-#include "uldaman.h"
+#include "InstanceScript.h"
#include "Player.h"
+#include "ScriptedCreature.h"
+#include "uldaman.h"
/*######
## npc_jadespine_basilisk
@@ -107,7 +109,7 @@ class npc_jadespine_basilisk : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_jadespine_basiliskAI(creature);
+ return GetUldamanAI<npc_jadespine_basiliskAI>(creature);
}
};
@@ -135,7 +137,7 @@ class go_keystone_chamber : public GameObjectScript
GameObjectAI* GetAI(GameObject* go) const override
{
- return GetInstanceAI<go_keystone_chamberAI>(go);
+ return GetUldamanAI<go_keystone_chamberAI>(go);
}
};
diff --git a/src/server/scripts/EasternKingdoms/Uldaman/uldaman.h b/src/server/scripts/EasternKingdoms/Uldaman/uldaman.h
index 0578da35895..d81793cf61c 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 <class AI, class T>
+inline AI* GetUldamanAI(T* obj)
+{
+ return GetInstanceAI<AI>(obj, UldamanScriptName);
+}
+
#endif
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp
index 1ab0ea8908c..f1b6c993a41 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp
@@ -26,13 +26,14 @@ SQLUpdate:
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "GridNotifiers.h"
-#include "GridNotifiersImpl.h"
-#include "Cell.h"
#include "CellImpl.h"
-#include "zulaman.h"
+#include "GridNotifiersImpl.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
+#include "TemporarySummon.h"
#include "Weather.h"
+#include "zulaman.h"
enum Spells
{
@@ -170,7 +171,7 @@ class boss_akilzon : public CreatureScript
if (Unit* target = (*i))
{
if (Cloud && !Cloud->IsWithinDist(target, 6, false))
- Cloud->CastCustomSpell(target, SPELL_ZAP, &bp0, NULL, NULL, true, 0, 0, me->GetGUID());
+ Cloud->CastCustomSpell(target, SPELL_ZAP, &bp0, nullptr, nullptr, true, 0, 0, me->GetGUID());
}
}
@@ -189,7 +190,7 @@ class boss_akilzon : public CreatureScript
trigger->SetHealth(100000);
trigger->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
if (Cloud)
- Cloud->CastCustomSpell(trigger, /*43661*/SPELL_ZAP, &bp0, NULL, NULL, true, 0, 0, Cloud->GetGUID());
+ Cloud->CastCustomSpell(trigger, /*43661*/SPELL_ZAP, &bp0, nullptr, nullptr, true, 0, 0, Cloud->GetGUID());
}
}
}
@@ -203,7 +204,7 @@ class boss_akilzon : public CreatureScript
me->InterruptNonMeleeSpells(false);
CloudGUID.Clear();
if (Cloud)
- Cloud->DealDamage(Cloud, Cloud->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
+ Cloud->DealDamage(Cloud, Cloud->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
SetWeather(WEATHER_STATE_FINE, 0.0f);
isRaining = false;
}
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp
index 618190f750c..9443c9a9e6a 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp
@@ -17,9 +17,11 @@
*/
#include "ScriptMgr.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
-#include "zulaman.h"
#include "SpellInfo.h"
+#include "zulaman.h"
enum Spells
{
@@ -134,7 +136,7 @@ class boss_halazzi : public CreatureScript
damage = 0;
}
- void SpellHit(Unit*, const SpellInfo* spell) override
+ void SpellHit(Unit*, SpellInfo const* spell) override
{
if (spell->Id == SPELL_TRANSFORM_SPLIT2)
EnterPhase(PHASE_HUMAN);
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp
index 95600a06d36..ead3781d89b 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp
@@ -24,9 +24,12 @@ SDCategory: Zul'Aman
EndScriptData */
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
-#include "SpellAuraEffects.h"
+#include "TemporarySummon.h"
#include "zulaman.h"
enum Yells
@@ -328,7 +331,7 @@ class boss_hexlord_malacrass : public CreatureScript
{
Unit* Temp = ObjectAccessor::GetUnit(*me, AddGUID[i]);
if (Temp && Temp->IsAlive())
- Temp->DealDamage(Temp, Temp->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
+ Temp->DealDamage(Temp, Temp->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
}
}
@@ -471,7 +474,7 @@ class boss_hexlord_malacrass : public CreatureScript
void UseAbility()
{
uint8 random = urand(0, 2);
- Unit* target = NULL;
+ Unit* target = nullptr;
switch (PlayerAbility[PlayerClass][random].target)
{
case ABILITY_TARGET_SELF:
@@ -1015,15 +1018,13 @@ 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)
{
if (Unit* caster = GetCaster())
- caster->CastSpell(dispelInfo->GetDispeller(), SPELL_WL_UNSTABLE_AFFL_DISPEL, true, NULL, GetEffect(EFFECT_0));
+ caster->CastSpell(dispelInfo->GetDispeller(), SPELL_WL_UNSTABLE_AFFL_DISPEL, true, nullptr, GetEffect(EFFECT_0));
}
void Register() override
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp
index 91978d052ad..90c0516da52 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp
@@ -24,10 +24,14 @@ SDCategory: Zul'Aman
EndScriptData */
#include "ScriptMgr.h"
+#include "CellImpl.h"
+#include "GridNotifiers.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
+#include "TemporarySummon.h"
#include "zulaman.h"
-#include "GridNotifiers.h"
-#include "CellImpl.h"
enum Yells
{
@@ -194,7 +198,7 @@ class boss_janalai : public CreatureScript
void FireWall()
{
uint8 WallNum;
- Creature* wall = NULL;
+ Creature* wall = nullptr;
for (uint8 i = 0; i < 4; ++i)
{
if (i == 0 || i == 2)
@@ -366,7 +370,7 @@ class boss_janalai : public CreatureScript
if (!map->IsDungeon())
return;
- Map::PlayerList const &PlayerList = map->GetPlayers();
+ Map::PlayerList const& PlayerList = map->GetPlayers();
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
if (Player* i_pl = i->GetSource())
if (i_pl->IsAlive())
@@ -441,7 +445,7 @@ class npc_janalai_firebomb : public CreatureScript
void Reset() override { }
- void SpellHit(Unit* /*caster*/, const SpellInfo* spell) override
+ void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_FIRE_BOMB_THROW)
DoCast(me, SPELL_FIRE_BOMB_DUMMY, true);
@@ -667,7 +671,7 @@ class npc_janalai_egg : public CreatureScript
void UpdateAI(uint32 /*diff*/) override { }
- void SpellHit(Unit* /*caster*/, const SpellInfo* spell) override
+ void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_HATCH_EGG)
DoCast(SPELL_SUMMON_HATCHLING);
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp
index e2acc47d651..559390fece3 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp
@@ -24,11 +24,11 @@ SDCategory: Zul'Aman
EndScriptData */
#include "ScriptMgr.h"
+#include "CellImpl.h"
+#include "GridNotifiersImpl.h"
+#include "MotionMaster.h"
#include "ScriptedCreature.h"
#include "zulaman.h"
-#include "GridNotifiers.h"
-#include "GridNotifiersImpl.h"
-#include "CellImpl.h"
enum Yells
{
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp
index 10d0772932c..1ebecc41b4b 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp
@@ -23,9 +23,12 @@ SDComment:
EndScriptData */
#include "ScriptMgr.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
-#include "zulaman.h"
#include "SpellInfo.h"
+#include "TemporarySummon.h"
+#include "zulaman.h"
enum Says
{
@@ -580,7 +583,7 @@ class npc_zuljin_vortex : public CreatureScript
void EnterCombat(Unit* /*target*/) override { }
- void SpellHit(Unit* caster, const SpellInfo* spell) override
+ void SpellHit(Unit* caster, SpellInfo const* spell) override
{
if (spell->Id == SPELL_ZAP_INFORM)
DoCast(caster, SPELL_ZAP_DAMAGE, true);
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp b/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp
index f0eb8ef7911..0c972756a72 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp
@@ -24,10 +24,13 @@ SDCategory: Zul'Aman
EndScriptData */
#include "ScriptMgr.h"
+#include "GameObject.h"
#include "InstanceScript.h"
-#include "zulaman.h"
+#include "Log.h"
+#include "Map.h"
#include "Player.h"
#include "TemporarySummon.h"
+#include "zulaman.h"
enum Misc
{
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp
index affb1ab9406..9598940bbd4 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp
@@ -28,12 +28,15 @@ npc_forest_frog
EndContentData */
#include "ScriptMgr.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
+#include "Player.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
-#include "zulaman.h"
-#include "Player.h"
#include "SpellInfo.h"
#include "SpellScript.h"
+#include "zulaman.h"
/*######
## npc_forest_frog
@@ -103,7 +106,7 @@ class npc_forest_frog : public CreatureScript
me->UpdateEntry(cEntry);
}
- void SpellHit(Unit* caster, const SpellInfo* spell) override
+ void SpellHit(Unit* caster, SpellInfo const* spell) override
{
if (spell->Id == SPELL_REMOVE_AMANI_CURSE && caster->GetTypeId() == TYPEID_PLAYER && me->GetEntry() == NPC_FOREST_FROG)
{
@@ -171,7 +174,7 @@ class npc_zulaman_hostage : public CreatureScript
{
if (HostageEntry[i] == entry)
{
- me->SummonGameObject(ChestEntry[i], Position(x - 2, y, z, 0.f), G3D::Quat(), 0);
+ me->SummonGameObject(ChestEntry[i], Position(x - 2, y, z, 0.f), QuaternionData(), 0);
break;
}
}
@@ -292,7 +295,7 @@ class npc_harrison_jones : public CreatureScript
return false;
}
- void SpellHit(Unit*, const SpellInfo* spell) override
+ void SpellHit(Unit*, SpellInfo const* spell) override
{
if (spell->Id == SPELL_COSMETIC_SPEAR_THROW)
{
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.h b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.h
index 99988310544..ae1323af6aa 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.h
+++ b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.h
@@ -19,6 +19,8 @@
#ifndef DEF_ZULAMAN_H
#define DEF_ZULAMAN_H
+#include "CreatureAIImpl.h"
+
#define ZulamanScriptName "instance_zulaman"
#define DataHeader "ZA"
@@ -65,10 +67,10 @@ enum ZAGameObjectIds
GO_STRANGE_GONG = 187359
};
-template <class AI>
-inline AI* GetZulAmanAI(Creature* creature)
+template <class AI, class T>
+inline AI* GetZulAmanAI(T* obj)
{
- return GetInstanceAI<AI>(creature, ZulamanScriptName);
+ return GetInstanceAI<AI>(obj, ZulamanScriptName);
}
#endif
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp
index 40a1836d46a..8946edbe809 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp
@@ -25,8 +25,12 @@ TCCategory: Zul'Gurub
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "GameObject.h"
#include "GameObjectAI.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
+#include "MotionMaster.h"
+#include "ScriptedCreature.h"
#include "SpellInfo.h"
#include "zulgurub.h"
@@ -240,7 +244,7 @@ class boss_arlokk : public CreatureScript
me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(EQUIP_UNEQUIP));
me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, uint32(EQUIP_UNEQUIP));
/*
- const CreatureTemplate* cinfo = me->GetCreatureTemplate();
+ CreatureTemplate const* cinfo = me->GetCreatureTemplate();
me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 35)));
me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 35)));
me->UpdateDamagePhysical(BASE_ATTACK);
@@ -288,7 +292,7 @@ class boss_arlokk : public CreatureScript
me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(WEAPON_DAGGER));
me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, uint32(WEAPON_DAGGER));
/*
- const CreatureTemplate* cinfo = me->GetCreatureTemplate();
+ CreatureTemplate const* cinfo = me->GetCreatureTemplate();
me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg));
me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg));
me->UpdateDamagePhysical(BASE_ATTACK);
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp
index a32e2fba7c0..f29babec4fe 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp
@@ -108,7 +108,7 @@ class boss_gahzranka : public CreatureScript // gahzranka
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_gahzrankaAI(creature);
+ return GetZulGurubAI<boss_gahzrankaAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_grilek.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_grilek.cpp
index cb3859bf94e..4a6feab82eb 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_grilek.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_grilek.cpp
@@ -109,7 +109,7 @@ class boss_grilek : public CreatureScript // grilek
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_hakkar.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp
index fb573604e74..16c8154af87 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp
@@ -23,6 +23,7 @@ Category: Zul'Gurub
*/
#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "ScriptedCreature.h"
#include "zulgurub.h"
@@ -173,7 +174,7 @@ class boss_hakkar : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_hakkarAI>(creature);
+ return GetZulGurubAI<boss_hakkarAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_hazzarah.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hazzarah.cpp
index ac223fff71f..6b0c75b9cc3 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_hazzarah.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hazzarah.cpp
@@ -25,6 +25,7 @@ EndScriptData */
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
+#include "TemporarySummon.h"
#include "zulgurub.h"
enum Spells
@@ -114,7 +115,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_jeklik.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp
index ab62c42ab18..63d6388d497 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp
@@ -17,6 +17,7 @@
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
+#include "TemporarySummon.h"
#include "zulgurub.h"
enum Says
@@ -257,7 +258,7 @@ class npc_batrider : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_batriderAI(creature);
+ return GetZulGurubAI<npc_batriderAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp
index a849a680621..2c6ebefd1cb 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp
@@ -17,7 +17,10 @@
*/
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
+#include "TemporarySummon.h"
#include "zulgurub.h"
enum Say
@@ -164,7 +167,7 @@ class boss_jindo : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_jindoAI(creature);
+ return GetZulGurubAI<boss_jindoAI>(creature);
}
};
@@ -213,7 +216,7 @@ class npc_healing_ward : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_healing_wardAI>(creature);
+ return GetZulGurubAI<npc_healing_wardAI>(creature);
}
};
@@ -260,7 +263,7 @@ class npc_shade_of_jindo : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_shade_of_jindoAI(creature);
+ return GetZulGurubAI<npc_shade_of_jindoAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp
index e30fe8861f2..17027e2d056 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp
@@ -24,10 +24,13 @@ SDCategory: Zul'Gurub
EndScriptData */
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
-#include "Spell.h"
#include "SpellAuras.h"
#include "SpellScript.h"
+#include "TemporarySummon.h"
#include "zulgurub.h"
enum Says
@@ -429,7 +432,7 @@ class npc_vilebranch_speaker : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_vilebranch_speakerAI>(creature);
+ return GetZulGurubAI<npc_vilebranch_speakerAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp
index 03bc99d177a..9537aaec3e5 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp
@@ -25,6 +25,7 @@ EndScriptData */
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
+#include "TemporarySummon.h"
#include "zulgurub.h"
enum Says
@@ -168,7 +169,7 @@ class boss_marli : public CreatureScript
}
case EVENT_CHARGE_PLAYER:
{
- Unit* target = NULL;
+ Unit* target = nullptr;
int i = 0;
while (i++ < 3) // max 3 tries to get a random target with power_mana
{
@@ -216,7 +217,7 @@ class boss_marli : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_marliAI(creature);
+ return GetZulGurubAI<boss_marliAI>(creature);
}
};
@@ -265,7 +266,7 @@ class npc_spawn_of_marli : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_spawn_of_marliAI(creature);
+ return GetZulGurubAI<npc_spawn_of_marliAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp
index 502630a8a89..351445c0c62 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp
@@ -165,7 +165,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_thekal.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp
index ac4d6d9e96f..7e6a9970629 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp
@@ -24,6 +24,8 @@ SDCategory: Zul'Gurub
EndScriptData */
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
#include "zulgurub.h"
@@ -164,7 +166,7 @@ class boss_thekal : public CreatureScript
me->SetStandState(UNIT_STAND_STATE_STAND);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
/*
- const CreatureTemplate* cinfo = me->GetCreatureTemplate();
+ CreatureTemplate const* cinfo = me->GetCreatureTemplate();
me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 40)));
me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 40)));
me->UpdateDamagePhysical(BASE_ATTACK);
@@ -257,7 +259,7 @@ class boss_thekal : public CreatureScript
me->SetStandState(UNIT_STAND_STATE_SLEEP);
me->AttackStop();
instance->SetBossState(DATA_THEKAL, SPECIAL);
- WasDead=true;
+ WasDead = true;
}
if (me->HasUnitState(UNIT_STATE_CASTING))
@@ -269,7 +271,7 @@ class boss_thekal : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_thekalAI>(creature);
+ return GetZulGurubAI<boss_thekalAI>(creature);
}
};
@@ -422,7 +424,7 @@ class npc_zealot_lorkhan : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_zealot_lorkhanAI>(creature);
+ return GetZulGurubAI<npc_zealot_lorkhanAI>(creature);
}
};
@@ -572,7 +574,7 @@ class npc_zealot_zath : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_zealot_zathAI>(creature);
+ return GetZulGurubAI<npc_zealot_zathAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp
index caa4587aaa1..e8b0b59d317 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp
@@ -275,7 +275,7 @@ class boss_venoxis : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_venoxisAI(creature);
+ return GetZulGurubAI<boss_venoxisAI>(creature);
}
};
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_wushoolay.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_wushoolay.cpp
index 750b6d2246a..44500347ca2 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_wushoolay.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_wushoolay.cpp
@@ -101,7 +101,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 b1b7869f4a9..b9ec02029f1 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp
@@ -24,7 +24,10 @@ SDCategory: Zul'Gurub
EndScriptData */
#include "ScriptMgr.h"
+#include "Creature.h"
+#include "GameObject.h"
#include "InstanceScript.h"
+#include "Map.h"
#include "zulgurub.h"
DoorData const doorData[] =
@@ -79,11 +82,10 @@ class instance_zulgurub : public InstanceMapScript
void OnGameObjectCreate(GameObject* go) override
{
+ InstanceScript::OnGameObjectCreate(go);
+
switch (go->GetEntry())
{
- case GO_FORCEFIELD:
- AddDoor(go, true);
- break;
case GO_GONG_OF_BETHEKK:
_goGongOfBethekkGUID = go->GetGUID();
if (GetBossState(DATA_ARLOKK) == DONE)
@@ -96,18 +98,6 @@ class instance_zulgurub : public InstanceMapScript
}
}
- void OnGameObjectRemove(GameObject* go) override
- {
- switch (go->GetEntry())
- {
- case GO_FORCEFIELD:
- AddDoor(go, false);
- break;
- default:
- break;
- }
- }
-
ObjectGuid GetGuidData(uint32 uiData) const override
{
switch (uiData)
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/zulgurub.h b/src/server/scripts/EasternKingdoms/ZulGurub/zulgurub.h
index 4148b4d9e08..b2adf8cfe04 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/zulgurub.h
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/zulgurub.h
@@ -18,12 +18,13 @@
#ifndef DEF_ZULGURUB_H
#define DEF_ZULGURUB_H
+#include "CreatureAIImpl.h"
+
+#define ZGScriptName "instance_zulgurub"
#define DataHeader "ZG"
uint32 const EncounterCount = 13;
-#define ZGScriptName "instance_zulgurub"
-
enum ZGDataTypes
{
DATA_JEKLIK = 0, // Main boss
@@ -67,8 +68,8 @@ enum ZGGameObjectIds
GO_GONG_OF_BETHEKK = 180526 // Arlokk Event
};
-template<class AI, class T>
-AI* GetZulGurubAI(T* obj)
+template <class AI, class T>
+inline AI* GetZulGurubAI(T* obj)
{
return GetInstanceAI<AI>(obj, ZGScriptName);
}
diff --git a/src/server/scripts/EasternKingdoms/zone_blasted_lands.cpp b/src/server/scripts/EasternKingdoms/zone_blasted_lands.cpp
index 2e4fd37554d..ae5435aa571 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 */)
@@ -59,7 +57,7 @@ class spell_razelikh_teleport_group : public SpellScriptLoader
{
if (Group* group = player->GetGroup())
{
- for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
+ for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
if (Player* member = itr->GetSource())
if (member->IsWithinDistInMap(player, 20.0f) && !member->isDead())
member->CastSpell(member, SPELL_TELEPORT_SINGLE_IN_GROUP, true);
diff --git a/src/server/scripts/EasternKingdoms/zone_duskwood.cpp b/src/server/scripts/EasternKingdoms/zone_duskwood.cpp
index e521a3d1bb7..f350efd6396 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
{
@@ -146,7 +147,7 @@ class at_twilight_grove : public AreaTriggerScript
public:
at_twilight_grove() : AreaTriggerScript("at_twilight_grove") { }
- bool OnTrigger(Player* player, const AreaTriggerEntry* /*at*/) override
+ bool OnTrigger(Player* player, AreaTriggerEntry const* /*at*/) override
{
if (player->GetQuestStatus(QUEST_NIGHTMARES_CORRUPTION) == QUEST_STATUS_INCOMPLETE)
if (!player->FindNearestCreature(NPC_TWILIGHT_CORRUPTER, 500.0f, true))
diff --git a/src/server/scripts/EasternKingdoms/zone_ghostlands.cpp b/src/server/scripts/EasternKingdoms/zone_ghostlands.cpp
index edf1d87c677..5a8197d8f5f 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"
/*######
diff --git a/src/server/scripts/EasternKingdoms/zone_hinterlands.cpp b/src/server/scripts/EasternKingdoms/zone_hinterlands.cpp
index 5f7f56eee8e..af79fd66ea5 100644
--- a/src/server/scripts/EasternKingdoms/zone_hinterlands.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_hinterlands.cpp
@@ -29,9 +29,10 @@ npc_rinji
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedEscortAI.h"
+#include "GameObject.h"
+#include "MotionMaster.h"
#include "Player.h"
+#include "ScriptedEscortAI.h"
/*######
## npc_oox09hl
diff --git a/src/server/scripts/EasternKingdoms/zone_silverpine_forest.cpp b/src/server/scripts/EasternKingdoms/zone_silverpine_forest.cpp
index 20b628e95d8..bc0f6ea959f 100644
--- a/src/server/scripts/EasternKingdoms/zone_silverpine_forest.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_silverpine_forest.cpp
@@ -29,9 +29,11 @@ pyrewood_ambush
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "CreatureAIImpl.h"
#include "ScriptedEscortAI.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "TemporarySummon.h"
/*######
## npc_deathstalker_erland
@@ -224,7 +226,7 @@ public:
{
if (Creature* summoned = me->SummonCreature(creatureId, PyrewoodSpawnPoints[position][0], PyrewoodSpawnPoints[position][1], PyrewoodSpawnPoints[position][2], PyrewoodSpawnPoints[position][3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000))
{
- Unit* target = NULL;
+ Unit* target = nullptr;
if (PlayerGUID)
if (Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID))
if (player->IsAlive() && RAND(0, 1))
diff --git a/src/server/scripts/EasternKingdoms/zone_stormwind_city.cpp b/src/server/scripts/EasternKingdoms/zone_stormwind_city.cpp
index dab69c434e6..d883f282549 100644
--- a/src/server/scripts/EasternKingdoms/zone_stormwind_city.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_stormwind_city.cpp
@@ -32,10 +32,12 @@ npc_lord_gregor_lescovar
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
-#include "ScriptedEscortAI.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "ScriptedEscortAI.h"
+#include "ScriptedGossip.h"
+#include "TemporarySummon.h"
/*######
## npc_bartleby
diff --git a/src/server/scripts/EasternKingdoms/zone_stranglethorn_vale.cpp b/src/server/scripts/EasternKingdoms/zone_stranglethorn_vale.cpp
index 4fd9fa4d865..edcfc78d510 100644
--- a/src/server/scripts/EasternKingdoms/zone_stranglethorn_vale.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_stranglethorn_vale.cpp
@@ -68,7 +68,7 @@ public:
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE);
}
- void SpellHit(Unit* caster, const SpellInfo* spell) override
+ void SpellHit(Unit* caster, SpellInfo const* spell) override
{
if (bReset || spell->Id != 3607)
return;
diff --git a/src/server/scripts/EasternKingdoms/zone_swamp_of_sorrows.cpp b/src/server/scripts/EasternKingdoms/zone_swamp_of_sorrows.cpp
index 5cd85585a9d..e0396397889 100644
--- a/src/server/scripts/EasternKingdoms/zone_swamp_of_sorrows.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_swamp_of_sorrows.cpp
@@ -17,9 +17,10 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedEscortAI.h"
+#include "GameObject.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "ScriptedEscortAI.h"
/*######
## npc_galen_goodward
@@ -74,11 +75,11 @@ public:
{
switch (uiPointId)
{
- case 0:
+ case 0:
{
- GameObject* cage = NULL;
+ GameObject* cage = nullptr;
if (galensCageGUID)
- cage = me->GetMap()->GetGameObject(galensCageGUID);
+ cage = ObjectAccessor::GetGameObject(*me, galensCageGUID);
else
cage = GetClosestGameObjectWithEntry(me, GO_GALENS_CAGE, INTERACTION_DISTANCE);
if (cage)
@@ -88,9 +89,9 @@ public:
}
break;
}
- case 21:
- Talk(EMOTE_DISAPPEAR);
- break;
+ case 21:
+ Talk(EMOTE_DISAPPEAR);
+ break;
}
}
@@ -99,7 +100,7 @@ public:
switch (waypointId)
{
case 0:
- if (GameObject* cage = me->GetMap()->GetGameObject(galensCageGUID))
+ if (GameObject* cage = ObjectAccessor::GetGameObject(*me, galensCageGUID))
cage->ResetDoorOrButton();
break;
case 20:
diff --git a/src/server/scripts/EasternKingdoms/zone_tirisfal_glades.cpp b/src/server/scripts/EasternKingdoms/zone_tirisfal_glades.cpp
index a8d6b67b718..19833db218c 100644
--- a/src/server/scripts/EasternKingdoms/zone_tirisfal_glades.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_tirisfal_glades.cpp
@@ -30,9 +30,11 @@ go_mausoleum_trigger
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "GameObject.h"
#include "GameObjectAI.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "ScriptedCreature.h"
/*######
## npc_calvin_montague
diff --git a/src/server/scripts/EasternKingdoms/zone_undercity.cpp b/src/server/scripts/EasternKingdoms/zone_undercity.cpp
index 9524e341b1c..37fe5cec1f9 100644
--- a/src/server/scripts/EasternKingdoms/zone_undercity.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_undercity.cpp
@@ -30,9 +30,11 @@ npc_parqual_fintallas
EndContentData */
#include "ScriptMgr.h"
+#include "MotionMaster.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/EasternKingdoms/zone_western_plaguelands.cpp b/src/server/scripts/EasternKingdoms/zone_western_plaguelands.cpp
index 5839d40c15f..7ba95268562 100644
--- a/src/server/scripts/EasternKingdoms/zone_western_plaguelands.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_western_plaguelands.cpp
@@ -153,7 +153,7 @@ public:
void DoDie()
{
//summoner dies here
- me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
+ me->DealDamage(me, me->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
//override any database `spawntimesecs` to prevent duplicated summons
uint32 rTime = me->GetRespawnDelay();
if (rTime < 600)
diff --git a/src/server/scripts/Events/childrens_week.cpp b/src/server/scripts/Events/childrens_week.cpp
index cc38aed2964..f5f03bedcf1 100644
--- a/src/server/scripts/Events/childrens_week.cpp
+++ b/src/server/scripts/Events/childrens_week.cpp
@@ -16,9 +16,11 @@
*/
#include "ScriptMgr.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptedCreature.h"
#include "SpellAuras.h"
-#include "Player.h"
enum Orphans
{
diff --git a/src/server/scripts/Events/fireworks_show.cpp b/src/server/scripts/Events/fireworks_show.cpp
index b6b9cacf053..b725d64000f 100644
--- a/src/server/scripts/Events/fireworks_show.cpp
+++ b/src/server/scripts/Events/fireworks_show.cpp
@@ -16,10 +16,14 @@
*/
#include "ScriptMgr.h"
-#include "GameObjectAI.h"
+#include "Containers.h"
#include "CreatureAIImpl.h"
+#include "EventMap.h"
#include "GameEventMgr.h"
+#include "GameObject.h"
+#include "GameObjectAI.h"
#include "GameTime.h"
+#include "Util.h"
enum FireworksShowTypeObjects
{
@@ -75,7 +79,7 @@ enum FireworksZones
STORMWIND = 1519
};
-static const std::vector<Position> BootyBayPos =
+std::vector<Position> const BootyBayPos =
{
{ -14358.03f, 515.058f, 34.2664f, 3.68265f },
{ -14357.49f, 490.8445f, 39.47329f, 0.9773831f },
@@ -104,7 +108,7 @@ static const std::vector<Position> BootyBayPos =
{ -14378.1f, 473.5608f, 40.16786f, 0.9773831f }
};
-static const std::vector<Position> StormwindPos =
+std::vector<Position> const StormwindPos =
{
{ -8823.592f, 470.316f, 179.2295f, 1.239183f },
{ -8883.005f, 590.1927f, 163.1264f, 0.9773831f },
@@ -225,7 +229,7 @@ static const std::vector<Position> StormwindPos =
{ -8872.734375f, 573.338440f, 97.723770f, 1.831103f }
};
-static const std::vector<Position> OrgrimmarPos =
+std::vector<Position> const OrgrimmarPos =
{
{ 1609.075f, -4383.707f, 90.23414f, 0.3665176f },
{ 1469.648f, -4371.285f, 113.8313f, 6.073746f },
@@ -322,7 +326,7 @@ static const std::vector<Position> OrgrimmarPos =
{ 1493.26253f, -4402.19919f, 59.147816f, 2.2917f }
};
-static const std::vector<Position> IronForgePos =
+std::vector<Position> const IronForgePos =
{
{ -5196.038f, -858.4618f, 525.0447f, 6.073746f },
{ -5195.734f, -887.6441f, 534.168f, 3.68265f },
@@ -383,7 +387,7 @@ static const std::vector<Position> IronForgePos =
{ -5194.976f, -759.9896f, 517.6288f, 3.630291f }
};
-static const std::vector<Position> SilvermoonPos =
+std::vector<Position> const SilvermoonPos =
{
{ 9466.583f, -7307.326f, 107.8366f, 0.1047193f },
{ 9411.616f, -7322.223f, 79.95399f, 2.722713f },
@@ -453,7 +457,7 @@ static const std::vector<Position> SilvermoonPos =
{ 9411.504f, -7288.202f, 112.2664f, 2.844883f }
};
-static const std::vector<Position> ExodarPos =
+std::vector<Position> const ExodarPos =
{
{ -3992.465f, -11843.86f, 186.4043f, 2.199115f },
{ -3948.378f, -11854.06f, 135.6206f, 3.47321f },
@@ -515,7 +519,7 @@ static const std::vector<Position> ExodarPos =
{ -4036.461f, -11783.4f, 142.8152f, 4.729844f }
};
-static const std::vector<Position> ThunderBluffPos =
+std::vector<Position> const ThunderBluffPos =
{
{ -1234.804f, -19.72239f, 206.5436f, 0.1396245f },
{ -1244.442f, -35.88308f, 206.82f, 4.729844f },
@@ -577,7 +581,7 @@ static const std::vector<Position> ThunderBluffPos =
{ -1240.617f, -41.39486f, 205.0362f, 5.846854f }
};
-static const std::vector<Position> UndercityPos =
+std::vector<Position> const UndercityPos =
{
{ 1850.231f, 257.0156f, 124.1743f, 4.729844f },
{ 1863.302f, 193.9063f, 114.5829f, 0.9773831f },
@@ -637,7 +641,7 @@ static const std::vector<Position> UndercityPos =
{ 1850.288f, 267.309f, 125.0537f, 3.630291f }
};
-static const std::vector<Position> DarnassusPos =
+std::vector<Position> const DarnassusPos =
{
{ 8578.888f, 975.2604f, 42.48742f, 5.846854f },
{ 8574.236f, 944.2083f, 44.71943f, 4.76475f },
@@ -700,20 +704,20 @@ static const std::vector<Position> DarnassusPos =
{ 8554.825f, 813.0746f, 78.88226f, 6.0912f }
};
-static const std::unordered_map<uint32, std::vector<Position> const&> pos =
+std::unordered_map<uint32, std::vector<Position> const*> const PositionsByZoneMap =
{
- { STRANGLETHORN_VALE, BootyBayPos },
- { STORMWIND, StormwindPos },
- { ORGRIMMAR, OrgrimmarPos },
- { DUROTAR, OrgrimmarPos },
- { DUN_MOROGH, IronForgePos },
- { IRONFORGE, IronForgePos },
- { EVERSONG_WOODS, SilvermoonPos },
- { EXODAR, ExodarPos },
- { THUNDERBLUFF, ThunderBluffPos },
- { UNDERCITY, UndercityPos },
- { TIRISFAL_GLADES, UndercityPos },
- { TELDRASSIL, DarnassusPos }
+ { STRANGLETHORN_VALE, &BootyBayPos },
+ { STORMWIND, &StormwindPos },
+ { ORGRIMMAR, &OrgrimmarPos },
+ { DUROTAR, &OrgrimmarPos },
+ { DUN_MOROGH, &IronForgePos },
+ { IRONFORGE, &IronForgePos },
+ { EVERSONG_WOODS, &SilvermoonPos },
+ { EXODAR, &ExodarPos },
+ { THUNDERBLUFF, &ThunderBluffPos },
+ { UNDERCITY, &UndercityPos },
+ { TIRISFAL_GLADES, &UndercityPos },
+ { TELDRASSIL, &DarnassusPos }
};
class go_cheer_speaker : public GameObjectScript
@@ -729,7 +733,7 @@ public:
_big = true;
}
- uint32 CheerPicker()
+ static uint32 CheerPicker()
{
uint32 newid = RAND(
SOUND_CHEER_1,
@@ -740,7 +744,7 @@ public:
return newid;
}
- uint32 FireworksPicker()
+ static uint32 FireworksPicker()
{
uint32 newid = RAND(
FIREWORK_SHOW_TYPE_1_RED,
@@ -770,7 +774,7 @@ public:
return newid;
}
- uint32 FireworksBIGOnlyPicker()
+ static uint32 FireworksBIGOnlyPicker()
{
uint32 newid = RAND(
FIREWORK_SHOW_TYPE_1_RED_BIG,
@@ -841,45 +845,44 @@ public:
{
switch (eventId)
{
- case EVENT_CHEER:
- {
- me->PlayDistanceSound(CheerPicker());
- break;
- }
- case EVENT_FIRE:
- {
- auto it = pos.find(me->GetZoneId());
- if (it != pos.end())
+ case EVENT_CHEER:
{
- Position const& rndpos = Trinity::Containers::SelectRandomContainerElement(it->second);
- float rndrot = frand(-1.0000000f, 1.0000000f);
- float rndrot2 = frand(-1.0000000f, 1.0000000f);
-
- if (_big)
+ me->PlayDistanceSound(CheerPicker());
+ break;
+ }
+ case EVENT_FIRE:
+ {
+ if (std::vector<Position> const* positions = Trinity::Containers::MapGetValuePtr(PositionsByZoneMap, me->GetZoneId()))
{
- if (GameObject* firework = me->SummonGameObject(FireworksBIGOnlyPicker(), rndpos, G3D::Quat(0.f, 0.f, rndrot, rndrot2), 300))
+ Position const& rndpos = Trinity::Containers::SelectRandomContainerElement(*positions);
+ float rndrot = frand(-1.0000000f, 1.0000000f);
+ float rndrot2 = frand(-1.0000000f, 1.0000000f);
+
+ if (_big)
{
- firework->SetRespawnTime(0);
- firework->Delete();
+ if (GameObject* firework = me->SummonGameObject(FireworksBIGOnlyPicker(), rndpos, QuaternionData(0.f, 0.f, rndrot, rndrot2), 300))
+ {
+ firework->SetRespawnTime(0);
+ firework->Delete();
+ }
}
- }
- else
- {
- if (GameObject* firework = me->SummonGameObject(FireworksPicker(), rndpos, G3D::Quat(0.f, 0.f, rndrot, rndrot2), 300))
+ else
{
- firework->SetRespawnTime(0);
- firework->Delete();
+ if (GameObject* firework = me->SummonGameObject(FireworksPicker(), rndpos, QuaternionData(0.f, 0.f, rndrot, rndrot2), 300))
+ {
+ firework->SetRespawnTime(0);
+ firework->Delete();
+ }
}
}
- }
- if (_started == true)
- _events.ScheduleEvent(EVENT_FIRE, Seconds(1), Seconds(2));
+ if (_started == true)
+ _events.ScheduleEvent(EVENT_FIRE, Seconds(1), Seconds(2));
- break;
- }
- default:
- break;
+ break;
+ }
+ default:
+ break;
}
}
}
diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp
index b2d7f9cc166..8c57ce77ba0 100644
--- a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp
+++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp
@@ -16,12 +16,14 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
#include "blackfathom_deeps.h"
-#include "ScriptedEscortAI.h"
+#include "InstanceScript.h"
+#include "GameObject.h"
#include "GameObjectAI.h"
+#include "Map.h"
#include "Player.h"
+#include "ScriptedEscortAI.h"
+#include "ScriptedGossip.h"
enum Spells
{
@@ -53,7 +55,7 @@ class go_blackfathom_altar : public GameObjectScript
GameObjectAI* GetAI(GameObject* go) const override
{
- return GetInstanceAI<go_blackfathom_altarAI>(go);
+ return GetBlackfathomDeepsAI<go_blackfathom_altarAI>(go);
}
};
@@ -79,7 +81,7 @@ class go_blackfathom_fire : public GameObjectScript
GameObjectAI* GetAI(GameObject* go) const override
{
- return GetInstanceAI<go_blackfathom_fireAI>(go);
+ return GetBlackfathomDeepsAI<go_blackfathom_fireAI>(go);
}
};
@@ -90,7 +92,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
@@ -131,7 +133,7 @@ public:
void AttackPlayer()
{
- Map::PlayerList const &PlList = me->GetMap()->GetPlayers();
+ Map::PlayerList const& PlList = me->GetMap()->GetPlayers();
if (PlList.isEmpty())
return;
@@ -252,7 +254,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_morriduneAI(creature);
+ return GetBlackfathomDeepsAI<npc_morriduneAI>(creature);
}
};
diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.h b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.h
index 98daa49ebb5..b90a970da8b 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 <class AI, class T>
+inline AI* GetBlackfathomDeepsAI(T* obj)
+{
+ return GetInstanceAI<AI>(obj, 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..19a671997e8 100644
--- a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_aku_mai.cpp
+++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_aku_mai.cpp
@@ -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..290ed9ee6c9 100644
--- a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_gelihast.cpp
+++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_gelihast.cpp
@@ -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..aee43175d9b 100644
--- a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp
+++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp
@@ -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..16525357bb3 100644
--- a/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp
+++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp
@@ -24,10 +24,14 @@ 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"
+#include "Random.h"
-const Position LorgusPosition[4] =
+Position const LorgusPosition[4] =
{
{ -458.500610f, -38.343079f, -33.474445f, 0.0f },
{ -469.423615f, -88.400513f, -39.265102f, 0.0f },
@@ -35,7 +39,7 @@ const Position LorgusPosition[4] =
{ -759.640564f, 16.658913f, -29.159529f, 0.0f }
};
-const Position SpawnsLocation[] =
+Position const SpawnsLocation[] =
{
{-775.431f, -153.853f, -25.871f, 3.207f},
{-775.404f, -174.132f, -25.871f, 3.185f},
@@ -47,7 +51,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 9965053bfc6..4e9fdbc0bc3 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
@@ -102,7 +103,7 @@ public:
{
if (waypointId == 7)
{
- Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_JAINAPROUDMOORE));
+ Creature* target = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_JAINAPROUDMOORE));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
}
@@ -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
@@ -273,9 +274,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..caed3f73324 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp
@@ -24,10 +24,13 @@ SDCategory: Caverns of Time, Mount Hyjal
EndScriptData */
#include "ScriptMgr.h"
+#include "hyjal.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
-#include "Player.h"
-#include "hyjal.h"
enum Texts
{
@@ -99,7 +102,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
@@ -140,7 +143,7 @@ public:
{
if (CheckTimer <= diff)
{
- if (Unit* Archimonde = ObjectAccessor::GetUnit(*me, ArchimondeGUID))
+ if (Creature* Archimonde = ObjectAccessor::GetCreature(*me, ArchimondeGUID))
{
if (Archimonde->HealthBelowPct(2) || !Archimonde->IsAlive())
DoCast(me, SPELL_DENOUEMENT_WISP);
@@ -162,7 +165,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 +194,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
@@ -389,7 +392,7 @@ public:
DoSpawnCreature(NPC_ANCIENT_WISP, float(rand32() % 40), float(rand32() % 40), 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
++WispCount;
if (WispCount >= 30)
- me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
+ me->DealDamage(me, me->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
events.ScheduleEvent(EVENT_SUMMON_WHISP, 1500);
break;
default:
@@ -530,7 +533,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_archimondeAI>(creature);
+ return GetHyjalAI<boss_archimondeAI>(creature);
}
};
@@ -546,9 +549,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 e8ba1f90d37..4eb9a71cff4 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
@@ -105,7 +106,7 @@ public:
{
if (waypointId == 7 && instance)
{
- Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_THRALL));
+ Creature* target = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_THRALL));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
}
@@ -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..d5b43ab4d2d 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
@@ -100,7 +101,7 @@ public:
{
if (waypointId == 7 && instance)
{
- Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_THRALL));
+ Creature* target = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_THRALL));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
}
@@ -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)
@@ -217,7 +216,7 @@ class spell_mark_of_kazrogal : public SpellScriptLoader
if (target->GetPower(POWER_MANA) == 0)
{
- target->CastSpell(target, SPELL_MARK_DAMAGE, true, NULL, aurEff);
+ target->CastSpell(target, SPELL_MARK_DAMAGE, true, nullptr, aurEff);
// Remove aura
SetDuration(0);
}
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..9d96aa20133 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
@@ -95,7 +96,7 @@ public:
{
if (waypointId == 7 && instance)
{
- Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_JAINAPROUDMOORE));
+ Creature* target = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_JAINAPROUDMOORE));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
}
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp
index 83cb6d7d91c..7d33e4bb375 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp
@@ -30,10 +30,11 @@ npc_tyrande_whisperwind
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
#include "hyjalAI.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."
@@ -122,7 +123,7 @@ class npc_jaina_proudmoore : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_jaina_proudmooreAI>(creature);
+ return GetHyjalAI<npc_jaina_proudmooreAI>(creature);
}
};
@@ -202,7 +203,7 @@ class npc_thrall : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_thrallAI>(creature);
+ return GetHyjalAI<npc_thrallAI>(creature);
}
};
@@ -250,7 +251,7 @@ class npc_tyrande_whisperwind : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_tyrande_whisperwindAI>(creature);
+ return GetHyjalAI<npc_tyrande_whisperwindAI>(creature);
}
};
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.h b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.h
index caf7d690097..a90f7789690 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 <class AI, class T>
+inline AI* GetHyjalAI(T* obj)
+{
+ return GetInstanceAI<AI>(obj, HyjalScriptName);
+}
+
#endif
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp
index db091296389..882689ee76d 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp
@@ -24,14 +24,15 @@ 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 "hyjalAI.h"
+#include "GridNotifiersImpl.h"
#include "hyjal_trash.h"
+#include "hyjalAI.h"
+#include "InstanceScript.h"
+#include "Log.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
+#include "TemporarySummon.h"
enum Spawns
{
@@ -428,7 +429,7 @@ void hyjalAI::EnterEvadeMode(EvadeReason /*why*/)
if (me->IsAlive())
me->GetMotionMaster()->MoveTargetedHome();
- me->SetLootRecipient(NULL);
+ me->SetLootRecipient(nullptr);
}
void hyjalAI::EnterCombat(Unit* /*who*/)
@@ -458,7 +459,7 @@ void hyjalAI::SummonCreature(uint32 entry, float Base[4][3])
{
SpawnLoc[i] = Base[random][i];
}
- Creature* creature = NULL;
+ Creature* creature = nullptr;
switch (entry)
{
case 17906: //GARGOYLE
@@ -650,7 +651,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();
}
@@ -662,7 +663,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();
}
@@ -674,7 +675,7 @@ void hyjalAI::DeSpawnVeins()
{
if (Faction == 1)
{
- Creature* unit=ObjectAccessor::GetCreature((*me), instance->GetGuidData(DATA_JAINAPROUDMOORE));
+ Creature* unit = ObjectAccessor::GetCreature((*me), instance->GetGuidData(DATA_JAINAPROUDMOORE));
if (!unit)return;
hyjalAI* ai = CAST_AI(hyjalAI, unit->AI());
if (!ai)return;
@@ -686,7 +687,7 @@ void hyjalAI::DeSpawnVeins()
}
else if (Faction)
{
- Creature* unit=ObjectAccessor::GetCreature((*me), instance->GetGuidData(DATA_THRALL));
+ Creature* unit = ObjectAccessor::GetCreature((*me), instance->GetGuidData(DATA_THRALL));
if (!unit)
return;
hyjalAI* ai = CAST_AI(hyjalAI, unit->AI());
@@ -725,7 +726,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);
@@ -738,7 +739,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);
@@ -854,7 +855,7 @@ void hyjalAI::UpdateAI(uint32 diff)
if (me->IsNonMeleeSpellCast(false))
me->InterruptNonMeleeSpells(false);
- Unit* target = NULL;
+ Unit* target = nullptr;
switch (Spells[i].TargetType)
{
@@ -1015,7 +1016,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
{
@@ -1056,7 +1057,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/hyjalAI.h b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h
index f6ce9011852..a61a568f61b 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h
@@ -204,7 +204,6 @@ struct hyjalAI : public npc_escortAI
private:
uint32 SpellTimer[3];
- //std::list<uint64> CreatureList;
};
#endif
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp
index 5b93cafce32..b26d9081fc8 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp
@@ -16,10 +16,13 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "hyjal.h"
#include "hyjal_trash.h"
#include "hyjalAI.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
+#include "TemporarySummon.h"
enum Spells
{
@@ -446,7 +449,7 @@ public:
{
if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall
{
- Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_THRALL));
+ Creature* target = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_THRALL));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
}
@@ -458,8 +461,10 @@ public:
if (Delay <= diff)
{
Delay=0;
- }else{
- Delay-=diff;
+ }
+ else
+ {
+ Delay -= diff;
return;
}
if (!meteor)
@@ -482,7 +487,7 @@ public:
CanMove = true;
if (instance->GetData(DATA_ALLIANCE_RETREAT) && !instance->GetData(DATA_HORDE_RETREAT))
{
- Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_THRALL));
+ Creature* target = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_THRALL));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
} else if (instance->GetData(DATA_ALLIANCE_RETREAT) && instance->GetData(DATA_HORDE_RETREAT)){
@@ -510,7 +515,7 @@ public:
if (!imol)
{
DoCast(me, SPELL_IMMOLATION);
- imol=true;
+ imol = true;
}
if (FlameBuffetTimer <= diff)
{
@@ -523,7 +528,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_giant_infernalAI>(creature);
+ return GetHyjalAI<npc_giant_infernalAI>(creature);
}
};
@@ -534,7 +539,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_abominationAI>(creature);
+ return GetHyjalAI<npc_abominationAI>(creature);
}
struct npc_abominationAI : public hyjal_trashAI
@@ -559,13 +564,13 @@ public:
{
if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall
{
- Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_THRALL));
+ Creature* target = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_THRALL));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
}
else
{
- Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_JAINAPROUDMOORE));
+ Creature* target = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_JAINAPROUDMOORE));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
}
@@ -628,7 +633,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_ghoulAI>(creature);
+ return GetHyjalAI<npc_ghoulAI>(creature);
}
struct npc_ghoulAI : public hyjal_trashAI
@@ -657,13 +662,13 @@ public:
{
if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall
{
- Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_THRALL));
+ Creature* target = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_THRALL));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
}
else
{
- Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_JAINAPROUDMOORE));
+ Creature* target = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_JAINAPROUDMOORE));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
}
@@ -726,7 +731,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_necromancerAI>(creature);
+ return GetHyjalAI<npc_necromancerAI>(creature);
}
struct npc_necromancerAI : public hyjal_trashAI
@@ -767,13 +772,13 @@ public:
{
if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall
{
- Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_THRALL));
+ Creature* target = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_THRALL));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
}
else
{
- Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_JAINAPROUDMOORE));
+ Creature* target = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_JAINAPROUDMOORE));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
}
@@ -850,7 +855,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_bansheeAI>(creature);
+ return GetHyjalAI<npc_bansheeAI>(creature);
}
struct npc_bansheeAI : public hyjal_trashAI
@@ -880,13 +885,13 @@ public:
{
if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall
{
- Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_THRALL));
+ Creature* target = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_THRALL));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
}
else
{
- Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_JAINAPROUDMOORE));
+ Creature* target = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_JAINAPROUDMOORE));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
}
@@ -950,7 +955,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
@@ -976,13 +981,13 @@ public:
{
if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall
{
- Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_THRALL));
+ Creature* target = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_THRALL));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
}
else
{
- Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_JAINAPROUDMOORE));
+ Creature* target = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_JAINAPROUDMOORE));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
}
@@ -1036,7 +1041,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
@@ -1062,13 +1067,13 @@ public:
{
if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall
{
- Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_THRALL));
+ Creature* target = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_THRALL));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
}
else
{
- Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_JAINAPROUDMOORE));
+ Creature* target = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_JAINAPROUDMOORE));
if (target && target->IsAlive())
me->AddThreat(target, 0.0f);
}
@@ -1122,7 +1127,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
@@ -1154,7 +1159,7 @@ public:
{
if (waypointId == 2 && !IsOverrun)
{
- Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_THRALL));
+ Creature* target = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_THRALL));
if (target && target->IsAlive())
{
me->AddThreat(target, 0.0f);
@@ -1170,7 +1175,7 @@ public:
float x, y, z;
me->GetPosition(x, y, z);
- z = me->GetMap()->GetHeight(me->GetPhaseMask(), x, y, z);
+ me->UpdateGroundPositionZ(x, y, z);
me->GetMotionMaster()->MovePoint(0, x, y, z);
me->UpdatePosition(x, y, z, 0);
}
@@ -1218,7 +1223,9 @@ public:
{
me->GetMotionMaster()->MoveChase(me->GetVictim());
MoveTimer = 2000;
- } else MoveTimer-=diff;
+ }
+ else
+ MoveTimer -= diff;
}
if (FrostBreathTimer <= diff)
@@ -1230,7 +1237,9 @@ public:
me->GetMotionMaster()->Clear();
FrostBreathTimer = 4000;
}
- } else FrostBreathTimer -= diff;
+ }
+ else
+ FrostBreathTimer -= diff;
}
};
};
@@ -1242,7 +1251,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_gargoyleAI>(creature);
+ return GetHyjalAI<npc_gargoyleAI>(creature);
}
struct npc_gargoyleAI : public hyjal_trashAI
@@ -1275,7 +1284,7 @@ public:
{
if (waypointId == 2 && !IsOverrun)
{
- Unit* target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_THRALL));
+ Creature* target = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_THRALL));
if (target && target->IsAlive())
{
me->AddThreat(target, 0.0f);
@@ -1288,7 +1297,7 @@ public:
{
float x, y, z;
me->GetPosition(x, y, z);
- z = me->GetMap()->GetHeight(me->GetPhaseMask(), x, y, z);
+ me->UpdateGroundPositionZ(x, y, z);
me->GetMotionMaster()->MovePoint(0, x, y, z);
me->UpdatePosition(x, y, z, 0);
hyjal_trashAI::JustDied(killer);
@@ -1351,12 +1360,14 @@ public:
{
float x, y, z;
me->EnsureVictim()->GetPosition(x, y, z);
- me->GetMotionMaster()->MovePoint(0, x, y, z+Zpos);
+ me->GetMotionMaster()->MovePoint(0, x, y, z + Zpos);
Zpos -= 1.0f;
if (Zpos <= 0)
Zpos = 0;
MoveTimer = 2000;
- } else MoveTimer-=diff;
+ }
+ else
+ MoveTimer -= diff;
}
if (StrikeTimer <= diff)
@@ -1367,8 +1378,12 @@ public:
me->StopMoving();
me->GetMotionMaster()->Clear();
StrikeTimer = 2000 + rand32() % 1000;
- } else StrikeTimer=0;
- } else StrikeTimer -= diff;
+ }
+ else
+ StrikeTimer = 0;
+ }
+ else
+ StrikeTimer -= diff;
}
};
};
@@ -1380,7 +1395,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 d3caf27c344..0a71552e804 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp
@@ -24,9 +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
@@ -50,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
{
@@ -276,7 +280,7 @@ public:
return str_data;
}
- void Load(const char* in) override
+ void Load(char const* in) override
{
if (!in)
{
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..1f42939c2f2 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
{
@@ -55,7 +55,7 @@ class boss_infinite_corruptor : public CreatureScript
if (Creature* guardian = me->FindNearestCreature(NPC_GUARDIAN_OF_TIME, 100.0f))
{
- DoCast((Unit*)NULL, SPELL_CORRUPTION_OF_TIME_CHANNEL, false);
+ DoCast((Unit*)nullptr, SPELL_CORRUPTION_OF_TIME_CHANNEL, false);
guardian->CastSpell(guardian, SPELL_CORRUPTION_OF_TIME_TARGET, false);
}
}
@@ -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..2224ca4f439 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,12 @@ SDCategory:
Script Data End */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "culling_of_stratholme.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "ScriptedCreature.h"
enum Spells
{
@@ -64,7 +67,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..9ebba661c10 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp
@@ -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..925b6367d93 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
@@ -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 da1080c5d27..3b92e2926c6 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,17 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
#include "culling_of_stratholme.h"
-#include "ScriptedEscortAI.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "PassiveAI.h"
#include "Player.h"
+#include "ScriptedEscortAI.h"
+#include "ScriptedGossip.h"
#include "SpellInfo.h"
+#include "TemporarySummon.h"
enum Says
{
@@ -1224,7 +1228,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_arthasAI>(creature);
+ return GetCullingOfStratholmeAI<npc_arthasAI>(creature);
}
};
@@ -1249,7 +1253,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();
}
}
@@ -1261,7 +1265,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..926645eca85 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 <class AI, class T>
+inline AI* GetCullingOfStratholmeAI(T* obj)
+{
+ return GetInstanceAI<AI>(obj, 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 00b6edb7ee3..9881b57a840 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,17 @@
*/
#include "ScriptMgr.h"
-#include "InstanceScript.h"
+#include "CreatureAI.h"
#include "CreatureTextMgr.h"
#include "culling_of_stratholme.h"
+#include "EventMap.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "MotionMaster.h"
#include "Player.h"
-#include "TemporarySummon.h"
#include "SpellInfo.h"
+#include "TemporarySummon.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..292e61ee3c8 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp
@@ -24,6 +24,7 @@ SDCategory: Caverns of Time, Old Hillsbrad Foothills
EndScriptData */
#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "ScriptedCreature.h"
#include "old_hillsbrad.h"
@@ -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 34072f03975..2f4225f7a74 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp
@@ -24,10 +24,12 @@ SDCategory: Caverns of Time, Old Hillsbrad Foothills
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "GameObject.h"
+#include "GameObjectAI.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
#include "old_hillsbrad.h"
#include "ScriptedEscortAI.h"
-#include "GameObjectAI.h"
/*######
## go_barrel_old_hillsbrad
@@ -56,7 +58,7 @@ public:
GameObjectAI* GetAI(GameObject* go) const override
{
- return GetInstanceAI<go_barrel_old_hillsbradAI>(go);
+ return GetOldHillsbradAI<go_barrel_old_hillsbradAI>(go);
}
};
@@ -79,7 +81,7 @@ enum LieutenantDrake
SPELL_FRIGHTENING_SHOUT = 33789
};
-G3D::Vector3 const DrakeWP[]=
+Position const DrakeWP[]=
{
{ 2125.84f, 88.2535f, 54.8830f },
{ 2111.01f, 93.8022f, 52.6356f },
@@ -109,7 +111,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
@@ -163,7 +165,7 @@ public:
/// @todo make this work
if (CanPatrol && wpId == 0)
{
- me->GetMotionMaster()->MovePoint(wpId, DrakeWP[wpId].x, DrakeWP[wpId].y, DrakeWP[wpId].z);
+ me->GetMotionMaster()->MovePoint(wpId, DrakeWP[wpId]);
++wpId;
}
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 5e4c9c0ed0e..145e13155b1 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp
@@ -24,8 +24,10 @@ 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"
@@ -43,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
{
@@ -83,7 +85,7 @@ public:
}
TC_LOG_DEBUG("scripts", "Instance Old Hillsbrad: GetPlayerInMap, but PlayerList is empty!");
- return NULL;
+ return nullptr;
}
void UpdateQuestCredit()
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp
index 2a4d13d1634..29e94b2bd9f 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp
@@ -30,11 +30,13 @@ 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 "Map.h"
#include "Player.h"
+#include "ScriptedEscortAI.h"
+#include "ScriptedGossip.h"
enum Erozion
{
@@ -100,7 +102,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_erozionAI>(creature);
+ return GetOldHillsbradAI<npc_erozionAI>(creature);
}
};
@@ -349,7 +351,7 @@ public:
case 106:
{
//trigger taretha to run down outside
- if (Creature* Taretha = instance->instance->GetCreature(instance->GetGuidData(DATA_TARETHA)))
+ if (Creature* Taretha = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_TARETHA)))
{
if (Player* player = GetPlayerForEscort())
ENSURE_AI(npc_escortAI, (Taretha->AI()))->Start(false, true, player->GetGUID());
@@ -541,7 +543,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_thrall_old_hillsbradAI>(creature);
+ return GetOldHillsbradAI<npc_thrall_old_hillsbradAI>(creature);
}
};
@@ -612,7 +614,7 @@ public:
if (instance->GetGuidData(DATA_EPOCH).IsEmpty())
me->SummonCreature(ENTRY_EPOCH, 2639.13f, 698.55f, 65.43f, 4.59f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000);
- if (Creature* thrall = (ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_THRALL))))
+ if (Creature* thrall = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_THRALL)))
ENSURE_AI(npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI, thrall->AI())->StartWP();
}
}
@@ -632,7 +634,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_tarethaAI>(creature);
+ return GetOldHillsbradAI<npc_tarethaAI>(creature);
}
};
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.h b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.h
index 52eb8a6c4f7..109285640cb 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,4 +44,10 @@ enum OHWorldStateIds
WORLD_STATE_OH = 2436
};
+template <class AI, class T>
+inline AI* GetOldHillsbradAI(T* obj)
+{
+ return GetInstanceAI<AI>(obj, 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..5763344ba81 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"
@@ -79,7 +80,7 @@ public:
if (me->IsWithinDistInMap(who, 20.0f))
{
Talk(SAY_BANISH);
- me->DealDamage(who, who->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
+ me->DealDamage(who, who->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
}
}
@@ -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..5bf079c556e 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"
@@ -82,7 +83,7 @@ public:
if (me->IsWithinDistInMap(who, 20.0f))
{
Talk(SAY_BANISH);
- me->DealDamage(who, who->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
+ me->DealDamage(who, who->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
}
}
@@ -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..79dec3487fc 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"
@@ -85,7 +86,6 @@ public:
}
void MoveInLineOfSight(Unit* who) override
-
{
//Despawn Time Keeper
if (who->GetTypeId() == TYPEID_UNIT && who->GetEntry() == NPC_TIME_KEEPER)
@@ -94,7 +94,7 @@ public:
{
Talk(SAY_BANISH);
- me->DealDamage(who, who->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
+ me->DealDamage(who, who->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
}
}
@@ -145,7 +145,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 053b670c254..0705071dfb9 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,12 +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 "TemporarySummon.h"
+#include "the_black_morass.h"
enum Misc
{
@@ -71,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
{
@@ -180,7 +182,7 @@ public:
{
if (medivh->IsAlive())
{
- medivh->DealDamage(medivh, medivh->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
+ medivh->DealDamage(medivh, medivh->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
m_auiEncounter[0] = FAIL;
m_auiEncounter[1] = NOT_STARTED;
}
@@ -276,7 +278,7 @@ public:
return summon;
TC_LOG_DEBUG("scripts", "Instance The Black Morass: What just happened there? No boss, no loot, no fun...");
- return NULL;
+ return nullptr;
}
void DoSpawnPortal()
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 2f76b20ea30..6aa008f89f5 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.cpp
@@ -17,11 +17,15 @@
*/
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "Log.h"
+#include "Map.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 "the_black_morass.h"
enum MedivhBm
{
@@ -57,7 +61,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
@@ -139,7 +143,7 @@ public:
void EnterCombat(Unit* /*who*/) override { }
- void SpellHit(Unit* /*caster*/, const SpellInfo* spell) override
+ void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
{
if (SpellCorrupt_Timer)
return;
@@ -250,7 +254,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 c5274e9c985..8798f8fffe6 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,4 +68,10 @@ enum TBMCreatureIds
NPC_INFINITE_VANQUISHER = 18995
};
+template <class AI, class T>
+inline AI* GetBlackMorassAI(T* obj)
+{
+ return GetInstanceAI<AI>(obj, 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..8d3710c21f4 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
@@ -67,7 +68,6 @@ public:
{
return new instance_dire_maul_InstanceMapScript(map);
}
-
};
void AddSC_instance_dire_maul()
diff --git a/src/server/scripts/Kalimdor/Maraudon/boss_celebras_the_cursed.cpp b/src/server/scripts/Kalimdor/Maraudon/boss_celebras_the_cursed.cpp
index 491b05063f4..04fd6552e3e 100644
--- a/src/server/scripts/Kalimdor/Maraudon/boss_celebras_the_cursed.cpp
+++ b/src/server/scripts/Kalimdor/Maraudon/boss_celebras_the_cursed.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 celebras_the_cursedAI(creature);
+ return GetMaraudonAI<celebras_the_cursedAI>(creature);
}
struct celebras_the_cursedAI : public ScriptedAI
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 36514199010..fa351c51f87 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..928cfb0cf78
--- /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 <class AI, class T>
+inline AI* GetMaraudonAI(T* obj)
+{
+ return GetInstanceAI<AI>(obj, 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 52a86f5d2fa..8799facf2f6 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 "GridNotifiersImpl.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "onyxias_lair.h"
+#include "ScriptedCreature.h"
+#include "TemporarySummon.h"
enum Yells
{
@@ -193,7 +195,7 @@ public:
Talk(SAY_KILL);
}
- void SpellHit(Unit* /*pCaster*/, const SpellInfo* Spell) override
+ void SpellHit(Unit* /*pCaster*/, SpellInfo const* Spell) override
{
if (Spell->Id == SPELL_BREATH_EAST_TO_WEST ||
Spell->Id == SPELL_BREATH_WEST_TO_EAST ||
@@ -271,7 +273,7 @@ public:
}
}
- void SpellHitTarget(Unit* target, const SpellInfo* Spell) override
+ void SpellHitTarget(Unit* target, SpellInfo const* Spell) override
{
//Workaround - Couldn't find a way to group this spells (All Eruption)
if (((Spell->Id >= 17086 && Spell->Id <= 17095) ||
@@ -301,7 +303,7 @@ public:
return &MoveData[i];
}
- return NULL;
+ return nullptr;
}
void SetNextRandomPoint()
@@ -353,7 +355,7 @@ public:
{
DoCastVictim(SPELL_BELLOWING_ROAR);
// Eruption
- GameObject* Floor = NULL;
+ GameObject* Floor = nullptr;
Trinity::GameObjectInRangeCheck check(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 15);
Trinity::GameObjectLastSearcher<Trinity::GameObjectInRangeCheck> searcher(me, Floor, check);
Cell::VisitGridObjects(me, searcher, 30.0f);
@@ -492,7 +494,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_onyxiaAI>(creature);
+ return GetOnyxiaAI<boss_onyxiaAI>(creature);
}
};
diff --git a/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp b/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp
index afb7c801a01..ab0fb75cb16 100644
--- a/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp
+++ b/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp
@@ -23,11 +23,10 @@ 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 "onyxias_lair.h"
#include "TemporarySummon.h"
@@ -39,7 +38,7 @@ BossBoundaryData const boundaries =
class instance_onyxias_lair : public InstanceMapScript
{
public:
- instance_onyxias_lair() : InstanceMapScript("instance_onyxias_lair", 249) { }
+ instance_onyxias_lair() : InstanceMapScript(OnyxiaScriptName, 249) { }
InstanceScript* GetInstanceScript(InstanceMap* map) const override
{
@@ -112,7 +111,7 @@ public:
//THIS GOB IS A TRAP - What shall i do? =(
//Cast it spell? Copyed Heigan method
floorEruption->SendCustomAnim(floorEruption->GetGoAnimProgress());
- floorEruption->CastSpell(NULL, Difficulty(instance->GetSpawnMode()) == RAID_DIFFICULTY_10MAN_NORMAL ? 17731 : 69294); //pFloorEruption->GetGOInfo()->trap.spellId
+ floorEruption->CastSpell(nullptr, Difficulty(instance->GetSpawnMode()) == RAID_DIFFICULTY_10MAN_NORMAL ? 17731 : 69294); //pFloorEruption->GetGOInfo()->trap.spellId
//Get all immediatly nearby floors
std::list<GameObject*> nearFloorList;
@@ -240,7 +239,7 @@ public:
}
}
- bool CheckAchievementCriteriaMeet(uint32 criteriaId, Player const* /*source*/, Unit const* /*target = NULL*/, uint32 /*miscValue1 = 0*/) override
+ bool CheckAchievementCriteriaMeet(uint32 criteriaId, Player const* /*source*/, Unit const* /*target = nullptr*/, uint32 /*miscValue1 = 0*/) override
{
switch (criteriaId)
{
diff --git a/src/server/scripts/Kalimdor/OnyxiasLair/onyxias_lair.h b/src/server/scripts/Kalimdor/OnyxiasLair/onyxias_lair.h
index ba931c86ccd..1144b3835b6 100644
--- a/src/server/scripts/Kalimdor/OnyxiasLair/onyxias_lair.h
+++ b/src/server/scripts/Kalimdor/OnyxiasLair/onyxias_lair.h
@@ -18,6 +18,9 @@
#ifndef DEF_ONYXIAS_LAIR_H
#define DEF_ONYXIAS_LAIR_H
+#include "CreatureAIImpl.h"
+
+#define OnyxiaScriptName "instance_onyxias_lair"
#define DataHeader "OL"
uint32 const EncounterCount = 1;
@@ -69,4 +72,11 @@ enum OLAchievementData
ACHIEV_CRITERIA_DEEP_BREATH_25_PLAYER = 12569, // Criteria for achievement 4407: She Deep Breaths More (25 player) Everybody evade Deep Breath
ACHIEV_TIMED_START_EVENT = 6601, // Timed event for achievement 4402, 4005: More Dots! (10, 25 player) 5 min kill
};
+
+template <class AI, class T>
+inline AI* GetOnyxiaAI(T* obj)
+{
+ return GetInstanceAI<AI>(obj, OnyxiaScriptName);
+}
+
#endif
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..c4cb219ea82 100644
--- a/src/server/scripts/Kalimdor/RazorfenDowns/boss_amnennar_the_coldbringer.cpp
+++ b/src/server/scripts/Kalimdor/RazorfenDowns/boss_amnennar_the_coldbringer.cpp
@@ -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..b4fcf2a6298 100644
--- a/src/server/scripts/Kalimdor/RazorfenDowns/boss_glutton.cpp
+++ b/src/server/scripts/Kalimdor/RazorfenDowns/boss_glutton.cpp
@@ -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..d7b9153ead7 100644
--- a/src/server/scripts/Kalimdor/RazorfenDowns/boss_mordresh_fire_eye.cpp
+++ b/src/server/scripts/Kalimdor/RazorfenDowns/boss_mordresh_fire_eye.cpp
@@ -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..b3c5a2c46a4 100644
--- a/src/server/scripts/Kalimdor/RazorfenDowns/boss_tuten_kash.cpp
+++ b/src/server/scripts/Kalimdor/RazorfenDowns/boss_tuten_kash.cpp
@@ -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/instance_razorfen_downs.cpp b/src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp
index 5fcc2e15a35..00b8099dbe2 100644
--- a/src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp
+++ b/src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp
@@ -16,10 +16,12 @@
*/
#include "ScriptMgr.h"
-#include "ObjectMgr.h"
+#include "GameObject.h"
#include "InstanceScript.h"
+#include "Map.h"
+#include "MotionMaster.h"
+#include "ObjectMgr.h"
#include "razorfen_downs.h"
-#include "Player.h"
#include "TemporarySummon.h"
Position const PosSummonTutenkash[15] =
diff --git a/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp b/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp
index a5329422683..f43f3cfc5db 100644
--- a/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp
+++ b/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp
@@ -28,15 +28,16 @@ npc_henry_stern
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "CellImpl.h"
#include "GameObjectAI.h"
-#include "ScriptedGossip.h"
-#include "razorfen_downs.h"
-#include "Player.h"
-#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
-#include "Cell.h"
-#include "CellImpl.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
+#include "Player.h"
+#include "razorfen_downs.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
+#include "TemporarySummon.h"
/*###
## npc_belnistrasz for Quest 3525 "Extinguishing the Idol"
@@ -203,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);
@@ -254,7 +255,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_belnistraszAI>(creature);
+ return GetRazorfenDownsAI<npc_belnistraszAI>(creature);
}
};
@@ -292,7 +293,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_idol_room_spawnerAI>(creature);
+ return GetRazorfenDownsAI<npc_idol_room_spawnerAI>(creature);
}
};
@@ -362,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 fa78d8518c1..19c26869343 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, class T>
-AI* GetRazorfenDownsAI(T* obj)
+template <class AI, class T>
+inline AI* GetRazorfenDownsAI(T* obj)
{
return GetInstanceAI<AI>(obj, RFDScriptName);
}
diff --git a/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp b/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp
index c14383ffaa5..2348de6c45c 100644
--- a/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp
+++ b/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp
@@ -24,16 +24,19 @@ SDCategory: Razorfen Kraul
EndScriptData */
#include "ScriptMgr.h"
+#include "GameObject.h"
#include "InstanceScript.h"
-#include "razorfen_kraul.h"
+#include "Log.h"
+#include "Map.h"
#include "Player.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
{
@@ -60,7 +63,7 @@ public:
return player;
}
TC_LOG_DEBUG("scripts", "Instance Razorfen Kraul: GetPlayerInMap, but PlayerList is empty!");
- return NULL;
+ return nullptr;
}
void OnGameObjectCreate(GameObject* go) override
diff --git a/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp b/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp
index 64feea50156..b2ee684d0f5 100644
--- a/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp
+++ b/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp
@@ -17,11 +17,10 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedEscortAI.h"
-#include "razorfen_kraul.h"
-#include "Player.h"
#include "PetAI.h"
+#include "Player.h"
+#include "razorfen_kraul.h"
+#include "ScriptedEscortAI.h"
#include "SpellScript.h"
enum Willix
@@ -132,7 +131,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_willixAI(creature);
+ return GetRazorfenKraulAI<npc_willixAI>(creature);
}
};
diff --git a/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.h b/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.h
index 1de42a0bb3a..c4ec5207ccf 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 <class AI, class T>
+inline AI* GetRazorfenKraulAI(T* obj)
+{
+ return GetInstanceAI<AI>(obj, RFKScriptName);
+}
+
#endif
diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp
index 23247e0ba06..59432c4051b 100644
--- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp
+++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp
@@ -17,9 +17,12 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "Player.h"
#include "ruins_of_ahnqiraj.h"
+#include "ScriptedCreature.h"
enum Spells
{
@@ -208,7 +211,7 @@ class boss_ayamiss : public CreatureScript
break;
case EVENT_SWARMER_ATTACK:
for (GuidList::iterator i = _swarmers.begin(); i != _swarmers.end(); ++i)
- if (Creature* swarmer = me->GetMap()->GetCreature(*i))
+ if (Creature* swarmer = ObjectAccessor::GetCreature(*me, *i))
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM))
swarmer->AI()->AttackStart(target);
@@ -241,7 +244,7 @@ class boss_ayamiss : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_ayamissAI>(creature);
+ return GetAQ20AI<boss_ayamissAI>(creature);
}
};
@@ -295,7 +298,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..e0e0925e7ab 100644
--- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp
+++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp
@@ -15,11 +15,12 @@
* 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 "ObjectAccessor.h"
+#include "ruins_of_ahnqiraj.h"
+#include "ScriptedCreature.h"
enum Spells
{
@@ -83,8 +84,8 @@ class boss_kurinnaxx : public CreatureScript
void JustDied(Unit* /*killer*/) override
{
_JustDied();
- if (Creature* Ossirian = me->GetMap()->GetCreature(instance->GetGuidData(DATA_OSSIRIAN)))
- sCreatureTextMgr->SendChat(Ossirian, SAY_KURINAXX_DEATH, NULL, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_ZONE);
+ if (Creature* Ossirian = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_OSSIRIAN)))
+ sCreatureTextMgr->SendChat(Ossirian, SAY_KURINAXX_DEATH, nullptr, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_ZONE);
}
void UpdateAI(uint32 diff) override
@@ -136,7 +137,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..f38f3058f7c 100644
--- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp
+++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp
@@ -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 6d0001bac73..7d9d85f876e 100644
--- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp
+++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp
@@ -16,13 +16,19 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "GameObject.h"
#include "GameObjectAI.h"
-#include "ruins_of_ahnqiraj.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "ObjectAccessor.h"
+#include "Opcodes.h"
#include "Player.h"
+#include "ruins_of_ahnqiraj.h"
+#include "ScriptedCreature.h"
#include "SpellInfo.h"
+#include "TemporarySummon.h"
+#include "Weather.h"
#include "WorldPacket.h"
-#include "Opcodes.h"
enum Texts
{
@@ -118,7 +124,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();
}
}
@@ -127,7 +134,7 @@ class boss_ossirian : public CreatureScript
void DoAction(int32 action) override
{
if (action == ACTION_TRIGGER_WEAKNESS)
- if (Creature* Trigger = me->GetMap()->GetCreature(TriggerGUID))
+ if (Creature* Trigger = ObjectAccessor::GetCreature(*me, TriggerGUID))
if (!Trigger->HasUnitState(UNIT_STATE_CASTING))
Trigger->CastSpell(Trigger, SpellWeakness[urand(0, 4)], false);
}
@@ -179,7 +186,7 @@ class boss_ossirian : public CreatureScript
void Cleanup()
{
- if (GameObject* Crystal = me->GetMap()->GetGameObject(CrystalGUID))
+ if (GameObject* Crystal = ObjectAccessor::GetGameObject(*me, CrystalGUID))
Crystal->Use(me);
}
@@ -188,10 +195,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;
@@ -270,7 +277,7 @@ class boss_ossirian : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_ossirianAI>(creature);
+ return GetAQ20AI<boss_ossirianAI>(creature);
}
};
@@ -298,7 +305,7 @@ class go_ossirian_crystal : public GameObjectScript
GameObjectAI* GetAI(GameObject* go) const override
{
- return GetInstanceAI<go_ossirian_crystalAI>(go);
+ return GetAQ20AI<go_ossirian_crystalAI>(go);
}
};
diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_rajaxx.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_rajaxx.cpp
index 5fd456c0295..397477b7129 100644
--- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_rajaxx.cpp
+++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_rajaxx.cpp
@@ -16,9 +16,9 @@
*/
#include "ObjectMgr.h"
-#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "ruins_of_ahnqiraj.h"
+#include "ScriptedCreature.h"
+#include "ScriptMgr.h"
enum Yells
{
@@ -130,7 +130,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..1c25c905328 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 <class AI, class T>
+inline AI* GetAQ20AI(T* obj)
+{
+ return GetInstanceAI<AI>(obj, 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 19af5cad56d..779e973f330 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
@@ -201,7 +204,7 @@ public:
//Charge_Timer
if (Charge_Timer <= diff)
{
- Unit* target = NULL;
+ Unit* target = nullptr;
target = SelectTarget(SELECT_TARGET_RANDOM, 0);
if (target)
{
@@ -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 9e03c3031aa..6f531894c98 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 "ObjectAccessor.h"
+#include "Player.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
@@ -284,7 +288,7 @@ public:
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
{
- Creature* Spawned = NULL;
+ Creature* Spawned = nullptr;
//Spawn claw tentacle on the random target
Spawned = me->SummonCreature(NPC_CLAW_TENTACLE, *target, TEMPSUMMON_CORPSE_DESPAWN, 500);
@@ -453,7 +457,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<cthunAI>(creature);
+ return GetAQ40AI<cthunAI>(creature);
}
struct cthunAI : public ScriptedAI
@@ -545,7 +549,7 @@ public:
Unit* SelectRandomNotStomach()
{
if (Stomach_Map.empty())
- return NULL;
+ return nullptr;
std::unordered_map<ObjectGuid, bool>::const_iterator i = Stomach_Map.begin();
@@ -566,7 +570,7 @@ public:
}
if (temp.empty())
- return NULL;
+ return nullptr;
j = temp.begin();
@@ -587,7 +591,7 @@ public:
if (WisperTimer <= diff)
{
//Play random sound to the zone
- Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers();
+ Map::PlayerList const& PlayerList = me->GetMap()->GetPlayers();
for (Map::PlayerList::const_iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr)
me->PlayDirectSound(RANDOM_SOUND_WHISPER, itr->GetSource());
@@ -754,7 +758,7 @@ public:
//Set target in stomach
Stomach_Map[target->GetGUID()] = true;
target->InterruptNonMeleeSpells(false);
- target->CastSpell(target, SPELL_MOUTH_TENTACLE, true, NULL, NULL, me->GetGUID());
+ target->CastSpell(target, SPELL_MOUTH_TENTACLE, true, nullptr, nullptr, me->GetGUID());
StomachEnterTarget = target->GetGUID();
StomachEnterVisTimer = 3800;
}
@@ -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 2e8ee5f4259..3a154f40eed 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
@@ -122,7 +122,7 @@ public:
//ChangeTarget_Timer
if (Submerged && ChangeTarget_Timer <= diff)
{
- Unit* target = NULL;
+ Unit* target = nullptr;
target = SelectTarget(SELECT_TARGET_RANDOM, 0);
if (target)
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 116f634893f..76833e06841 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp
@@ -83,7 +83,7 @@ class boss_skeram : public CreatureScript
{
ScriptedAI::EnterEvadeMode(why);
if (me->IsSummon())
- ((TempSummon*)me)->UnSummon();
+ me->DespawnOrUnsummon();
}
void JustSummoned(Creature* creature) override
@@ -200,7 +200,7 @@ class boss_skeram : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_skeramAI(creature);
+ return GetAQ40AI<boss_skeramAI>(creature);
}
};
@@ -258,10 +258,7 @@ public:
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_TRUE_FULFILLMENT_2)
- || !sSpellMgr->GetSpellInfo(SPELL_GENERIC_DISMOUNT))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_TRUE_FULFILLMENT_2, SPELL_GENERIC_DISMOUNT });
}
void HandleEffect(SpellEffIndex /*effIndex*/)
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp
index e48e74897da..d98cf055d30 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp
@@ -24,11 +24,15 @@ SDCategory: Temple of Ahn'Qiraj
EndScriptData */
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "Item.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
+#include "Spell.h"
+#include "SpellInfo.h"
#include "temple_of_ahnqiraj.h"
#include "WorldPacket.h"
-#include "Item.h"
-#include "Spell.h"
enum Spells
{
@@ -167,7 +171,7 @@ struct boss_twinemperorsAI : public ScriptedAI
}
}
- void SpellHit(Unit* caster, const SpellInfo* entry) override
+ void SpellHit(Unit* caster, SpellInfo const* entry) override
{
if (caster == me)
return;
@@ -320,9 +324,9 @@ struct boss_twinemperorsAI : public ScriptedAI
me->GetCreatureListWithEntryInGrid(lUnitList, 15317, 150.0f);
if (lUnitList.empty())
- return NULL;
+ return nullptr;
- Creature* nearb = NULL;
+ Creature* nearb = nullptr;
for (std::list<Creature*>::const_iterator iter = lUnitList.begin(); iter != lUnitList.end(); ++iter)
{
@@ -382,9 +386,13 @@ struct boss_twinemperorsAI : public ScriptedAI
if (!me->IsNonMeleeSpellCast(true))
{
DoCast(me, SPELL_BERSERK);
- EnrageTimer = 60*60000;
- } else EnrageTimer = 0;
- } else EnrageTimer-=diff;
+ EnrageTimer = 60 * 60000;
+ }
+ else
+ EnrageTimer = 0;
+ }
+ else
+ EnrageTimer -= diff;
}
};
@@ -395,7 +403,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 +491,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_veklorAI>(creature);
+ return GetAQ40AI<boss_veklorAI>(creature);
}
struct boss_veklorAI : public boss_twinemperorsAI
@@ -550,7 +558,7 @@ public:
//Blizzard_Timer
if (Blizzard_Timer <= diff)
{
- Unit* target = NULL;
+ Unit* target = nullptr;
target = SelectTarget(SELECT_TARGET_RANDOM, 0, 45, true);
if (target)
DoCast(target, SPELL_BLIZZARD);
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp
index 1d41e808bc9..189b706d153 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp
@@ -16,9 +16,13 @@
*/
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
#include "SpellInfo.h"
#include "temple_of_ahnqiraj.h"
+#include "TemporarySummon.h"
enum Spells
{
@@ -255,7 +259,7 @@ class boss_viscidus : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_viscidusAI(creature);
+ return GetAQ40AI<boss_viscidusAI>(creature);
}
};
@@ -272,7 +276,7 @@ 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);
@@ -304,7 +308,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..8596737bd14 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
{
@@ -70,24 +72,24 @@ class instance_temple_of_ahnqiraj : public InstanceMapScript
{
switch (creature->GetEntry())
{
- case NPC_SKERAM:
- SkeramGUID = creature->GetGUID();
- break;
- case NPC_VEM:
- VemGUID = creature->GetGUID();
- break;
- case NPC_KRI:
- KriGUID = creature->GetGUID();
- break;
- case NPC_VEKLOR:
- VeklorGUID = creature->GetGUID();
- break;
- case NPC_VEKNILASH:
- VeknilashGUID = creature->GetGUID();
- break;
- case NPC_VISCIDUS:
- ViscidusGUID = creature->GetGUID();
- break;
+ case NPC_SKERAM:
+ SkeramGUID = creature->GetGUID();
+ break;
+ case NPC_VEM:
+ VemGUID = creature->GetGUID();
+ break;
+ case NPC_KRI:
+ KriGUID = creature->GetGUID();
+ break;
+ case NPC_VEKLOR:
+ VeklorGUID = creature->GetGUID();
+ break;
+ case NPC_VEKNILASH:
+ VeknilashGUID = creature->GetGUID();
+ break;
+ case NPC_VISCIDUS:
+ ViscidusGUID = creature->GetGUID();
+ break;
}
}
@@ -101,26 +103,26 @@ class instance_temple_of_ahnqiraj : public InstanceMapScript
{
switch (type)
{
- case DATA_VEMISDEAD:
- if (IsBossDied[0])
- return 1;
- break;
-
- case DATA_VEKLORISDEAD:
- if (IsBossDied[1])
- return 1;
- break;
-
- case DATA_VEKNILASHISDEAD:
- if (IsBossDied[2])
- return 1;
- break;
-
- case DATA_BUG_TRIO_DEATH:
- return BugTrioDeathCount;
-
- case DATA_CTHUN_PHASE:
- return CthunPhase;
+ case DATA_VEMISDEAD:
+ if (IsBossDied[0])
+ return 1;
+ break;
+
+ case DATA_VEKLORISDEAD:
+ if (IsBossDied[1])
+ return 1;
+ break;
+
+ case DATA_VEKNILASHISDEAD:
+ if (IsBossDied[2])
+ return 1;
+ break;
+
+ case DATA_BUG_TRIO_DEATH:
+ return BugTrioDeathCount;
+
+ case DATA_CTHUN_PHASE:
+ return CthunPhase;
}
return 0;
}
@@ -129,18 +131,18 @@ class instance_temple_of_ahnqiraj : public InstanceMapScript
{
switch (identifier)
{
- case DATA_SKERAM:
- return SkeramGUID;
- case DATA_VEM:
- return VemGUID;
- case DATA_KRI:
- return KriGUID;
- case DATA_VEKLOR:
- return VeklorGUID;
- case DATA_VEKNILASH:
- return VeknilashGUID;
- case DATA_VISCIDUS:
- return ViscidusGUID;
+ case DATA_SKERAM:
+ return SkeramGUID;
+ case DATA_VEM:
+ return VemGUID;
+ case DATA_KRI:
+ return KriGUID;
+ case DATA_VEKLOR:
+ return VeklorGUID;
+ case DATA_VEKNILASH:
+ return VeknilashGUID;
+ case DATA_VISCIDUS:
+ return ViscidusGUID;
}
return ObjectGuid::Empty;
} // end GetGuidData
@@ -149,25 +151,25 @@ class instance_temple_of_ahnqiraj : public InstanceMapScript
{
switch (type)
{
- case DATA_VEM_DEATH:
- IsBossDied[0] = true;
- break;
+ case DATA_VEM_DEATH:
+ IsBossDied[0] = true;
+ break;
- case DATA_BUG_TRIO_DEATH:
- ++BugTrioDeathCount;
- break;
+ case DATA_BUG_TRIO_DEATH:
+ ++BugTrioDeathCount;
+ break;
- case DATA_VEKLOR_DEATH:
- IsBossDied[1] = true;
- break;
+ case DATA_VEKLOR_DEATH:
+ IsBossDied[1] = true;
+ break;
- case DATA_VEKNILASH_DEATH:
- IsBossDied[2] = true;
- break;
+ case DATA_VEKNILASH_DEATH:
+ IsBossDied[2] = true;
+ break;
- case DATA_CTHUN_PHASE:
- CthunPhase = data;
- break;
+ case DATA_CTHUN_PHASE:
+ CthunPhase = data;
+ break;
}
}
};
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp
index a4457b7e82b..c7c41ef22c7 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp
@@ -24,17 +24,9 @@ SDCategory: Temple of Ahn'Qiraj
EndScriptData */
#include "ScriptMgr.h"
+#include "ObjectAccessor.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 "temple_of_ahnqiraj.h"
enum Spells
{
@@ -66,7 +58,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..1a1f366a946 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 <class AI, class T>
+inline AI* GetAQ40AI(T* obj)
+{
+ return GetInstanceAI<AI>(obj, 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 672bae016c1..3748e7ffc1c 100644
--- a/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp
+++ b/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp
@@ -24,7 +24,10 @@ SDCategory: Wailing Caverns
EndScriptData */
#include "ScriptMgr.h"
+#include "Creature.h"
#include "InstanceScript.h"
+#include "Log.h"
+#include "Map.h"
#include "wailing_caverns.h"
#define MAX_ENCOUNTER 9
@@ -32,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
{
@@ -115,7 +118,7 @@ public:
return saveStream.str();
}
- void Load(const char* in) override
+ void Load(char const* in) override
{
if (!in)
{
diff --git a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp
index 23516577f44..05385a0c6bf 100644
--- a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp
+++ b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp
@@ -27,11 +27,13 @@ EndScriptData */
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptedEscortAI.h"
+#include "ScriptedGossip.h"
#include "wailing_caverns.h"
-#include "Player.h"
/*######
## npc_disciple_of_naralex
@@ -205,7 +207,7 @@ public:
++eventProgress;
eventTimer = 15000;
//CAST_AI(npc_escort::npc_escortAI, me->AI())->SetCanDefend(false);
- if (Creature* naralex = instance->instance->GetCreature(instance->GetGuidData(DATA_NARALEX)))
+ if (Creature* naralex = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_NARALEX)))
DoCast(naralex, SPELL_NARALEXS_AWAKENING, true);
Talk(EMOTE_AWAKENING_RITUAL);
}
@@ -214,7 +216,7 @@ public:
{
++eventProgress;
eventTimer = 15000;
- if (Creature* naralex = instance->instance->GetCreature(instance->GetGuidData(DATA_NARALEX)))
+ if (Creature* naralex = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_NARALEX)))
naralex->AI()->Talk(EMOTE_TROUBLED_SLEEP);
me->SummonCreature(NPC_DEVIATE_MOCCASIN, 135.943f, 199.701f, -103.529f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
me->SummonCreature(NPC_DEVIATE_MOCCASIN, 151.08f, 221.13f, -103.609f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
@@ -225,7 +227,7 @@ public:
{
++eventProgress;
eventTimer = 30000;
- if (Creature* naralex = instance->instance->GetCreature(instance->GetGuidData(DATA_NARALEX)))
+ if (Creature* naralex = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_NARALEX)))
naralex->AI()->Talk(EMOTE_WRITHE_IN_AGONY);
me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 133.413f, 207.188f, -102.469f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 142.857f, 218.645f, -102.905f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
@@ -239,7 +241,7 @@ public:
if (eventProgress == 5)
{
++eventProgress;
- if (Creature* naralex = instance->instance->GetCreature(instance->GetGuidData(DATA_NARALEX)))
+ if (Creature* naralex = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_NARALEX)))
naralex->AI()->Talk(EMOTE_HORRENDOUS_VISION);
me->SummonCreature(NPC_MUTANUS_THE_DEVOURER, 150.872f, 262.905f, -103.503f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000);
Talk(SAY_MUTANUS_THE_DEVOURER);
@@ -250,7 +252,7 @@ public:
{
++eventProgress;
eventTimer = 3000;
- if (Creature* naralex = instance->instance->GetCreature(instance->GetGuidData(DATA_NARALEX)))
+ if (Creature* naralex = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_NARALEX)))
{
if (me->HasAura(SPELL_NARALEXS_AWAKENING))
me->RemoveAura(SPELL_NARALEXS_AWAKENING);
@@ -264,7 +266,7 @@ public:
{
++eventProgress;
eventTimer = 6000;
- if (Creature* naralex = instance->instance->GetCreature(instance->GetGuidData(DATA_NARALEX)))
+ if (Creature* naralex = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_NARALEX)))
naralex->AI()->Talk(SAY_THANK_YOU);
}
else
@@ -272,7 +274,7 @@ public:
{
++eventProgress;
eventTimer = 8000;
- if (Creature* naralex = instance->instance->GetCreature(instance->GetGuidData(DATA_NARALEX)))
+ if (Creature* naralex = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_NARALEX)))
{
naralex->AI()->Talk(SAY_FAREWELL);
naralex->AddAura(SPELL_FLIGHT_FORM, naralex);
@@ -286,7 +288,7 @@ public:
{
++eventProgress;
eventTimer = 1500;
- if (Creature* naralex = instance->instance->GetCreature(instance->GetGuidData(DATA_NARALEX)))
+ if (Creature* naralex = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_NARALEX)))
naralex->GetMotionMaster()->MovePoint(25, naralex->GetPositionX(), naralex->GetPositionY(), naralex->GetPositionZ());
}
else
@@ -294,7 +296,7 @@ public:
{
++eventProgress;
eventTimer = 2500;
- if (Creature* naralex = instance->instance->GetCreature(instance->GetGuidData(DATA_NARALEX)))
+ if (Creature* naralex = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_NARALEX)))
{
naralex->GetMotionMaster()->MovePoint(0, 117.095512f, 247.107971f, -96.167870f);
naralex->GetMotionMaster()->MovePoint(1, 90.388809f, 276.135406f, -83.389801f);
@@ -305,7 +307,7 @@ public:
else
if (eventProgress == 11)
{
- if (Creature* naralex = instance->instance->GetCreature(instance->GetGuidData(DATA_NARALEX)))
+ if (Creature* naralex = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_NARALEX)))
naralex->SetVisible(false);
me->SetVisible(false);
instance->SetData(TYPE_NARALEX_PART3, DONE);
@@ -363,7 +365,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_disciple_of_naralexAI>(creature);
+ return GetWailingCavernsAI<npc_disciple_of_naralexAI>(creature);
}
};
diff --git a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.h b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.h
index 1b655815934..98d293c1416 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 <class AI, class T>
+inline AI* GetWailingCavernsAI(T* obj)
+{
+ return GetInstanceAI<AI>(obj, 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 2a7af38c1ab..9e6da47dcf1 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"
@@ -152,7 +153,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 cf8824395e3..0a4426e447e 100644
--- a/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp
+++ b/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp
@@ -16,10 +16,13 @@
*/
#include "ScriptMgr.h"
+#include "GameObject.h"
#include "InstanceScript.h"
-#include "zulfarrak.h"
+#include "Map.h"
+#include "MotionMaster.h"
#include "Player.h"
#include "TemporarySummon.h"
+#include "zulfarrak.h"
enum Misc
{
@@ -99,7 +102,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
{
@@ -216,9 +219,9 @@ public:
switch (type)
{
case EVENT_PYRAMID:
- PyramidPhase=data;
+ PyramidPhase = data;
break;
- };
+ }
}
virtual void Update(uint32 diff) override
diff --git a/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp b/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp
index 6539decdd56..f27a910e4e7 100644
--- a/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp
+++ b/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp
@@ -29,11 +29,15 @@ npc_weegli_blastfuse
EndContentData */
#include "ScriptMgr.h"
+#include "GameObject.h"
+#include "GameObjectAI.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
-#include "GameObjectAI.h"
#include "zulfarrak.h"
-#include "Player.h"
/*######
## npc_sergeant_bly
@@ -99,7 +103,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;
@@ -188,7 +192,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_sergeant_blyAI>(creature);
+ return GetZulFarrakAI<npc_sergeant_blyAI>(creature);
}
};
@@ -222,7 +226,7 @@ public:
private:
void initBlyCrewMember(uint32 entry, float x, float y, float z)
{
- if (Creature* crew = instance->instance->GetCreature(instance->GetGuidData(entry)))
+ if (Creature* crew = ObjectAccessor::GetCreature(*me, instance->GetGuidData(entry)))
{
crew->SetReactState(REACT_AGGRESSIVE);
crew->SetWalk(true);
@@ -235,7 +239,7 @@ public:
GameObjectAI* GetAI(GameObject* go) const override
{
- return GetInstanceAI<go_troll_cageAI>(go);
+ return GetZulFarrakAI<go_troll_cageAI>(go);
}
};
@@ -269,7 +273,7 @@ public:
npc_weegli_blastfuseAI(Creature* creature) : ScriptedAI(creature)
{
instance = creature->GetInstanceScript();
- destroyingDoor=false;
+ destroyingDoor = false;
Bomb_Timer = 10000;
LandMine_Timer = 30000;
}
@@ -344,7 +348,7 @@ public:
me->GetMotionMaster()->MovePoint(0, 1858.57f, 1146.35f, 14.745f);
me->SetHomePosition(1858.57f, 1146.35f, 14.745f, 3.85f); // in case he gets interrupted
Talk(SAY_WEEGLI_OK_I_GO);
- destroyingDoor=true;
+ destroyingDoor = true;
}
}
@@ -381,7 +385,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_weegli_blastfuseAI>(creature);
+ return GetZulFarrakAI<npc_weegli_blastfuseAI>(creature);
}
};
@@ -425,7 +429,7 @@ public:
GameObjectAI* GetAI(GameObject* go) const override
{
- return new go_shallow_graveAI(go);
+ return GetZulFarrakAI<go_shallow_graveAI>(go);
}
};
@@ -444,7 +448,7 @@ class at_zumrah : public AreaTriggerScript
public:
at_zumrah() : AreaTriggerScript("at_zumrah") { }
- bool OnTrigger(Player* player, const AreaTriggerEntry* /*at*/) override
+ bool OnTrigger(Player* player, AreaTriggerEntry const* /*at*/) override
{
Creature* pZumrah = player->FindNearestCreature(ZUMRAH_ID, 30.0f);
diff --git a/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.h b/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.h
index e6f97b339aa..86916c2a580 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 <class AI, class T>
+inline AI* GetZulFarrakAI(T* obj)
+{
+ return GetInstanceAI<AI>(obj, ZFScriptName);
+}
+
#endif
diff --git a/src/server/scripts/Kalimdor/boss_azuregos.cpp b/src/server/scripts/Kalimdor/boss_azuregos.cpp
index 37542f08d99..a5ade380e31 100644
--- a/src/server/scripts/Kalimdor/boss_azuregos.cpp
+++ b/src/server/scripts/Kalimdor/boss_azuregos.cpp
@@ -16,10 +16,10 @@
*/
#include "ScriptMgr.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
-#include "SpellAuraEffects.h"
-#include "Player.h"
enum Say
{
@@ -188,11 +188,7 @@ class spell_mark_of_frost : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_MARK_OF_FROST))
- return false;
- if (!sSpellMgr->GetSpellInfo(SPELL_AURA_OF_FROST))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_MARK_OF_FROST, SPELL_AURA_OF_FROST });
}
void FilterTargets(std::list<WorldObject*>& targets)
diff --git a/src/server/scripts/Kalimdor/zone_ashenvale.cpp b/src/server/scripts/Kalimdor/zone_ashenvale.cpp
index 35fb7d4f418..f5680664e27 100644
--- a/src/server/scripts/Kalimdor/zone_ashenvale.cpp
+++ b/src/server/scripts/Kalimdor/zone_ashenvale.cpp
@@ -28,10 +28,12 @@ npc_ruul_snowhoof
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedEscortAI.h"
+#include "GameObject.h"
#include "GameObjectAI.h"
#include "Player.h"
+#include "ScriptedCreature.h"
+#include "ScriptedEscortAI.h"
+#include "SpellInfo.h"
#include "SpellScript.h"
/*####
diff --git a/src/server/scripts/Kalimdor/zone_azshara.cpp b/src/server/scripts/Kalimdor/zone_azshara.cpp
index b6572c99f7d..0813b05705f 100644
--- a/src/server/scripts/Kalimdor/zone_azshara.cpp
+++ b/src/server/scripts/Kalimdor/zone_azshara.cpp
@@ -17,9 +17,11 @@
*/
#include "ScriptMgr.h"
+#include "ObjectAccessor.h"
+#include "MotionMaster.h"
+#include "Player.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
-#include "Player.h"
#include "SpellInfo.h"
/*######
@@ -65,7 +67,7 @@ public:
void EnterCombat(Unit* /*who*/) override { }
- void SpellHit(Unit* unit, const SpellInfo* spell) override
+ void SpellHit(Unit* unit, SpellInfo const* spell) override
{
if (spellhit)
return;
@@ -97,9 +99,9 @@ public:
return;
}
// walk 5 seconds before summoning
- if (spellhit && morphtimer<5000)
+ if (spellhit && morphtimer < 5000)
{
- morphtimer+=diff;
+ morphtimer += diff;
if (morphtimer >= 5000)
{
DoCast(me, SPELL_POLYMORPH_BACKFIRE); // summon copies
diff --git a/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp b/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp
index 77295abb873..c4036fbe836 100644
--- a/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp
+++ b/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp
@@ -34,14 +34,15 @@ npc_death_ravager
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedEscortAI.h"
-#include "ScriptedGossip.h"
-#include "GameObjectAI.h"
-#include "Cell.h"
#include "CellImpl.h"
+#include "GameObjectAI.h"
#include "GridNotifiersImpl.h"
-#include "GridNotifiers.h"
+#include "Log.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
+#include "ScriptedEscortAI.h"
+#include "ScriptedGossip.h"
+#include "TemporarySummon.h"
/*######
## npc_draenei_survivor
@@ -112,7 +113,7 @@ public:
}
}
- void SpellHit(Unit* Caster, const SpellInfo* Spell) override
+ void SpellHit(Unit* Caster, SpellInfo const* Spell) override
{
if (Spell->SpellFamilyFlags[2] & 0x080000000)
{
diff --git a/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp b/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp
index 9dfd78f52e9..afecffd2ff1 100644
--- a/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp
+++ b/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp
@@ -27,14 +27,15 @@ 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 "MotionMaster.h"
+#include "ObjectAccessor.h"
+#include "PassiveAI.h"
+#include "Player.h"
+#include "ScriptedEscortAI.h"
/*######
## npc_webbed_creature
@@ -439,7 +440,7 @@ public:
break;
case EVENT_HEALING_SURGE:
{
- Unit* target = NULL;
+ Unit* target = nullptr;
if (me->GetHealthPct() < 85)
target = me;
else if (Player* player = GetPlayerForEscort())
@@ -508,7 +509,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
@@ -604,7 +605,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);
@@ -749,7 +750,7 @@ public:
SetEscortPaused(true);
//Find Sironas and make it respawn if needed
- Creature* sironas = NULL;
+ Creature* sironas = nullptr;
Trinity::AllCreaturesOfEntryInRange check(me, NPC_SIRONAS, SIZE_OF_GRIDS);
Trinity::CreatureSearcher<Trinity::AllCreaturesOfEntryInRange> searcher(me, sironas, check);
Cell::VisitAllObjects(me, searcher, SIZE_OF_GRIDS);
diff --git a/src/server/scripts/Kalimdor/zone_darkshore.cpp b/src/server/scripts/Kalimdor/zone_darkshore.cpp
index 990c266e041..b2bdd76c137 100644
--- a/src/server/scripts/Kalimdor/zone_darkshore.cpp
+++ b/src/server/scripts/Kalimdor/zone_darkshore.cpp
@@ -104,7 +104,7 @@ public:
}
}
- void SpellHit(Unit* /*pCaster*/, const SpellInfo* pSpell) override
+ void SpellHit(Unit* /*pCaster*/, SpellInfo const* pSpell) override
{
if (HasFollowState(STATE_FOLLOW_INPROGRESS | STATE_FOLLOW_PAUSED) && pSpell->Id == SPELL_AWAKEN)
ClearSleeping();
diff --git a/src/server/scripts/Kalimdor/zone_desolace.cpp b/src/server/scripts/Kalimdor/zone_desolace.cpp
index 0b0264439ff..9027b59f3e3 100644
--- a/src/server/scripts/Kalimdor/zone_desolace.cpp
+++ b/src/server/scripts/Kalimdor/zone_desolace.cpp
@@ -31,11 +31,12 @@ go_demon_portal
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
-#include "ScriptedEscortAI.h"
+#include "GameObject.h"
#include "GameObjectAI.h"
+#include "MotionMaster.h"
#include "Player.h"
+#include "ScriptedEscortAI.h"
+#include "ScriptedGossip.h"
#include "SpellInfo.h"
enum DyingKodo
diff --git a/src/server/scripts/Kalimdor/zone_durotar.cpp b/src/server/scripts/Kalimdor/zone_durotar.cpp
index 821c7d34641..d35c90fca0c 100644
--- a/src/server/scripts/Kalimdor/zone_durotar.cpp
+++ b/src/server/scripts/Kalimdor/zone_durotar.cpp
@@ -16,10 +16,15 @@
*/
#include "ScriptMgr.h"
+#include "CreatureAIImpl.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptedCreature.h"
-#include "Vehicle.h"
+#include "SpellInfo.h"
#include "SpellScript.h"
-#include "Player.h"
+#include "TemporarySummon.h"
+#include "Vehicle.h"
enum Texts
{
@@ -373,9 +378,7 @@ class spell_mount_check : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_MOUNTING_CHECK))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_MOUNTING_CHECK });
}
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
@@ -421,11 +424,7 @@ class spell_voljin_war_drums : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_MOTIVATE_1))
- return false;
- if (!sSpellMgr->GetSpellInfo(SPELL_MOTIVATE_2))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_MOTIVATE_1, SPELL_MOTIVATE_2 });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -478,12 +477,7 @@ 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 2c44c1b91aa..898eaa8521e 100644
--- a/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp
+++ b/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp
@@ -30,11 +30,12 @@ npc_cassa_crimsonwing - handled by npc_taxi
EndContentData */
#include "ScriptMgr.h"
+#include "MotionMaster.h"
+#include "Player.h"
#include "ScriptedCreature.h"
-#include "ScriptedEscortAI.h"
#include "ScriptedGossip.h"
+#include "SpellInfo.h"
#include "SpellScript.h"
-#include "Player.h"
#include "WorldSession.h"
/*######
@@ -226,7 +227,6 @@ public:
};
-
enum SpellScripts
{
SPELL_OOZE_ZAP = 42489,
@@ -246,9 +246,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()
@@ -293,9 +291,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)
@@ -329,9 +325,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_felwood.cpp b/src/server/scripts/Kalimdor/zone_felwood.cpp
index 4ede963d5ad..70cbad8b295 100644
--- a/src/server/scripts/Kalimdor/zone_felwood.cpp
+++ b/src/server/scripts/Kalimdor/zone_felwood.cpp
@@ -28,9 +28,10 @@ at_ancient_leaf
EndContentData */
#include "ScriptMgr.h"
+#include "Map.h"
+#include "Player.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
-#include "Player.h"
/*######
## at_ancient_leaf
diff --git a/src/server/scripts/Kalimdor/zone_feralas.cpp b/src/server/scripts/Kalimdor/zone_feralas.cpp
index b9c2a20abf1..16c30f6fadd 100644
--- a/src/server/scripts/Kalimdor/zone_feralas.cpp
+++ b/src/server/scripts/Kalimdor/zone_feralas.cpp
@@ -29,11 +29,12 @@ spell_gordunni_trap
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "GameObject.h"
+#include "Player.h"
#include "ScriptedEscortAI.h"
#include "ScriptedGossip.h"
+#include "SpellInfo.h"
#include "SpellScript.h"
-#include "Player.h"
#include "WorldSession.h"
/*######
@@ -166,7 +167,7 @@ class spell_gordunni_trap : public SpellScriptLoader
void HandleDummy()
{
Unit* caster = GetCaster();
- if (GameObject* chest = caster->SummonGameObject(urand(0, 1) ? GO_GORDUNNI_DIRT_MOUND_1 : GO_GORDUNNI_DIRT_MOUND_2, *caster, G3D::Quat(), 0))
+ if (GameObject* chest = caster->SummonGameObject(urand(0, 1) ? GO_GORDUNNI_DIRT_MOUND_1 : GO_GORDUNNI_DIRT_MOUND_2, *caster, QuaternionData(), 0))
{
chest->SetSpellId(GetSpellInfo()->Id);
caster->RemoveGameObject(chest, false);
diff --git a/src/server/scripts/Kalimdor/zone_moonglade.cpp b/src/server/scripts/Kalimdor/zone_moonglade.cpp
index 1d220f9ad48..e8e6f5ff8d8 100644
--- a/src/server/scripts/Kalimdor/zone_moonglade.cpp
+++ b/src/server/scripts/Kalimdor/zone_moonglade.cpp
@@ -30,15 +30,15 @@ npc_giant_spotlight
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "CellImpl.h"
+#include "GridNotifiersImpl.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptedEscortAI.h"
#include "ScriptedGossip.h"
-#include "Player.h"
#include "SpellInfo.h"
-#include "GridNotifiers.h"
-#include "GridNotifiersImpl.h"
-#include "Cell.h"
-#include "CellImpl.h"
+#include "TemporarySummon.h"
/*######
## npc_clintar_spirit
@@ -443,7 +443,7 @@ public:
DoCast(SPELL_OMEN_SUMMON_SPOTLIGHT);
}
- void SpellHit(Unit* /*caster*/, const SpellInfo* spell) override
+ void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_ELUNE_CANDLE)
{
diff --git a/src/server/scripts/Kalimdor/zone_orgrimmar.cpp b/src/server/scripts/Kalimdor/zone_orgrimmar.cpp
index e75f69287b7..2603173e992 100644
--- a/src/server/scripts/Kalimdor/zone_orgrimmar.cpp
+++ b/src/server/scripts/Kalimdor/zone_orgrimmar.cpp
@@ -29,13 +29,14 @@ npc_thrall_warchief
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
-#include "Player.h"
-#include "Cell.h"
#include "CellImpl.h"
-#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
+#include "TemporarySummon.h"
/*######
## npc_shenthul
diff --git a/src/server/scripts/Kalimdor/zone_silithus.cpp b/src/server/scripts/Kalimdor/zone_silithus.cpp
index 436e75ccffa..34d3cc7cded 100644
--- a/src/server/scripts/Kalimdor/zone_silithus.cpp
+++ b/src/server/scripts/Kalimdor/zone_silithus.cpp
@@ -36,11 +36,16 @@ TO DO: Dragons should use the HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF) after tr
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
+#include "CreatureAIImpl.h"
+#include "GameObject.h"
#include "GameObjectAI.h"
#include "Group.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
+#include "TemporarySummon.h"
/*#####
# Quest: A Pawn on the Eternal Board
@@ -503,11 +508,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);
@@ -516,7 +521,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:
@@ -552,7 +557,7 @@ public:
case 51:
{
uint32 entries[4] = { NPC_KALDOREI_INFANTRY, NPC_ANUBISATH_CONQUEROR, NPC_QIRAJI_WASP, NPC_QIRAJI_TANK };
- Unit* mob = NULL;
+ Unit* mob = nullptr;
for (uint8 i = 0; i < 4; ++i)
{
mob = player->FindNearestCreature(entries[i], 50);
@@ -616,7 +621,7 @@ public:
{
Talk(ARYGOS_YELL_1);
AnachronosQuestTrigger->AI()->EnterEvadeMode();
- eventEnd=true;
+ eventEnd = true;
}
break;
}
@@ -739,7 +744,7 @@ public:
}
if (!hasTarget)
{
- Unit* target = NULL;
+ Unit* target = nullptr;
if (me->GetEntry() == NPC_ANUBISATH_CONQUEROR || me->GetEntry() == NPC_QIRAJI_TANK || me->GetEntry() == NPC_QIRAJI_WASP)
target = me->FindNearestCreature(NPC_KALDOREI_INFANTRY, 20, true);
if (me->GetEntry() == NPC_KALDOREI_INFANTRY)
@@ -867,7 +872,7 @@ public:
if (Group* EventGroup = player->GetGroup())
{
- Player* groupMember = NULL;
+ Player* groupMember = nullptr;
uint8 GroupMemberCount = 0;
uint8 DeadMemberCount = 0;
diff --git a/src/server/scripts/Kalimdor/zone_tanaris.cpp b/src/server/scripts/Kalimdor/zone_tanaris.cpp
index 197221bddcf..fcd531a10ce 100644
--- a/src/server/scripts/Kalimdor/zone_tanaris.cpp
+++ b/src/server/scripts/Kalimdor/zone_tanaris.cpp
@@ -31,11 +31,12 @@ npc_tooga
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptedEscortAI.h"
#include "ScriptedFollowerAI.h"
-#include "Player.h"
+#include "ScriptedGossip.h"
#include "WorldSession.h"
/*######
@@ -106,7 +107,7 @@ public:
!player->HasItemCount(ITEM_SILVER_TOTEM, 1, true))
{
ItemPosCountVec dest;
- uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 11522, 1, NULL);
+ uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 11522, 1, nullptr);
if (msg == EQUIP_ERR_OK)
player->StoreNewItem(dest, ITEM_SILVER_TOTEM, true);
}
diff --git a/src/server/scripts/Kalimdor/zone_the_barrens.cpp b/src/server/scripts/Kalimdor/zone_the_barrens.cpp
index ab63bdbc19e..1705f3e8dea 100644
--- a/src/server/scripts/Kalimdor/zone_the_barrens.cpp
+++ b/src/server/scripts/Kalimdor/zone_the_barrens.cpp
@@ -33,11 +33,13 @@ npc_wizzlecrank_shredder
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
-#include "ScriptedEscortAI.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "ScriptedEscortAI.h"
+#include "ScriptedGossip.h"
#include "SpellInfo.h"
+#include "TemporarySummon.h"
/*######
## npc_beaten_corpse
@@ -228,7 +230,7 @@ public:
me->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE);
}
- void SpellHit(Unit* /*caster*/, const SpellInfo* spell) override
+ void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_FLARE || spell->Id == SPELL_FOLLY)
{
@@ -370,7 +372,7 @@ public:
{
if (EventInProgress)
{
- Player* warrior = NULL;
+ Player* warrior = nullptr;
if (PlayerGUID)
warrior = ObjectAccessor::GetPlayer(*me, PlayerGUID);
diff --git a/src/server/scripts/Kalimdor/zone_thousand_needles.cpp b/src/server/scripts/Kalimdor/zone_thousand_needles.cpp
index d8d48f566bc..a1439f4cc00 100644
--- a/src/server/scripts/Kalimdor/zone_thousand_needles.cpp
+++ b/src/server/scripts/Kalimdor/zone_thousand_needles.cpp
@@ -32,11 +32,11 @@ go_panther_cage
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
-#include "ScriptedEscortAI.h"
+#include "GameObject.h"
#include "GameObjectAI.h"
#include "Player.h"
+#include "ScriptedEscortAI.h"
+#include "ScriptedGossip.h"
/*#####
# npc_kanati
diff --git a/src/server/scripts/Kalimdor/zone_ungoro_crater.cpp b/src/server/scripts/Kalimdor/zone_ungoro_crater.cpp
index f5b28a5f09a..4a1456a18c0 100644
--- a/src/server/scripts/Kalimdor/zone_ungoro_crater.cpp
+++ b/src/server/scripts/Kalimdor/zone_ungoro_crater.cpp
@@ -29,10 +29,10 @@ npc_ringo
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptedEscortAI.h"
#include "ScriptedFollowerAI.h"
-#include "Player.h"
#include "SpellInfo.h"
enum AmeData
@@ -227,7 +227,7 @@ public:
}
}
- void SpellHit(Unit* /*pCaster*/, const SpellInfo* pSpell) override
+ void SpellHit(Unit* /*pCaster*/, SpellInfo const* pSpell) override
{
if (HasFollowState(STATE_FOLLOW_INPROGRESS | STATE_FOLLOW_PAUSED) && pSpell->Id == SPELL_REVIVE_RINGO)
ClearFaint();
diff --git a/src/server/scripts/Kalimdor/zone_winterspring.cpp b/src/server/scripts/Kalimdor/zone_winterspring.cpp
index 40e2dc6e6fd..9bc3711e830 100644
--- a/src/server/scripts/Kalimdor/zone_winterspring.cpp
+++ b/src/server/scripts/Kalimdor/zone_winterspring.cpp
@@ -30,11 +30,14 @@ go_elune_fire
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
-#include "ScriptedEscortAI.h"
+#include "GameObject.h"
#include "GameObjectAI.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "ScriptedEscortAI.h"
+#include "ScriptedGossip.h"
+#include "TemporarySummon.h"
#include "WorldSession.h"
/*######
@@ -168,7 +171,7 @@ public:
// The array MUST be terminated by {0, 0, 0}
DialogueHelper(DialogueEntry const* dialogueArray) :
_dialogueArray(dialogueArray),
- _currentEntry(NULL),
+ _currentEntry(nullptr),
_actionTimer(0)
{ }
// The array MUST be terminated by {0, 0, 0, 0, 0}
@@ -212,7 +215,7 @@ protected:
/// Will be called when a dialogue step was done
virtual void JustDidDialogueStep(int32 /*entry*/) { }
/// Will be called to get a speaker, MUST be implemented if not used in instances
- virtual Creature* GetSpeakerByEntry(int32 /*entry*/) { return NULL; }
+ virtual Creature* GetSpeakerByEntry(int32 /*entry*/) { return nullptr; }
private:
void DoNextDialogueStep()
@@ -422,7 +425,7 @@ public:
(*itr)->Refresh();
}
- if (GameObject* altar = me->GetMap()->GetGameObject(_altarGUID))
+ if (GameObject* altar = ObjectAccessor::GetGameObject(*me, _altarGUID))
me->SetFacingToObject(altar);
break;
}
@@ -436,7 +439,7 @@ public:
case 44:
// Stop the escort and turn towards the altar
SetEscortPaused(true);
- if (GameObject* altar = me->GetMap()->GetGameObject(_altarGUID))
+ if (GameObject* altar = ObjectAccessor::GetGameObject(*me, _altarGUID))
me->SetFacingToObject(altar);
break;
}
@@ -466,7 +469,7 @@ public:
break;
case SAY_PRIESTESS_ALTAR_9:
// move near the escort npc
- if (Creature* priestess = me->GetMap()->GetCreature(_firstPriestessGUID))
+ if (Creature* priestess = ObjectAccessor::GetCreature(*me, _firstPriestessGUID))
priestess->GetMotionMaster()->MovePoint(0, wingThicketLocations[6].m_positionX, wingThicketLocations[6].m_positionY, wingThicketLocations[6].m_positionZ);
break;
case SAY_PRIESTESS_ALTAR_13:
@@ -477,7 +480,7 @@ public:
_guardEluneGUID = guard->GetGUID();
}
// summon the Voice of Elune
- if (GameObject* altar = me->GetMap()->GetGameObject(_altarGUID))
+ if (GameObject* altar = ObjectAccessor::GetGameObject(*me, _altarGUID))
{
if (Creature* voice = me->SummonCreature(NPC_VOICE_ELUNE, altar->GetPositionX(), altar->GetPositionY(), altar->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 30000))
_voiceEluneGUID = voice->GetGUID();
@@ -485,7 +488,7 @@ public:
break;
case SAY_VOICE_ALTAR_15:
// move near the escort npc and continue dialogue
- if (Creature* priestess = me->GetMap()->GetCreature(_secondPriestessGUID))
+ if (Creature* priestess = ObjectAccessor::GetCreature(*me, _secondPriestessGUID))
{
priestess->AI()->Talk(SAY_PRIESTESS_ALTAR_14);
priestess->GetMotionMaster()->MovePoint(0, wingThicketLocations[7].m_positionX, wingThicketLocations[7].m_positionY, wingThicketLocations[7].m_positionZ);
@@ -493,7 +496,7 @@ public:
break;
case SAY_PRIESTESS_ALTAR_19:
// make the voice of elune leave
- if (Creature* guard = me->GetMap()->GetCreature(_guardEluneGUID))
+ if (Creature* guard = ObjectAccessor::GetCreature(*me, _guardEluneGUID))
{
guard->GetMotionMaster()->MovePoint(0, wingThicketLocations[2].m_positionX, wingThicketLocations[2].m_positionY, wingThicketLocations[2].m_positionZ);
guard->DespawnOrUnsummon(4000);
@@ -501,7 +504,7 @@ public:
break;
case SAY_PRIESTESS_ALTAR_20:
// make the first priestess leave
- if (Creature* priestess = me->GetMap()->GetCreature(_firstPriestessGUID))
+ if (Creature* priestess = ObjectAccessor::GetCreature(*me, _firstPriestessGUID))
{
priestess->GetMotionMaster()->MovePoint(0, wingThicketLocations[0].m_positionX, wingThicketLocations[0].m_positionY, wingThicketLocations[0].m_positionZ);
priestess->DespawnOrUnsummon(4000);
@@ -509,7 +512,7 @@ public:
break;
case SAY_PRIESTESS_ALTAR_21:
// make the second priestess leave
- if (Creature* priestess = me->GetMap()->GetCreature(_secondPriestessGUID))
+ if (Creature* priestess = ObjectAccessor::GetCreature(*me, _secondPriestessGUID))
{
priestess->GetMotionMaster()->MovePoint(0, wingThicketLocations[1].m_positionX, wingThicketLocations[1].m_positionY, wingThicketLocations[1].m_positionZ);
priestess->DespawnOrUnsummon(4000);
@@ -525,7 +528,7 @@ public:
break;
case SAY_RANSHALLA_END_2:
// Turn towards the altar and kneel - quest complete
- if (GameObject* altar = me->GetMap()->GetGameObject(_altarGUID))
+ if (GameObject* altar = ObjectAccessor::GetGameObject(*me, _altarGUID))
{
me->SetFacingToObject(altar);
altar->ResetDoorOrButton();
@@ -548,13 +551,13 @@ public:
case NPC_RANSHALLA:
return me;
case NPC_VOICE_ELUNE:
- return me->GetMap()->GetCreature(_voiceEluneGUID);
+ return ObjectAccessor::GetCreature(*me, _voiceEluneGUID);
case NPC_PRIESTESS_DATA_1:
- return me->GetMap()->GetCreature(_firstPriestessGUID);
+ return ObjectAccessor::GetCreature(*me, _firstPriestessGUID);
case NPC_PRIESTESS_DATA_2:
- return me->GetMap()->GetCreature(_secondPriestessGUID);
+ return ObjectAccessor::GetCreature(*me, _secondPriestessGUID);
default:
- return NULL;
+ return nullptr;
}
}
diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/ahnkahet.h b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/ahnkahet.h
index c1bf139c070..00bd46ce2d5 100644
--- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/ahnkahet.h
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/ahnkahet.h
@@ -18,6 +18,8 @@
#ifndef AHNKAHET_H_
#define AHNKAHET_H_
+#include "CreatureAIImpl.h"
+
#define AhnKahetScriptName "instance_ahnkahet"
#define DataHeader "AK"
@@ -80,8 +82,8 @@ enum AKGameObjectIds
GO_SPHERE_2 = 193094
};
-template<class AI, class T>
-AI* GetAhnKahetAI(T* obj)
+template <class AI, class T>
+inline AI* GetAhnKahetAI(T* obj)
{
return GetInstanceAI<AI>(obj, AhnKahetScriptName);
}
diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp
index f98a0b53030..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(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..6eb1462da41 100644
--- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_elder_nadox.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_elder_nadox.cpp
@@ -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);
}
};
@@ -238,18 +238,9 @@ class spell_ahn_kahet_swarm : public SpellScriptLoader
{
PrepareSpellScript(spell_ahn_kahet_swarm_SpellScript);
- public:
- spell_ahn_kahet_swarm_SpellScript()
- {
- _targetCount = 0;
- }
-
- 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)
@@ -279,7 +270,7 @@ class spell_ahn_kahet_swarm : public SpellScriptLoader
OnEffectHit += SpellEffectFn(spell_ahn_kahet_swarm_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
- uint32 _targetCount;
+ uint32 _targetCount = 0;
};
SpellScript* GetSpellScript() const override
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 0d0389c79d7..f552fdfa080 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,14 @@
*/
#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 "TemporarySummon.h"
enum Spells
{
@@ -105,7 +109,7 @@ public:
}
}
- void SpellHitTarget(Unit* target, const SpellInfo* spell) override
+ void SpellHitTarget(Unit* target, SpellInfo const* spell) override
{
if (spell->Id == SPELL_INSANITY)
{
@@ -124,7 +128,7 @@ public:
// phase mask
target->CastSpell(target, SPELL_INSANITY_TARGET+insanityHandled, true);
// summon twisted party members for this target
- Map::PlayerList const &players = me->GetMap()->GetPlayers();
+ Map::PlayerList const& players = me->GetMap()->GetPlayers();
for (Map::PlayerList::const_iterator i = players.begin(); i != players.end(); ++i)
{
Player* player = i->GetSource();
@@ -145,7 +149,7 @@ public:
void ResetPlayersPhaseMask()
{
- Map::PlayerList const &players = me->GetMap()->GetPlayers();
+ Map::PlayerList const& players = me->GetMap()->GetPlayers();
for (Map::PlayerList::const_iterator i = players.begin(); i != players.end(); ++i)
{
Player* player = i->GetSource();
@@ -230,7 +234,7 @@ public:
// Roll Insanity
uint32 spell = GetSpellForPhaseMask(phase);
uint32 spell2 = GetSpellForPhaseMask(nextPhase);
- Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers();
+ Map::PlayerList const& PlayerList = me->GetMap()->GetPlayers();
if (!PlayerList.isEmpty())
{
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
@@ -306,7 +310,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 8ee342db3a4..30ba1180663 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 "MotionMaster.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.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 4124ff1a0a7..fcb37f56a87 100644
--- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp
@@ -16,11 +16,17 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "ahnkahet.h"
+#include "GameObject.h"
#include "GameObjectAI.h"
-#include "SpellScript.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "Player.h"
-#include "ahnkahet.h"
+#include "ScriptedCreature.h"
+#include "Spell.h"
+#include "SpellScript.h"
enum Spells
{
@@ -254,7 +260,7 @@ class boss_prince_taldaram : public CreatureScript
if (_embraceTargetGUID)
return ObjectAccessor::GetUnit(*me, _embraceTargetGUID);
- return NULL;
+ return nullptr;
}
void RemovePrison()
@@ -371,7 +377,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);
}
};
@@ -431,11 +437,7 @@ 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 bbd55c7944d..7e42df81f21 100644
--- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/azjol_nerub.h
+++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/azjol_nerub.h
@@ -18,6 +18,9 @@
#ifndef AZJOL_NERUB_H_
#define AZJOL_NERUB_H_
+#include "CreatureAIImpl.h"
+
+#define AzjolNerubScriptName "instance_azjol_nerub"
#define DataHeader "AN"
uint32 const EncounterCount = 3;
@@ -62,4 +65,10 @@ enum ANGameObjectIds
GO_ANUBARAK_DOOR_3 = 192398
};
+template <class AI, class T>
+inline AI* GetAzjolNerubAI(T* obj)
+{
+ return GetInstanceAI<AI>(obj, AzjolNerubScriptName);
+}
+
#endif // AZJOL_NERUB_H_
diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp
index 919f008c108..ebedf88f45a 100644
--- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp
@@ -16,10 +16,17 @@
*/
#include "ScriptMgr.h"
+#include "AreaBoundary.h"
+#include "azjol_nerub.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
+#include "PassiveAI.h"
#include "ScriptedCreature.h"
+#include "SpellInfo.h"
#include "SpellScript.h"
-#include "PassiveAI.h"
-#include "azjol_nerub.h"
+#include "TemporarySummon.h"
enum Spells
{
@@ -405,7 +412,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_anub_arakAI>(creature);
+ return GetAzjolNerubAI<boss_anub_arakAI>(creature);
}
};
@@ -463,7 +470,7 @@ class npc_anubarak_anub_ar_darter : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_anubarak_anub_ar_darterAI>(creature);
+ return GetAzjolNerubAI<npc_anubarak_anub_ar_darterAI>(creature);
}
};
@@ -530,7 +537,7 @@ class npc_anubarak_anub_ar_assassin : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_anubarak_anub_ar_assassinAI>(creature);
+ return GetAzjolNerubAI<npc_anubarak_anub_ar_assassinAI>(creature);
}
};
@@ -565,7 +572,7 @@ class npc_anubarak_anub_ar_guardian : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_anubarak_anub_ar_guardianAI>(creature);
+ return GetAzjolNerubAI<npc_anubarak_anub_ar_guardianAI>(creature);
}
};
@@ -600,7 +607,7 @@ class npc_anubarak_anub_ar_venomancer : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_anubarak_anub_ar_venomancerAI>(creature);
+ return GetAzjolNerubAI<npc_anubarak_anub_ar_venomancerAI>(creature);
}
};
@@ -628,7 +635,7 @@ class npc_anubarak_impale_target : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_anubarak_impale_targetAI>(creature);
+ return GetAzjolNerubAI<npc_anubarak_impale_targetAI>(creature);
}
};
@@ -643,7 +650,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*/)
@@ -676,7 +683,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 fc50bb3f0aa..faaa22cf9ac 100644
--- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp
@@ -16,11 +16,15 @@
*/
#include "ScriptMgr.h"
+#include "azjol_nerub.h"
+#include "InstanceScript.h"
+#include "MotionMaster.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
{
@@ -391,7 +395,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_hadronoxAI>(creature);
+ return GetAzjolNerubAI<boss_hadronoxAI>(creature);
}
};
@@ -569,7 +573,7 @@ class npc_anub_ar_crusher : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_anub_ar_crusherAI>(creature);
+ return GetAzjolNerubAI<npc_anub_ar_crusherAI>(creature);
}
};
@@ -612,7 +616,7 @@ class npc_anub_ar_crusher_champion : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_anub_ar_crusher_championAI>(creature);
+ return GetAzjolNerubAI<npc_anub_ar_crusher_championAI>(creature);
}
};
@@ -655,7 +659,7 @@ class npc_anub_ar_crusher_crypt_fiend : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_anub_ar_crusher_crypt_fiendAI>(creature);
+ return GetAzjolNerubAI<npc_anub_ar_crusher_crypt_fiendAI>(creature);
}
};
@@ -698,7 +702,7 @@ class npc_anub_ar_crusher_necromancer : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_anub_ar_crusher_necromancerAI>(creature);
+ return GetAzjolNerubAI<npc_anub_ar_crusher_necromancerAI>(creature);
}
};
@@ -857,7 +861,7 @@ class npc_anub_ar_champion : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_anub_ar_championAI>(creature);
+ return GetAzjolNerubAI<npc_anub_ar_championAI>(creature);
}
};
@@ -899,7 +903,7 @@ class npc_anub_ar_crypt_fiend : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_anub_ar_crypt_fiendAI>(creature);
+ return GetAzjolNerubAI<npc_anub_ar_crypt_fiendAI>(creature);
}
};
@@ -941,7 +945,7 @@ class npc_anub_ar_necromancer : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_anub_ar_necromancerAI>(creature);
+ return GetAzjolNerubAI<npc_anub_ar_necromancerAI>(creature);
}
};
@@ -951,11 +955,10 @@ class spell_hadronox_periodic_summon_template_AuraScript : public AuraScript
spell_hadronox_periodic_summon_template_AuraScript(uint32 topSpellId, uint32 bottomSpellId) : AuraScript(), _topSpellId(topSpellId), _bottomSpellId(bottomSpellId) { }
PrepareAuraScript(spell_hadronox_periodic_summon_template_AuraScript);
+ private:
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*/)
@@ -989,7 +992,6 @@ class spell_hadronox_periodic_summon_template_AuraScript : public AuraScript
OnEffectPeriodic += AuraEffectPeriodicFn(spell_hadronox_periodic_summon_template_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
- private:
uint32 _topSpellId;
uint32 _bottomSpellId;
};
@@ -1056,7 +1058,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 +1096,7 @@ 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 27b4e7702b1..506ddd8cad2 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
@@ -19,13 +19,15 @@
* Comment: Find in the future best timers and the event is not implemented.
*/
-#include "Containers.h"
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "SpellScript.h"
+#include "azjol_nerub.h"
+#include "Containers.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
{
@@ -319,7 +321,7 @@ class boss_krik_thir : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_krik_thirAI>(creature);
+ return GetAzjolNerubAI<boss_krik_thirAI>(creature);
}
};
@@ -482,7 +484,7 @@ class npc_watcher_gashra : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_watcher_gashraAI>(creature);
+ return GetAzjolNerubAI<npc_watcher_gashraAI>(creature);
}
};
@@ -560,7 +562,7 @@ class npc_watcher_narjil : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_watcher_narjilAI>(creature);
+ return GetAzjolNerubAI<npc_watcher_narjilAI>(creature);
}
};
@@ -638,7 +640,7 @@ class npc_watcher_silthik : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_watcher_silthikAI>(creature);
+ return GetAzjolNerubAI<npc_watcher_silthikAI>(creature);
}
};
@@ -698,7 +700,7 @@ class npc_anub_ar_warrior : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_anub_ar_warriorAI>(creature);
+ return GetAzjolNerubAI<npc_anub_ar_warriorAI>(creature);
}
};
@@ -766,7 +768,7 @@ class npc_anub_ar_skirmisher : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_anub_ar_skirmisherAI>(creature);
+ return GetAzjolNerubAI<npc_anub_ar_skirmisherAI>(creature);
}
};
@@ -827,7 +829,7 @@ class npc_anub_ar_shadowcaster : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_anub_ar_shadowcasterAI>(creature);
+ return GetAzjolNerubAI<npc_anub_ar_shadowcasterAI>(creature);
}
};
@@ -854,7 +856,7 @@ class npc_skittering_swarmer : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_skittering_swarmerAI>(creature);
+ return GetAzjolNerubAI<npc_skittering_swarmerAI>(creature);
}
};
@@ -887,7 +889,7 @@ class npc_skittering_infector : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_skittering_infectorAI>(creature);
+ return GetAzjolNerubAI<npc_skittering_infectorAI>(creature);
}
};
@@ -910,7 +912,7 @@ class npc_gatewatcher_web_wrap : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_gatewatcher_web_wrapAI>(creature);
+ return GetAzjolNerubAI<npc_gatewatcher_web_wrapAI>(creature);
}
};
@@ -977,7 +979,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*/)
@@ -1009,7 +1011,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*/)
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 b45940e2e79..eb6692f0251 100644
--- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp
@@ -16,47 +16,51 @@
*/
#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[] =
{
- { GO_KRIKTHIR_DOOR, DATA_KRIKTHIR, DOOR_TYPE_PASSAGE },
- { GO_ANUBARAK_DOOR_1, DATA_ANUBARAK, DOOR_TYPE_ROOM },
- { GO_ANUBARAK_DOOR_2, DATA_ANUBARAK, DOOR_TYPE_ROOM },
- { GO_ANUBARAK_DOOR_3, DATA_ANUBARAK, DOOR_TYPE_ROOM },
- { 0, 0, DOOR_TYPE_ROOM } // END
+ { GO_KRIKTHIR_DOOR, DATA_KRIKTHIR, DOOR_TYPE_PASSAGE },
+ { GO_ANUBARAK_DOOR_1, DATA_ANUBARAK, DOOR_TYPE_ROOM },
+ { GO_ANUBARAK_DOOR_2, DATA_ANUBARAK, DOOR_TYPE_ROOM },
+ { GO_ANUBARAK_DOOR_3, DATA_ANUBARAK, DOOR_TYPE_ROOM },
+ { 0, 0, DOOR_TYPE_ROOM } // END
};
ObjectData const creatureData[] =
{
- { NPC_KRIKTHIR, DATA_KRIKTHIR },
- { NPC_HADRONOX, DATA_HADRONOX },
- { NPC_ANUBARAK, DATA_ANUBARAK },
- { NPC_WATCHER_NARJIL, DATA_WATCHER_GASHRA },
- { NPC_WATCHER_GASHRA, DATA_WATCHER_SILTHIK },
- { NPC_WATCHER_SILTHIK, DATA_WATCHER_NARJIL },
- { 0, 0 } // END
+ { NPC_KRIKTHIR, DATA_KRIKTHIR },
+ { NPC_HADRONOX, DATA_HADRONOX },
+ { NPC_ANUBARAK, DATA_ANUBARAK },
+ { NPC_WATCHER_NARJIL, DATA_WATCHER_GASHRA },
+ { NPC_WATCHER_GASHRA, DATA_WATCHER_SILTHIK },
+ { NPC_WATCHER_SILTHIK, DATA_WATCHER_NARJIL },
+ { 0, 0 } // END
};
ObjectData const gameobjectData[] =
{
- { GO_ANUBARAK_DOOR_1, DATA_ANUBARAK_WALL },
+ { GO_ANUBARAK_DOOR_1, DATA_ANUBARAK_WALL },
{ GO_ANUBARAK_DOOR_3, DATA_ANUBARAK_WALL_2 },
- { 0, 0 } // END
+ { 0, 0 } // END
};
BossBoundaryData const boundaries =
{
- { DATA_KRIKTHIR, new RectangleBoundary(400.0f, 580.0f, 623.5f, 810.0f) },
- { DATA_HADRONOX, new ZRangeBoundary(666.0f, 776.0f) },
+ { DATA_KRIKTHIR, new RectangleBoundary(400.0f, 580.0f, 623.5f, 810.0f) },
+ { DATA_HADRONOX, new ZRangeBoundary(666.0f, 776.0f) },
{ DATA_ANUBARAK, new CircleBoundary(Position(550.6178f, 253.5917f), 26.0f) }
};
class instance_azjol_nerub : public InstanceMapScript
{
public:
- instance_azjol_nerub() : InstanceMapScript("instance_azjol_nerub", 601) { }
+ instance_azjol_nerub() : InstanceMapScript(AzjolNerubScriptName, 601) { }
struct instance_azjol_nerub_InstanceScript : public InstanceScript
{
diff --git a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp
index 71487b5e048..11c48439da4 100644
--- a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp
+++ b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp
@@ -16,12 +16,14 @@
*/
#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 "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "obsidian_sanctum.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..22eb9cdb04a 100644
--- a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.cpp
+++ b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.cpp
@@ -16,12 +16,14 @@
*/
#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 "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "obsidian_sanctum.h"
+#include "ScriptedCreature.h"
+#include "TemporarySummon.h"
enum Enums
{
@@ -322,7 +324,7 @@ struct dummy_dragonAI : public ScriptedAI
void JustDied(Unit* /*killer*/) override
{
if (!_canLoot)
- me->SetLootRecipient(NULL);
+ me->SetLootRecipient(nullptr);
uint32 spellId = 0;
@@ -736,7 +738,7 @@ class npc_acolyte_of_vesperon : public CreatureScript
vesperon->RemoveAurasDueToSpell(SPELL_TWILIGHT_TORMENT_VESP);
}
- Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers();
+ Map::PlayerList const& PlayerList = me->GetMap()->GetPlayers();
if (PlayerList.isEmpty())
return;
@@ -904,7 +906,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_flame_tsunamiAI(creature);
+ return GetObsidianSanctumAI<npc_flame_tsunamiAI>(creature);
}
};
@@ -958,7 +960,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_twilight_fissureAI(creature);
+ return GetObsidianSanctumAI<npc_twilight_fissureAI>(creature);
}
};
@@ -1013,7 +1015,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..00547e204c6 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,10 +48,10 @@ enum OSGameObjectIds
GO_TWILIGHT_PORTAL = 193988
};
-template<class AI>
-AI* GetObsidianSanctumAI(Creature* creature)
+template <class AI, class T>
+inline AI* GetObsidianSanctumAI(T* obj)
{
- return GetInstanceAI<AI>(creature, OSScriptName);
+ return GetInstanceAI<AI>(obj, OSScriptName);
}
#endif // OBSIDIAN_SANCTUM_H_
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 9bc4de0ae92..16955384cb8 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
@@ -15,11 +15,12 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptedCreature.h"
#include "ScriptMgr.h"
-#include "SpellScript.h"
-#include "SpellAuraEffects.h"
+#include "InstanceScript.h"
#include "ruby_sanctum.h"
+#include "ScriptedCreature.h"
+#include "SpellAuraEffects.h"
+#include "SpellScript.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 6a3a185061b..d835549ad17 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,11 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedEscortAI.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "ruby_sanctum.h"
+#include "ScriptedCreature.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 a85b07f95c3..1256e5745b3 100644
--- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp
+++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp
@@ -16,15 +16,20 @@
*/
#include "ScriptMgr.h"
-#include "SpellScript.h"
-#include "SpellAuraEffects.h"
-#include "Spell.h"
-#include "Vehicle.h"
-#include "MapManager.h"
+#include "DBCStores.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
{
@@ -759,7 +764,7 @@ class npc_halion_controller : public CreatureScript
void DoCheckEvade()
{
- Map::PlayerList const &players = me->GetMap()->GetPlayers();
+ Map::PlayerList const& players = me->GetMap()->GetPlayers();
for (Map::PlayerList::const_iterator i = players.begin(); i != players.end(); ++i)
if (Player* player = i->GetSource())
if (player->IsAlive() && CheckBoundary(player) && !player->IsGameMaster())
@@ -1438,11 +1443,10 @@ class spell_halion_combustion_consumption : public SpellScriptLoader
public:
spell_halion_combustion_consumption_AuraScript(uint32 spellID) : AuraScript(), _markSpell(spellID) { }
- bool Validate(SpellInfo const* /*spell*/) override
+ private:
+ bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(_markSpell))
- return false;
- return true;
+ return ValidateSpellInfo({ _markSpell });
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -1494,9 +1498,7 @@ class spell_halion_combustion_consumption_periodic : public SpellScriptLoader
bool Validate(SpellInfo const* spellInfo) override
{
- if (!sSpellMgr->GetSpellInfo(spellInfo->Effects[EFFECT_0].TriggerSpell))
- return false;
- return true;
+ return ValidateSpellInfo({ spellInfo->Effects[EFFECT_0].TriggerSpell });
}
void HandleTick(AuraEffect const* aurEff)
@@ -1538,11 +1540,10 @@ class spell_halion_marks : public SpellScriptLoader
spell_halion_marks_AuraScript(uint32 summonSpell, uint32 removeSpell) : AuraScript(),
_summonSpellId(summonSpell), _removeSpellId(removeSpell) { }
+ private:
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(_summonSpellId))
- return false;
- return true;
+ return ValidateSpellInfo({ _summonSpellId, _removeSpellId });
}
/// We were purged. Force removed stacks to zero and trigger the appropriated remove handler.
@@ -1623,7 +1624,7 @@ class spell_halion_damage_aoe_summon : public SpellScriptLoader
class spell_halion_twilight_realm_handlers : public SpellScriptLoader
{
public:
- spell_halion_twilight_realm_handlers(const char* scriptName, uint32 beforeHitSpell, bool isApplyHandler) : SpellScriptLoader(scriptName),
+ spell_halion_twilight_realm_handlers(char const* scriptName, uint32 beforeHitSpell, bool isApplyHandler) : SpellScriptLoader(scriptName),
_beforeHitSpell(beforeHitSpell), _isApplyHandler(isApplyHandler)
{ }
@@ -1636,11 +1637,10 @@ class spell_halion_twilight_realm_handlers : public SpellScriptLoader
_isApply(isApplyHandler), _beforeHitSpellId(beforeHitSpell)
{ }
+ private:
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(_beforeHitSpellId))
- return false;
- return true;
+ return ValidateSpellInfo({ _beforeHitSpellId });
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*handle*/)
@@ -1697,11 +1697,7 @@ 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)
@@ -1785,9 +1781,7 @@ class spell_halion_twilight_phasing : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_TWILIGHT_PORTAL))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SUMMON_TWILIGHT_PORTAL });
}
void Phase()
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 96d64012489..e1f01fdfea4 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,11 @@
*/
#include "ScriptMgr.h"
+#include "Map.h"
+#include "MotionMaster.h"
+#include "ruby_sanctum.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
-#include "ruby_sanctum.h"
enum Texts
{
@@ -229,10 +231,7 @@ class spell_saviana_conflagration_init : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_FLAME_BEACON)
- || !sSpellMgr->GetSpellInfo(SPELL_CONFLAGRATION_2))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_FLAME_BEACON, SPELL_CONFLAGRATION_2 });
}
void FilterTargets(std::list<WorldObject*>& targets)
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 c9d68808c12..db2fc0b407b 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 "AreaBoundary.h"
+#include "CreatureAI.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "ruby_sanctum.h"
#include "TemporarySummon.h"
#include "WorldPacket.h"
-#include "ruby_sanctum.h"
+
+Position const HalionControllerSpawnPos = { 3156.037f, 533.2656f, 72.97205f, 0.0f };
BossBoundaryData const boundaries =
{
@@ -68,7 +72,6 @@ ObjectData const gameObjectData[] =
{ 0, 0 } //END
};
-
class instance_ruby_sanctum : public InstanceMapScript
{
public:
diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.cpp
index d298c35dd0a..e43b93e484d 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 "MotionMaster.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)
@@ -205,7 +205,6 @@ class spell_ruby_sanctum_rallying_shout : public SpellScriptLoader
OnEffectHit += SpellEffectFn(spell_ruby_sanctum_rallying_shout_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
- private:
uint32 _targetCount = 0;
};
diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.h b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.h
index 6411037ad70..c8286cefda4 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
@@ -129,25 +129,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 nullptr;
-}
-
-template<class AI>
-GameObjectAI* GetRubySanctumAI(GameObject* go)
+template <class AI, class 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 nullptr;
+ 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 0b6c7738cc9..1061dc37aff 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,13 @@ SDCategory: Trial of the Champion
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "InstanceScript.h"
+#include "MotionMaster.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 +256,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_eadricAI>(creature);
+ return GetTrialOfTheChampionAI<boss_eadricAI>(creature);
}
};
@@ -415,7 +418,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_paletressAI>(creature);
+ return GetTrialOfTheChampionAI<boss_paletressAI>(creature);
}
};
@@ -492,7 +495,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_memoryAI(creature);
+ return GetTrialOfTheChampionAI<npc_memoryAI>(creature);
}
};
@@ -605,7 +608,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_argent_soldierAI>(creature);
+ return GetTrialOfTheChampionAI<npc_argent_soldierAI>(creature);
}
};
@@ -650,10 +653,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)
@@ -668,7 +668,7 @@ class spell_paletress_summon_memory : public SpellScriptLoader
void HandleScript(SpellEffIndex /*effIndex*/)
{
- GetHitUnit()->CastSpell(GetHitUnit(), memorySpellId[urand(0, 24)], true, NULL, NULL, GetCaster()->GetGUID());
+ GetHitUnit()->CastSpell(GetHitUnit(), memorySpellId[urand(0, 24)], true, nullptr, nullptr, GetCaster()->GetGUID());
}
void Register() override
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 1bc8a45cbe2..5181b125fdf 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
{
@@ -95,7 +97,7 @@ const Point MovementPoint[] =
*/
void AggroAllPlayers(Creature* temp)
{
- Map::PlayerList const &PlList = temp->GetMap()->GetPlayers();
+ Map::PlayerList const& PlList = temp->GetMap()->GetPlayers();
if (PlList.isEmpty())
return;
@@ -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 d05c2c303a4..5596c77bb71 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,17 +22,22 @@ 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 "Log.h"
+#include "Map.h"
+#include "MotionMaster.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
{
@@ -89,7 +94,7 @@ public:
void OnCreatureCreate(Creature* creature) override
{
- Map::PlayerList const &players = instance->GetPlayers();
+ Map::PlayerList const& players = instance->GetPlayers();
uint32 TeamInInstance = 0;
if (!players.isEmpty())
@@ -180,7 +185,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);
}
}
}
@@ -203,7 +208,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:
@@ -212,7 +217,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;
}
@@ -287,7 +292,7 @@ public:
return str_data;
}
- void Load(const char* in) override
+ void Load(char const* in) override
{
if (!in)
{
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 f31010c9676..4dc43888726 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,17 @@ npc_announcer_toc5
EndContentData */
#include "ScriptMgr.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "MotionMaster.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
{
@@ -362,8 +368,7 @@ public:
void AggroAllPlayers(Creature* temp)
{
- Map::PlayerList const &PlList = me->GetMap()->GetPlayers();
-
+ Map::PlayerList const& PlList = me->GetMap()->GetPlayers();
if (PlList.isEmpty())
return;
@@ -482,7 +487,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_announcer_toc5AI>(creature);
+ return GetTrialOfTheChampionAI<npc_announcer_toc5AI>(creature);
}
};
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..e4e67a6565d 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, class T>
+inline AI* GetTrialOfTheChampionAI(T* obj)
+{
+ return GetInstanceAI<AI>(obj, 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 96fe86446f2..60479c6be30 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,15 @@
// Scarab - Kill credit isn't crediting?
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
-#include "trial_of_the_crusader.h"
-#include "SpellScript.h"
#include "SpellAuraEffects.h"
-#include <limits>
+#include "SpellMgr.h"
+#include "SpellScript.h"
+#include "TemporarySummon.h"
+#include "trial_of_the_crusader.h"
enum Yells
{
@@ -428,7 +432,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);
};
};
@@ -506,7 +510,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);
};
};
@@ -600,7 +604,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);
};
};
@@ -626,7 +630,8 @@ class npc_frost_sphere : public CreatureScript
if (me->GetHealth() <= damage)
{
damage = 0;
- float floorZ = me->GetMap()->GetHeight(me->GetPhaseMask(), 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
@@ -671,7 +676,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);
};
};
@@ -824,7 +829,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);
};
};
@@ -870,9 +875,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 9ca1dee21f3..ef37afffc04 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,17 @@
*/
#include "ScriptMgr.h"
+#include "GridNotifiers.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptedCreature.h"
-#include "SpellScript.h"
#include "SpellAuraEffects.h"
+#include "SpellScript.h"
+#include "TemporarySummon.h"
#include "trial_of_the_crusader.h"
-#include "Player.h"
-#include "GridNotifiers.h"
enum Yells
{
@@ -339,6 +344,32 @@ enum Events
EVENT_SPELL_LOCK = 2
};
+Position const 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:
@@ -545,7 +576,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);
}
};
@@ -631,7 +662,7 @@ struct boss_faction_championsAI : public BossAI
{
if (who->GetTypeId() == TYPEID_PLAYER)
{
- Map::PlayerList const &players = me->GetMap()->GetPlayers();
+ Map::PlayerList const& players = me->GetMap()->GetPlayers();
uint32 TeamInInstance = 0;
if (!players.isEmpty())
@@ -655,7 +686,7 @@ struct boss_faction_championsAI : public BossAI
std::list<Creature*> lst = DoFindFriendlyMissingBuff(40.0f, spell);
std::list<Creature*>::const_iterator itr = lst.begin();
if (lst.empty())
- return NULL;
+ return nullptr;
advance(itr, rand32() % lst.size());
return (*itr);
}
@@ -670,7 +701,7 @@ struct boss_faction_championsAI : public BossAI
if (target && target->getPowerType() == POWER_MANA)
return target;
}
- return NULL;
+ return nullptr;
}
uint32 EnemiesInRange(float distance)
@@ -835,7 +866,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 +959,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 +1063,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 +1148,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 +1246,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 +1337,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 +1431,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 +1533,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 +1625,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 +1729,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 +1825,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 +1930,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 +2064,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 +2170,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 +2222,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 +2270,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,15 +2285,13 @@ 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)
{
if (Unit* caster = GetCaster())
- caster->CastSpell(dispelInfo->GetDispeller(), SPELL_UNSTABLE_AFFLICTION_DISPEL, true, NULL, GetEffect(EFFECT_0));
+ caster->CastSpell(dispelInfo->GetDispeller(), SPELL_UNSTABLE_AFFLICTION_DISPEL, true, nullptr, GetEffect(EFFECT_0));
}
void Register() override
@@ -2288,9 +2317,7 @@ 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*/)
@@ -2326,9 +2353,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 +2392,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 30a0138a689..7b6a20c1dd7 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp
@@ -17,9 +17,12 @@
*/
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "Player.h"
#include "ScriptedCreature.h"
+#include "SpellInfo.h"
+#include "SpellMgr.h"
#include "SpellScript.h"
-#include "Player.h"
#include "trial_of_the_crusader.h"
enum Yells
@@ -207,7 +210,7 @@ class boss_jaraxxus : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_jaraxxusAI>(creature);
+ return GetTrialOfTheCrusaderAI<boss_jaraxxusAI>(creature);
}
};
@@ -243,7 +246,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);
}
};
@@ -297,7 +300,7 @@ class npc_infernal_volcano : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_infernal_volcanoAI(creature);
+ return GetTrialOfTheCrusaderAI<npc_infernal_volcanoAI>(creature);
}
};
@@ -350,7 +353,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);
}
};
@@ -401,7 +404,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);
}
};
@@ -479,7 +482,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);
}
};
@@ -591,9 +594,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 258e392edde..81cd4ff8470 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp
@@ -17,12 +17,17 @@
*/
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptedCreature.h"
+#include "SpellAuraEffects.h"
+#include "SpellScript.h"
+#include "TemporarySummon.h"
#include "trial_of_the_crusader.h"
#include "Vehicle.h"
-#include "Player.h"
-#include "SpellScript.h"
-#include "SpellAuraEffects.h"
enum Yells
{
@@ -290,7 +295,7 @@ class boss_gormok : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_gormokAI>(creature);
+ return GetTrialOfTheCrusaderAI<boss_gormokAI>(creature);
}
};
@@ -463,7 +468,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);
}
};
@@ -499,7 +504,7 @@ class npc_firebomb : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_firebombAI>(creature);
+ return GetTrialOfTheCrusaderAI<npc_firebombAI>(creature);
}
};
@@ -727,7 +732,7 @@ class boss_acidmaw : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_acidmawAI>(creature);
+ return GetTrialOfTheCrusaderAI<boss_acidmawAI>(creature);
}
};
@@ -791,7 +796,7 @@ class boss_dreadscale : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_dreadscaleAI>(creature);
+ return GetTrialOfTheCrusaderAI<boss_dreadscaleAI>(creature);
}
};
@@ -838,7 +843,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);
}
};
@@ -853,7 +858,7 @@ class spell_gormok_fire_bomb : public SpellScriptLoader
void TriggerFireBomb(SpellEffIndex /*effIndex*/)
{
- if (const WorldLocation* pos = GetExplTargetDest())
+ if (WorldLocation const* pos = GetExplTargetDest())
{
if (Unit* caster = GetCaster())
caster->SummonCreature(NPC_FIRE_BOMB, pos->GetPositionX(), pos->GetPositionY(), pos->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 30*IN_MILLISECONDS);
@@ -1102,7 +1107,7 @@ class boss_icehowl : public CreatureScript
}
if (events.ExecuteEvent() == EVENT_TRAMPLE)
{
- Map::PlayerList const &lPlayers = me->GetMap()->GetPlayers();
+ Map::PlayerList const& lPlayers = me->GetMap()->GetPlayers();
for (Map::PlayerList::const_iterator itr = lPlayers.begin(); itr != lPlayers.end(); ++itr)
{
if (Unit* player = itr->GetSource())
@@ -1155,7 +1160,7 @@ class boss_icehowl : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_icehowlAI>(creature);
+ return GetTrialOfTheCrusaderAI<boss_icehowlAI>(creature);
}
};
@@ -1170,9 +1175,7 @@ public:
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_RIDE_PLAYER))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_RIDE_PLAYER });
}
bool Load() override
@@ -1268,9 +1271,7 @@ public:
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_RIDE_PLAYER))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_RIDE_PLAYER });
}
void OnPeriodic(AuraEffect const* /*aurEff*/)
@@ -1302,9 +1303,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*/)
@@ -1340,7 +1339,7 @@ public:
slowEff->ChangeAmount(newAmount);
if (newAmount <= -100 && !GetTarget()->HasAura(SPELL_PARALYSIS))
- GetTarget()->CastSpell(GetTarget(), SPELL_PARALYSIS, true, NULL, slowEff, GetCasterGUID());
+ GetTarget()->CastSpell(GetTarget(), SPELL_PARALYSIS, true, nullptr, slowEff, GetCasterGUID());
}
}
@@ -1362,7 +1361,7 @@ public:
class spell_jormungars_snakes_spray : public SpellScriptLoader
{
public:
- spell_jormungars_snakes_spray(const char* name, uint32 spellId) : SpellScriptLoader(name), _spellId(spellId) { }
+ spell_jormungars_snakes_spray(char const* name, uint32 spellId) : SpellScriptLoader(name), _spellId(spellId) { }
class spell_jormungars_snakes_spray_SpellScript : public SpellScript
{
@@ -1371,11 +1370,10 @@ public:
public:
spell_jormungars_snakes_spray_SpellScript(uint32 spellId) : SpellScript(), _spellId(spellId) { }
+ private:
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(_spellId))
- return false;
- return true;
+ return ValidateSpellInfo({ _spellId });
}
void HandleScript(SpellEffIndex /*effIndex*/)
@@ -1389,7 +1387,6 @@ public:
OnEffectHitTarget += SpellEffectFn(spell_jormungars_snakes_spray_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
}
- private:
uint32 _spellId;
};
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 598caddd72f..ba4c19b316d 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,16 @@
// - Hardcoded bullets spawner
#include "ScriptMgr.h"
+#include "CellImpl.h"
+#include "GridNotifiersImpl.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.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 "SpellMgr.h"
+#include "SpellScript.h"
#include "trial_of_the_crusader.h"
enum Texts
@@ -451,7 +453,7 @@ class boss_fjola : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_fjolaAI>(creature);
+ return GetTrialOfTheCrusaderAI<boss_fjolaAI>(creature);
}
};
@@ -484,7 +486,7 @@ class boss_eydis : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_eydisAI>(creature);
+ return GetTrialOfTheCrusaderAI<boss_eydisAI>(creature);
}
};
@@ -526,7 +528,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);
};
};
@@ -617,7 +619,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);
}
};
@@ -638,9 +640,9 @@ class npc_unleashed_light : public CreatureScript
{
DoCastAOE(SPELL_UNLEASHED_LIGHT_HELPER);
me->GetMotionMaster()->MoveIdle();
- me->DespawnOrUnsummon(1*IN_MILLISECONDS);
+ me->DespawnOrUnsummon(1 * IN_MILLISECONDS);
}
- RangeCheckTimer = 0.5*IN_MILLISECONDS;
+ RangeCheckTimer = IN_MILLISECONDS / 2;
}
else
RangeCheckTimer -= diff;
@@ -649,7 +651,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);
}
};
@@ -678,7 +680,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);
}
};
@@ -691,16 +693,8 @@ class spell_powering_up : public SpellScriptLoader
{
PrepareSpellScript(spell_powering_up_SpellScript);
- public:
- spell_powering_up_SpellScript()
- {
- spellId = 0;
- poweringUp = 0;
- }
-
- private:
- uint32 spellId;
- uint32 poweringUp;
+ uint32 spellId = 0;
+ uint32 poweringUp = 0;
bool Load() override
{
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 4bf162838d0..506f076be33 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
@@ -17,23 +17,29 @@
*/
#include "ScriptMgr.h"
+#include "AreaBoundary.h"
+#include "GameObject.h"
#include "InstanceScript.h"
-#include "trial_of_the_crusader.h"
+#include "Log.h"
+#include "Map.h"
+#include "ObjectAccessor.h"
#include "Player.h"
#include "TemporarySummon.h"
+#include "trial_of_the_crusader.h"
-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) },
- { BOSS_VALKIRIES, new CircleBoundary(Position(563.26f, 139.6f), 75.0) },
- { BOSS_ANUBARAK, new EllipseBoundary(Position(746.0f, 135.0f), 100.0, 75.0) }
+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) },
+ { BOSS_VALKIRIES, new CircleBoundary(Position(563.26f, 139.6f), 75.0) },
+ { BOSS_ANUBARAK, new EllipseBoundary(Position(746.0f, 135.0f), 100.0, 75.0) }
};
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
{
@@ -314,7 +320,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;
}
@@ -346,7 +352,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript
{
--TrialCounter;
// decrease attempt counter at wipe
- Map::PlayerList const &PlayerList = instance->GetPlayers();
+ Map::PlayerList const& PlayerList = instance->GetPlayers();
for (Map::PlayerList::const_iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr)
if (Player* player = itr->GetSource())
player->SendUpdateWorldState(UPDATE_STATE_UI_COUNT, TrialCounter);
@@ -640,7 +646,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript
return SaveDataBuffer;
}
- void Load(const char* strIn) override
+ void Load(char const* strIn) override
{
if (!strIn)
{
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 084ce0b614d..c966f74cd89 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,16 @@
// - Need better implementation of Gossip and correct gossip text and option
#include "ScriptMgr.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "MotionMaster.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 +87,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[] =
+{
+ { 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[] =
+{
+ { 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;
@@ -206,7 +279,7 @@ class npc_announcer_toc10 : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_announcer_toc10AI>(creature);
+ return GetTrialOfTheCrusaderAI<npc_announcer_toc10AI>(creature);
}
};
@@ -335,7 +408,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);
}
};
@@ -505,7 +578,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);
}
};
@@ -751,7 +824,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;
@@ -792,7 +865,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);
}
};
@@ -875,7 +948,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);
}
};
@@ -958,7 +1031,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..d744c7e1cd2 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) 2009-2010 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 <class AI, class T>
+inline AI* GetTrialOfTheCrusaderAI(T* obj)
+{
+ return GetInstanceAI<AI>(obj, 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 84734e48381..2a4f52e4ee1 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 66c44c01019..2bcfd7a70d6 100644
--- a/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp
+++ b/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp
@@ -16,9 +16,13 @@
*/
#include "ScriptMgr.h"
-#include "SpellScript.h"
-#include "ScriptedCreature.h"
#include "drak_tharon_keep.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
enum Yells
{
@@ -239,7 +243,7 @@ public:
if (Creature* crystalChannelTarget = crystal->FindNearestCreature(NPC_CRYSTAL_CHANNEL_TARGET, 5.0f))
{
if (active)
- crystalChannelTarget->CastSpell((Unit*)NULL, SPELL_BEAM_CHANNEL);
+ crystalChannelTarget->CastSpell((Unit*)nullptr, SPELL_BEAM_CHANNEL);
else if (crystalChannelTarget->HasUnitState(UNIT_STATE_CASTING))
crystalChannelTarget->CastStop();
}
@@ -374,15 +378,13 @@ 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*/)
{
for (uint8 i = 0; i < 2; ++i)
- GetCaster()->CastSpell((Unit*)NULL, SPELL_SUMMON_COPY_OF_MINIONS, true);
+ GetCaster()->CastSpell((Unit*)nullptr, SPELL_SUMMON_COPY_OF_MINIONS, true);
}
void Register() override
diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp
index 00676a0a3c3..74746235628 100644
--- a/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp
+++ b/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp
@@ -219,9 +219,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 50bf88593c2..fd8b209e0cb 100644
--- a/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp
+++ b/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp
@@ -16,10 +16,13 @@
*/
#include "ScriptMgr.h"
+#include "drak_tharon_keep.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
-#include "SpellScript.h"
#include "SpellAuraEffects.h"
-#include "drak_tharon_keep.h"
+#include "SpellScript.h"
enum Spells
{
@@ -136,7 +139,7 @@ class boss_trollgore : public CreatureScript
case EVENT_SPAWN:
for (uint8 i = 0; i < 3; ++i)
if (Creature* trigger = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_TROLLGORE_INVADER_SUMMONER_1 + i)))
- trigger->CastSpell(trigger, RAND(SPELL_SUMMON_INVADER_A, SPELL_SUMMON_INVADER_B, SPELL_SUMMON_INVADER_C), true, NULL, NULL, me->GetGUID());
+ trigger->CastSpell(trigger, RAND(SPELL_SUMMON_INVADER_A, SPELL_SUMMON_INVADER_B, SPELL_SUMMON_INVADER_C), true, nullptr, nullptr, me->GetGUID());
events.ScheduleEvent(EVENT_SPAWN, urand(30000, 40000));
break;
@@ -234,9 +237,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,16 +270,14 @@ 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)
{
if (aurEff->GetTickNumber() == 2)
if (Unit* caster = GetCaster())
- caster->CastSpell(GetTarget(), SPELL_CORPSE_EXPLODE_DAMAGE, true, NULL, aurEff);
+ caster->CastSpell(GetTarget(), SPELL_CORPSE_EXPLODE_DAMAGE, true, nullptr, aurEff);
}
void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -312,9 +311,7 @@ class spell_trollgore_invader_taunt : public SpellScriptLoader
bool Validate(SpellInfo const* spellInfo) override
{
- if (!sSpellMgr->GetSpellInfo(spellInfo->Effects[EFFECT_0].CalcValue()))
- return false;
- return true;
+ return ValidateSpellInfo({ static_cast<uint32>(spellInfo->Effects[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..02e29cc3763 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,10 +86,10 @@ enum DTKGameObjectIds
GO_NOVOS_CRYSTAL_4 = 189302
};
-template<class AI>
-AI* GetDrakTharonKeepAI(Creature* creature)
+template <class AI, class T>
+inline AI* GetDrakTharonKeepAI(T* obj)
{
- return GetInstanceAI<AI>(creature, DrakTharonKeepScriptName);
+ return GetInstanceAI<AI>(obj, DrakTharonKeepScriptName);
}
#endif // DRAK_THARON_KEEP_H_
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..dfd3f44ac6d 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,11 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "InstanceScript.h"
#include "drak_tharon_keep.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "ScriptedCreature.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 a7e679433c5..abab9f7ead7 100644
--- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp
@@ -16,10 +16,14 @@
*/
#include "ScriptMgr.h"
+#include "forge_of_souls.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
-#include "SpellScript.h"
#include "SpellAuraEffects.h"
-#include "forge_of_souls.h"
+#include "SpellScript.h"
enum Yells
{
@@ -212,7 +216,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 +256,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 2b5224947ba..32b815f1f6d 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,16 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "forge_of_souls.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "MotionMaster.h"
#include "Player.h"
-#include "SpellInfo.h"
+#include "ScriptedCreature.h"
#include "SpellAuraEffects.h"
+#include "SpellInfo.h"
#include "SpellScript.h"
-#include "forge_of_souls.h"
+#include "TemporarySummon.h"
/*
* @todo
@@ -217,7 +221,7 @@ class boss_devourer_of_souls : public CreatureScript
}
}
- void SpellHitTarget(Unit* /*target*/, const SpellInfo* spell) override
+ void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell) override
{
if (spell->Id == H_SPELL_PHANTOM_BLAST)
threeFaced = false;
@@ -342,7 +346,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 +362,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 +395,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*/)
@@ -439,9 +439,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 7a2c01ce17c..ae6be6f9ad2 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,10 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
#include "forge_of_souls.h"
#include "Player.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
enum Events
{
@@ -163,7 +163,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_sylvanas_fosAI>(creature);
+ return GetForgeOfSoulsAI<npc_sylvanas_fosAI>(creature);
}
};
@@ -272,7 +272,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..08721c431cc 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 <class AI, class T>
+inline AI* GetForgeOfSoulsAI(T* obj)
+{
+ return GetInstanceAI<AI>(obj, 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 2b6548bccc3..eac44c2d3f3 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,14 +16,16 @@
*/
#include "ScriptMgr.h"
-#include "InstanceScript.h"
+#include "AreaBoundary.h"
+#include "Creature.h"
#include "forge_of_souls.h"
+#include "InstanceScript.h"
+#include "Map.h"
#include "Player.h"
-
BossBoundaryData const boundaries =
{
- { DATA_BRONJAHM, new CircleBoundary(Position(5297.3f, 2506.45f), 100.96) },
+ { DATA_BRONJAHM, new CircleBoundary(Position(5297.3f, 2506.45f), 100.96) },
{ DATA_DEVOURER_OF_SOULS, new ParallelogramBoundary(Position(5663.56f, 2570.53f), Position(5724.39f, 2520.45f), Position(5570.36f, 2461.42f)) }
};
diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp
index 3128014ad51..356e6c230b7 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 "SpellMgr.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..4aec3a9ed78
--- /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(nullptr, 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..1d48ff6da1f
--- /dev/null
+++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_horAI.h
@@ -0,0 +1,32 @@
+/*
+ * 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 boss_horAI_h__
+#define boss_horAI_h__
+
+#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;
+};
+
+#endif // boss_horAI_h__
diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp
index b56301e8e65..00b9392eab8 100644
--- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp
@@ -16,10 +16,11 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "SpellScript.h"
-#include "SpellAuraEffects.h"
+#include "boss_horAI.h"
#include "halls_of_reflection.h"
+#include "InstanceScript.h"
+#include "SpellAuraEffects.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 af4e20ccb06..ab35de44aeb 100644
--- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp
@@ -16,13 +16,19 @@
*/
#include "ScriptMgr.h"
+#include "halls_of_reflection.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
+#include "MoveSplineInit.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
+#include "Spell.h"
+#include "SpellInfo.h"
#include "SpellScript.h"
+#include "TemporarySummon.h"
#include "Transport.h"
-#include "Player.h"
-#include "MoveSplineInit.h"
-#include "halls_of_reflection.h"
enum Text
{
@@ -338,6 +344,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:
@@ -1641,7 +1653,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);
}
};
@@ -1995,7 +2007,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);
}
};
@@ -2816,9 +2828,9 @@ class spell_hor_gunship_cannon_fire : public SpellScriptLoader
if (!urand(0, 2))
{
if (GetTarget()->GetEntry() == NPC_GUNSHIP_CANNON_HORDE)
- GetTarget()->CastSpell((Unit*)NULL, SPELL_GUNSHIP_CANNON_FIRE_MISSILE_HORDE, true);
+ GetTarget()->CastSpell((Unit*)nullptr, SPELL_GUNSHIP_CANNON_FIRE_MISSILE_HORDE, true);
else
- GetTarget()->CastSpell((Unit*)NULL, SPELL_GUNSHIP_CANNON_FIRE_MISSILE_ALLIANCE, true);
+ GetTarget()->CastSpell((Unit*)nullptr, SPELL_GUNSHIP_CANNON_FIRE_MISSILE_ALLIANCE, true);
}
}
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..8d1fe6961c7 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,10 @@
#ifndef HALLS_OF_REFLECTION_H_
#define HALLS_OF_REFLECTION_H_
+#include "CreatureAIImpl.h"
+#include "EventProcessor.h"
+#include "ObjectGuid.h"
+
#define HoRScriptName "instance_halls_of_reflection"
#define DataHeader "HOR"
@@ -192,51 +196,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,10 +219,10 @@ class GameObjectDeleteDelayEvent : public BasicEvent
ObjectGuid _gameObjectGUID;
};
-template<class AI>
-AI* GetHallsOfReflectionAI(Creature* creature)
+template <class AI, class T>
+inline AI* GetHallsOfReflectionAI(T* obj)
{
- return GetInstanceAI<AI>(creature, HoRScriptName);
+ return GetInstanceAI<AI>(obj, HoRScriptName);
}
#endif // HALLS_OF_REFLECTION_H_
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 694ef000ed1..936a1117b88 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,14 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "halls_of_reflection.h"
#include "InstanceScript.h"
+#include "Map.h"
#include "Player.h"
+#include "ScriptedCreature.h"
+#include "TemporarySummon.h"
#include "Transport.h"
#include "WorldPacket.h"
-#include "halls_of_reflection.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)
@@ -344,7 +346,7 @@ class instance_halls_of_reflection : public InstanceMapScript
if (Creature* lichking = instance->GetCreature(TheLichKingEscapeGUID))
{
- lichking->CastSpell((Unit*)NULL, SPELL_ACHIEV_CHECK, true);
+ lichking->CastSpell((Unit*)nullptr, SPELL_ACHIEV_CHECK, true);
lichking->DespawnOrUnsummon(1);
}
break;
@@ -438,7 +440,7 @@ class instance_halls_of_reflection : public InstanceMapScript
break;
case DATA_WAVE_COUNT:
if (_waveCount && data == NOT_STARTED)
- ProcessEvent(NULL, EVENT_DO_WIPE);
+ ProcessEvent(nullptr, EVENT_DO_WIPE);
break;
case DATA_FROSTSWORN_GENERAL:
if (data == DONE)
@@ -451,7 +453,7 @@ class instance_halls_of_reflection : public InstanceMapScript
if (_quelDelarState == NOT_STARTED)
{
if (Creature* bunny = instance->GetCreature(FrostmourneAltarBunnyGUID))
- bunny->CastSpell((Unit*)NULL, SPELL_ESSENCE_OF_CAPTURED);
+ bunny->CastSpell((Unit*)nullptr, SPELL_ESSENCE_OF_CAPTURED);
events.ScheduleEvent(EVENT_QUEL_DELAR_SUMMON_UTHER, 2000);
}
}
@@ -516,7 +518,7 @@ class instance_halls_of_reflection : public InstanceMapScript
switch (events.ExecuteEvent())
{
case EVENT_NEXT_WAVE:
- ProcessEvent(NULL, EVENT_ADD_WAVE);
+ ProcessEvent(nullptr, EVENT_ADD_WAVE);
break;
case EVENT_SPAWN_ESCAPE_EVENT:
SpawnEscapeEvent();
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 fc1395437c1..5b806daf2b2 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,14 @@
*/
#include "ScriptMgr.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "MotionMaster.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
{
@@ -167,7 +171,7 @@ class boss_garfrost : public CreatureScript
events.ScheduleEvent(EVENT_RESUME_ATTACK, 5000);
}
- void SpellHitTarget(Unit* target, const SpellInfo* spell) override
+ void SpellHitTarget(Unit* target, SpellInfo const* spell) override
{
if (spell->Id == SPELL_PERMAFROST_HELPER)
{
diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp
index 270f4d0c700..05bf39cb5fb 100644
--- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp
@@ -16,12 +16,17 @@
*/
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
+#include "pit_of_saron.h"
+#include "Player.h"
#include "ScriptedCreature.h"
+#include "SpellInfo.h"
#include "SpellScript.h"
-#include "SpellAuraEffects.h"
-#include "pit_of_saron.h"
+#include "TemporarySummon.h"
#include "Vehicle.h"
-#include "Player.h"
enum Spells
{
@@ -374,7 +379,7 @@ class boss_krick : public CreatureScript
if (Creature* temp = ObjectAccessor::GetCreature(*me, _instanceScript->GetGuidData(DATA_JAINA_SYLVANAS_1)))
temp->DespawnOrUnsummon();
- Creature* jainaOrSylvanas = NULL;
+ Creature* jainaOrSylvanas = nullptr;
if (_instanceScript->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE)
jainaOrSylvanas = me->SummonCreature(NPC_JAINA_PART1, outroPos[2], TEMPSUMMON_MANUAL_DESPAWN);
else
@@ -521,7 +526,7 @@ class spell_krick_explosive_barrage : public SpellScriptLoader
if (Unit* caster = GetCaster())
if (caster->GetTypeId() == TYPEID_UNIT)
{
- Map::PlayerList const &players = caster->GetMap()->GetPlayers();
+ Map::PlayerList const& players = caster->GetMap()->GetPlayers();
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
if (Player* player = itr->GetSource())
if (player->IsWithinDist(caster, 60.0f)) // don't know correct range
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 8ceceeff8e7..4e62380b983 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,17 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "SpellScript.h"
-#include "SpellAuraEffects.h"
+#include "InstanceScript.h"
+#include "MotionMaster.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 +391,7 @@ class boss_rimefang : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_rimefangAI(creature);
+ return GetPitOfSaronAI<boss_rimefangAI>(creature);
}
};
@@ -400,13 +404,13 @@ class player_overlord_brandAI : public PlayerAI
{
if (Creature* tyrannus = ObjectAccessor::GetCreature(*me, _tyrannusGUID))
if (Unit* victim = tyrannus->GetVictim())
- me->CastCustomSpell(SPELL_OVERLORD_BRAND_DAMAGE, SPELLVALUE_BASE_POINT0, damage, victim, true, NULL, NULL, tyrannus->GetGUID());
+ me->CastCustomSpell(SPELL_OVERLORD_BRAND_DAMAGE, SPELLVALUE_BASE_POINT0, damage, victim, true, nullptr, nullptr, tyrannus->GetGUID());
}
void HealDone(Unit* /*target*/, uint32& addHealth) override
{
if (Creature* tyrannus = ObjectAccessor::GetCreature(*me, _tyrannusGUID))
- me->CastCustomSpell(SPELL_OVERLORD_BRAND_HEAL, SPELLVALUE_BASE_POINT0, int32(addHealth * 5.5f), tyrannus, true, NULL, NULL, tyrannus->GetGUID());
+ me->CastCustomSpell(SPELL_OVERLORD_BRAND_HEAL, SPELLVALUE_BASE_POINT0, int32(addHealth * 5.5f), tyrannus, true, nullptr, nullptr, tyrannus->GetGUID());
}
void UpdateAI(uint32 /*diff*/) override { }
@@ -424,14 +428,6 @@ class spell_tyrannus_overlord_brand : public SpellScriptLoader
{
PrepareAuraScript(spell_tyrannus_overlord_brand_AuraScript);
- public:
- spell_tyrannus_overlord_brand_AuraScript()
- {
- oldAI = nullptr;
- oldAIState = false;
- }
-
- private:
bool Load() override
{
return GetCaster() && GetCaster()->GetEntry() == NPC_TYRANNUS;
@@ -466,8 +462,8 @@ class spell_tyrannus_overlord_brand : public SpellScriptLoader
AfterEffectRemove += AuraEffectRemoveFn(spell_tyrannus_overlord_brand_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
- PlayerAI* oldAI;
- bool oldAIState;
+ PlayerAI* oldAI = nullptr;
+ bool oldAIState = false;
};
AuraScript* GetAuraScript() const override
@@ -520,9 +516,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)
@@ -550,7 +544,7 @@ class at_tyrannus_event_starter : public AreaTriggerScript
public:
at_tyrannus_event_starter() : AreaTriggerScript("at_tyrannus_event_starter") { }
- bool OnTrigger(Player* player, const AreaTriggerEntry* /*at*/) override
+ bool OnTrigger(Player* player, AreaTriggerEntry const* /*at*/) override
{
InstanceScript* instance = player->GetInstanceScript();
if (player->IsGameMaster() || !instance)
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 652aed172fc..a5df7ecf2b5 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,9 @@
*/
#include "ScriptMgr.h"
+#include "Creature.h"
#include "InstanceScript.h"
+#include "Map.h"
#include "pit_of_saron.h"
#include "Player.h"
@@ -164,28 +166,6 @@ class instance_pit_of_saron : public InstanceMapScript
}
}
- void OnGameObjectCreate(GameObject* go) override
- {
- switch (go->GetEntry())
- {
- case GO_ICE_WALL:
- case GO_HALLS_OF_REFLECTION_PORTCULLIS:
- AddDoor(go, true);
- break;
- }
- }
-
- void OnGameObjectRemove(GameObject* go) override
- {
- switch (go->GetEntry())
- {
- case GO_ICE_WALL:
- case GO_HALLS_OF_REFLECTION_PORTCULLIS:
- AddDoor(go, false);
- break;
- }
- }
-
bool SetBossState(uint32 type, EncounterState state) override
{
if (!InstanceScript::SetBossState(type, state))
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 0e11e7f9089..bd73ab93c6d 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 "Map.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:
@@ -101,7 +116,7 @@ class npc_ymirjar_flamebearer : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_ymirjar_flamebearerAI(creature);
+ return GetPitOfSaronAI<npc_ymirjar_flamebearerAI>(creature);
}
};
@@ -155,7 +170,7 @@ class npc_iceborn_protodrake : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_iceborn_protodrakeAI(creature);
+ return GetPitOfSaronAI<npc_iceborn_protodrakeAI>(creature);
}
};
@@ -214,7 +229,7 @@ class npc_geist_ambusher : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_geist_ambusherAI(creature);
+ return GetPitOfSaronAI<npc_geist_ambusherAI>(creature);
}
};
@@ -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 9f2a1abd3a6..b82f897bf98 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,27 +115,16 @@ 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 <class AI, class T>
+inline AI* GetPitOfSaronAI(T* obj)
{
- return GetInstanceAI<AI>(creature, PoSScriptName);
+ return GetInstanceAI<AI>(obj, PoSScriptName);
}
#endif // PIT_OF_SARON_H_
diff --git a/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp b/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp
index 7af34da74bb..465bb9bcf24 100644
--- a/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp
+++ b/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp
@@ -20,8 +20,10 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "gundrak.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
+#include "ScriptedCreature.h"
#include "SpellInfo.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 9d3dbd4e2dd..90f1d4af510 100644
--- a/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp
+++ b/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp
@@ -16,9 +16,11 @@
*/
#include "ScriptMgr.h"
+#include "gundrak.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
+#include "SpellInfo.h"
#include "SpellScript.h"
-#include "gundrak.h"
enum Spells
{
@@ -250,9 +252,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 22c023983b9..9eac3162096 100644
--- a/src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp
+++ b/src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp
@@ -225,9 +225,7 @@ class spell_moorabi_mojo_frenzy : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_MOJO_FRENZY_CAST_SPEED))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_MOJO_FRENZY_CAST_SPEED });
}
void HandlePeriodic(AuraEffect const* /*aurEff*/)
diff --git a/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp b/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp
index 62d215f9161..fb00acb39dc 100644
--- a/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp
+++ b/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp
@@ -16,10 +16,12 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "SpellAuras.h"
#include "gundrak.h"
+#include "MotionMaster.h"
#include "Player.h"
+#include "ScriptedCreature.h"
+#include "SpellAuras.h"
+#include "TemporarySummon.h"
enum Spells
{
@@ -209,7 +211,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 +266,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 44f160e36b7..e25b6e7461b 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"
@@ -91,7 +93,7 @@ enum GDInstanceMisc
TIMER_STATUE_ACTIVATION = 3500
};
-template<class AI, class T>
+template <class AI, class T>
inline AI* GetGundrakAI(T* obj)
{
return GetInstanceAI<AI>(obj, GundrakScriptName);
diff --git a/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp b/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp
index 3dd8503ce9d..c9e5848d2f5 100644
--- a/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp
+++ b/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp
@@ -16,20 +16,23 @@
*/
#include "InstanceScript.h"
-#include "Player.h"
-#include "ScriptMgr.h"
+#include "Creature.h"
+#include "EventMap.h"
+#include "GameObject.h"
#include "GameObjectAI.h"
#include "gundrak.h"
-#include "EventMap.h"
+#include "Map.h"
+#include "Player.h"
+#include "ScriptMgr.h"
DoorData const doorData[] =
{
{ GO_GAL_DARAH_DOOR_1, DATA_GAL_DARAH, DOOR_TYPE_PASSAGE },
{ GO_GAL_DARAH_DOOR_2, DATA_GAL_DARAH, DOOR_TYPE_PASSAGE },
- { GO_GAL_DARAH_DOOR_3, DATA_GAL_DARAH, DOOR_TYPE_ROOM },
+ { GO_GAL_DARAH_DOOR_3, DATA_GAL_DARAH, DOOR_TYPE_ROOM },
{ GO_ECK_THE_FEROCIOUS_DOOR, DATA_MOORABI, DOOR_TYPE_PASSAGE },
{ GO_ECK_THE_FEROCIOUS_DOOR_BEHIND, DATA_ECK_THE_FEROCIOUS, DOOR_TYPE_PASSAGE },
- { 0, 0, DOOR_TYPE_ROOM } // END
+ { 0, 0, DOOR_TYPE_ROOM } // END
};
ObjectData const creatureData[] =
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 5d74d128f6f..5b2248d5341 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp
@@ -15,13 +15,20 @@
* 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 "Player.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "PassiveAI.h"
+#include "Player.h"
+#include "ScriptedCreature.h"
+#include "Spell.h"
+#include "SpellAuraEffects.h"
+#include "SpellInfo.h"
+#include "SpellScript.h"
+#include "TemporarySummon.h"
enum Texts
{
@@ -1243,9 +1250,7 @@ class spell_taldaram_flame_ball_visual : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_BALL_OF_FLAMES))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_BALL_OF_FLAMES });
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -1355,10 +1360,7 @@ class spell_valanar_kinetic_bomb : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_KINETIC_BOMB_EXPLOSION)
- || !sSpellMgr->GetSpellInfo(SPELL_KINETIC_BOMB_VISUAL))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_KINETIC_BOMB_EXPLOSION, SPELL_KINETIC_BOMB_VISUAL });
}
void HandleDummyTick(AuraEffect const* /*aurEff*/)
@@ -1462,9 +1464,7 @@ class spell_blood_council_shadow_prison : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SHADOW_PRISON_DAMAGE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SHADOW_PRISON_DAMAGE });
}
void HandleDummyTick(AuraEffect const* aurEff)
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 e070829ea16..b908e1a9c35 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 "GridNotifiers.h"
+#include "icecrown_citadel.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
#include "Spell.h"
+#include "SpellMgr.h"
+#include "SpellScript.h"
#include "SpellAuraEffects.h"
-#include "GridNotifiers.h"
-#include "icecrown_citadel.h"
enum Texts
{
@@ -372,7 +377,7 @@ class boss_blood_queen_lana_thel : public CreatureScript
}
case EVENT_BLOOD_MIRROR:
{
- // victim can be NULL when this is processed in the same update tick as EVENT_AIR_PHASE
+ // victim can be nullptr when this is processed in the same update tick as EVENT_AIR_PHASE
if (me->GetVictim())
{
Player* newOfftank = SelectRandomTarget(true);
@@ -477,13 +482,13 @@ class boss_blood_queen_lana_thel : public CreatureScript
private:
// offtank for this encounter is the player standing closest to main tank
- Player* SelectRandomTarget(bool includeOfftank, std::list<Player*>* targetList = NULL)
+ Player* SelectRandomTarget(bool includeOfftank, std::list<Player*>* targetList = nullptr)
{
std::list<HostileReference*> const& threatlist = me->getThreatManager().getThreatList();
std::list<Player*> tempTargets;
if (threatlist.empty())
- return NULL;
+ return nullptr;
for (std::list<HostileReference*>::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
if (Unit* refTarget = (*itr)->getTarget())
@@ -491,12 +496,12 @@ class boss_blood_queen_lana_thel : public CreatureScript
tempTargets.push_back(refTarget->ToPlayer());
if (tempTargets.empty())
- return NULL;
+ return nullptr;
if (targetList)
{
*targetList = tempTargets;
- return NULL;
+ return nullptr;
}
if (includeOfftank)
@@ -535,13 +540,7 @@ 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()
@@ -671,9 +670,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
@@ -722,9 +719,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)
@@ -809,9 +804,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
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp
index 064e903ba62..172c54fd7e0 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp
@@ -15,13 +15,16 @@
* 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 "MotionMaster.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
{
@@ -639,7 +642,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);
}
return false;
@@ -836,7 +839,7 @@ class npc_muradin_bronzebeard_icc : public CreatureScript
{
if (menuId == GOSSIP_MENU_MURADIN_BRONZEBEARD)
{
- player->PlayerTalkClass->SendCloseGossip();
+ CloseGossipMenuFor(player);
DoAction(ACTION_START_EVENT);
}
return false;
@@ -1007,11 +1010,7 @@ 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*/)
@@ -1043,9 +1042,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*/)
@@ -1128,9 +1125,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)
@@ -1163,9 +1158,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)
@@ -1197,9 +1190,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 e92b66f358f..5b0ea090802 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp
@@ -15,12 +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 "ObjectAccessor.h"
#include "Player.h"
+#include "ScriptedCreature.h"
+#include "SpellAuras.h"
+#include "SpellMgr.h"
+#include "SpellScript.h"
enum ScriptTexts
{
@@ -197,7 +201,7 @@ class boss_festergut : public CreatureScript
// just cast and dont bother with target, conditions will handle it
++_inhaleCounter;
if (_inhaleCounter < 3)
- me->CastSpell(me, gaseousBlight[_inhaleCounter], true, NULL, NULL, me->GetGUID());
+ me->CastSpell(me, gaseousBlight[_inhaleCounter], true, nullptr, nullptr, me->GetGUID());
}
events.ScheduleEvent(EVENT_INHALE_BLIGHT, urand(33500, 35000));
@@ -410,9 +414,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*/)
@@ -448,9 +450,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 a30ea8e9cc5..aa0ce037619 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp
@@ -15,22 +15,28 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "ScriptMgr.h"
#include "CellImpl.h"
#include "CreatureTextMgr.h"
-#include "GridNotifiersImpl.h"
#include "GossipDef.h"
+#include "GridNotifiersImpl.h"
+#include "icecrown_citadel.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
#include "MoveSpline.h"
#include "MoveSplineInit.h"
+#include "ObjectAccessor.h"
#include "PassiveAI.h"
-#include "ScriptMgr.h"
#include "ScriptedCreature.h"
-#include "SpellHistory.h"
#include "SpellAuraEffects.h"
+#include "SpellHistory.h"
+#include "SpellMgr.h"
#include "SpellScript.h"
+#include "TemporarySummon.h"
#include "Transport.h"
#include "TransportMgr.h"
#include "Vehicle.h"
-#include "icecrown_citadel.h"
+#include <G3D/Vector3.h>
enum Texts
{
@@ -383,7 +389,7 @@ public:
void ResetSlots(uint32 team)
{
- _transport = NULL;
+ _transport = nullptr;
for (uint32 i = 0; i < MAX_SLOTS; ++i)
_controlledSlots[i].Clear();
@@ -398,7 +404,7 @@ public:
return false;
bool summoned = false;
- time_t now = time(NULL);
+ time_t now = time(nullptr);
for (int32 i = first; i <= last; ++i)
{
if (_respawnCooldowns[i] > now)
@@ -411,7 +417,7 @@ public:
continue;
}
- if (Creature* passenger = _transport->SummonPassenger(_slotInfo[i].Entry, SelectSpawnPoint(), TEMPSUMMON_CORPSE_TIMED_DESPAWN, NULL, 15000))
+ if (Creature* passenger = _transport->SummonPassenger(_slotInfo[i].Entry, SelectSpawnPoint(), TEMPSUMMON_CORPSE_TIMED_DESPAWN, nullptr, 15000))
{
_controlledSlots[i] = passenger->GetGUID();
_respawnCooldowns[i] = time_t(0);
@@ -426,7 +432,7 @@ public:
void ClearSlot(PassengerSlots slot)
{
_controlledSlots[slot].Clear();
- _respawnCooldowns[slot] = time(NULL) + _slotInfo[slot].Cooldown;
+ _respawnCooldowns[slot] = time(nullptr) + _slotInfo[slot].Cooldown;
}
bool SlotsNeedRefill(PassengerSlots first, PassengerSlots last) const
@@ -541,7 +547,7 @@ uint32 const BattleExperienceEvent::ExperiencedTimes[5] = { 100000, 70000, 60000
struct gunship_npc_AI : public ScriptedAI
{
gunship_npc_AI(Creature* creature) : ScriptedAI(creature),
- Instance(creature->GetInstanceScript()), Slot(NULL), Index(uint32(-1))
+ Instance(creature->GetInstanceScript()), Slot(nullptr), Index(uint32(-1))
{
BurningPitchId = Instance->GetData(DATA_TEAM_IN_INSTANCE) == HORDE ? SPELL_BURNING_PITCH_A : SPELL_BURNING_PITCH_H;
me->setRegeneratingHealth(false);
@@ -677,7 +683,7 @@ class npc_gunship : public CreatureScript
{
if (damage >= me->GetHealth())
{
- JustDied(NULL);
+ JustDied(nullptr);
damage = me->GetHealth() - 1;
return;
}
@@ -833,7 +839,7 @@ class npc_gunship : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
if (!creature->GetTransport())
- return NULL;
+ return nullptr;
return GetIcecrownCitadelAI<npc_gunshipAI>(creature);
}
@@ -853,7 +859,7 @@ class npc_high_overlord_saurfang_igb : public CreatureScript
_controller.SetTransport(creature->GetTransport());
me->setRegeneratingHealth(false);
me->m_CombatDistance = 70.0f;
- _firstMageCooldown = time(NULL) + 60;
+ _firstMageCooldown = time(nullptr) + 60;
_axethrowersYellCooldown = time_t(0);
_rocketeersYellCooldown = time_t(0);
}
@@ -863,7 +869,7 @@ class npc_high_overlord_saurfang_igb : public CreatureScript
ScriptedAI::InitializeAI();
_events.Reset();
- _firstMageCooldown = time(NULL) + 60;
+ _firstMageCooldown = time(nullptr) + 60;
_axethrowersYellCooldown = time_t(0);
_rocketeersYellCooldown = time_t(0);
}
@@ -915,7 +921,7 @@ class npc_high_overlord_saurfang_igb : public CreatureScript
}
else if (action == ACTION_SPAWN_MAGE)
{
- time_t now = time(NULL);
+ time_t now = time(nullptr);
if (_firstMageCooldown > now)
_events.ScheduleEvent(EVENT_SUMMON_MAGE, (_firstMageCooldown - now) * IN_MILLISECONDS);
else
@@ -1034,10 +1040,10 @@ class npc_high_overlord_saurfang_igb : public CreatureScript
_controller.SummonCreatures(SLOT_MARINE_1, Is25ManRaid() ? SLOT_MARINE_4 : SLOT_MARINE_2);
_controller.SummonCreatures(SLOT_SERGEANT_1, Is25ManRaid() ? SLOT_SERGEANT_2 : SLOT_SERGEANT_1);
if (Transport* orgrimsHammer = me->GetTransport())
- orgrimsHammer->SummonPassenger(NPC_TELEPORT_PORTAL, OrgrimsHammerTeleportPortal, TEMPSUMMON_TIMED_DESPAWN, NULL, 21000);
+ orgrimsHammer->SummonPassenger(NPC_TELEPORT_PORTAL, OrgrimsHammerTeleportPortal, TEMPSUMMON_TIMED_DESPAWN, nullptr, 21000);
if (Transport* skybreaker = HashMapHolder<Transport>::Find(_instance->GetGuidData(DATA_ICECROWN_GUNSHIP_BATTLE)))
- skybreaker->SummonPassenger(NPC_TELEPORT_EXIT, SkybreakerTeleportExit, TEMPSUMMON_TIMED_DESPAWN, NULL, 23000);
+ skybreaker->SummonPassenger(NPC_TELEPORT_EXIT, SkybreakerTeleportExit, TEMPSUMMON_TIMED_DESPAWN, nullptr, 23000);
_events.ScheduleEvent(EVENT_ADDS_BOARD_YELL, 6000);
_events.ScheduleEvent(EVENT_ADDS, 60000);
@@ -1049,10 +1055,10 @@ class npc_high_overlord_saurfang_igb : public CreatureScript
case EVENT_CHECK_RIFLEMAN:
if (_controller.SummonCreatures(SLOT_RIFLEMAN_1, Is25ManRaid() ? SLOT_RIFLEMAN_8 : SLOT_RIFLEMAN_4))
{
- if (_axethrowersYellCooldown < time(NULL))
+ if (_axethrowersYellCooldown < time(nullptr))
{
Talk(SAY_SAURFANG_AXETHROWERS);
- _axethrowersYellCooldown = time(NULL) + 5;
+ _axethrowersYellCooldown = time(nullptr) + 5;
}
}
_events.ScheduleEvent(EVENT_CHECK_RIFLEMAN, 1000);
@@ -1060,10 +1066,10 @@ class npc_high_overlord_saurfang_igb : public CreatureScript
case EVENT_CHECK_MORTAR:
if (_controller.SummonCreatures(SLOT_MORTAR_1, Is25ManRaid() ? SLOT_MORTAR_4 : SLOT_MORTAR_2))
{
- if (_rocketeersYellCooldown < time(NULL))
+ if (_rocketeersYellCooldown < time(nullptr))
{
Talk(SAY_SAURFANG_ROCKETEERS);
- _rocketeersYellCooldown = time(NULL) + 5;
+ _rocketeersYellCooldown = time(nullptr) + 5;
}
}
_events.ScheduleEvent(EVENT_CHECK_MORTAR, 1000);
@@ -1122,7 +1128,7 @@ class npc_muradin_bronzebeard_igb : public CreatureScript
_controller.SetTransport(creature->GetTransport());
me->setRegeneratingHealth(false);
me->m_CombatDistance = 70.0f;
- _firstMageCooldown = time(NULL) + 60;
+ _firstMageCooldown = time(nullptr) + 60;
_riflemanYellCooldown = time_t(0);
_mortarYellCooldown = time_t(0);
}
@@ -1132,7 +1138,7 @@ class npc_muradin_bronzebeard_igb : public CreatureScript
ScriptedAI::InitializeAI();
_events.Reset();
- _firstMageCooldown = time(NULL) + 60;
+ _firstMageCooldown = time(nullptr) + 60;
_riflemanYellCooldown = time_t(0);
_mortarYellCooldown = time_t(0);
}
@@ -1184,7 +1190,7 @@ class npc_muradin_bronzebeard_igb : public CreatureScript
}
else if (action == ACTION_SPAWN_MAGE)
{
- time_t now = time(NULL);
+ time_t now = time(nullptr);
if (_firstMageCooldown > now)
_events.ScheduleEvent(EVENT_SUMMON_MAGE, (_firstMageCooldown - now) * IN_MILLISECONDS);
else
@@ -1307,10 +1313,10 @@ class npc_muradin_bronzebeard_igb : public CreatureScript
_controller.SummonCreatures(SLOT_MARINE_1, Is25ManRaid() ? SLOT_MARINE_4 : SLOT_MARINE_2);
_controller.SummonCreatures(SLOT_SERGEANT_1, Is25ManRaid() ? SLOT_SERGEANT_2 : SLOT_SERGEANT_1);
if (Transport* skybreaker = me->GetTransport())
- skybreaker->SummonPassenger(NPC_TELEPORT_PORTAL, SkybreakerTeleportPortal, TEMPSUMMON_TIMED_DESPAWN, NULL, 21000);
+ skybreaker->SummonPassenger(NPC_TELEPORT_PORTAL, SkybreakerTeleportPortal, TEMPSUMMON_TIMED_DESPAWN, nullptr, 21000);
if (Transport* orgrimsHammer = HashMapHolder<Transport>::Find(_instance->GetGuidData(DATA_ICECROWN_GUNSHIP_BATTLE)))
- orgrimsHammer->SummonPassenger(NPC_TELEPORT_EXIT, OrgrimsHammerTeleportExit, TEMPSUMMON_TIMED_DESPAWN, NULL, 23000);
+ orgrimsHammer->SummonPassenger(NPC_TELEPORT_EXIT, OrgrimsHammerTeleportExit, TEMPSUMMON_TIMED_DESPAWN, nullptr, 23000);
_events.ScheduleEvent(EVENT_ADDS_BOARD_YELL, 6000);
_events.ScheduleEvent(EVENT_ADDS, 60000);
@@ -1322,10 +1328,10 @@ class npc_muradin_bronzebeard_igb : public CreatureScript
case EVENT_CHECK_RIFLEMAN:
if (_controller.SummonCreatures(SLOT_RIFLEMAN_1, Is25ManRaid() ? SLOT_RIFLEMAN_8 : SLOT_RIFLEMAN_4))
{
- if (_riflemanYellCooldown < time(NULL))
+ if (_riflemanYellCooldown < time(nullptr))
{
Talk(SAY_MURADIN_RIFLEMAN);
- _riflemanYellCooldown = time(NULL) + 5;
+ _riflemanYellCooldown = time(nullptr) + 5;
}
}
_events.ScheduleEvent(EVENT_CHECK_RIFLEMAN, 1000);
@@ -1333,10 +1339,10 @@ class npc_muradin_bronzebeard_igb : public CreatureScript
case EVENT_CHECK_MORTAR:
if (_controller.SummonCreatures(SLOT_MORTAR_1, Is25ManRaid() ? SLOT_MORTAR_4 : SLOT_MORTAR_2))
{
- if (_mortarYellCooldown < time(NULL))
+ if (_mortarYellCooldown < time(nullptr))
{
Talk(SAY_MURADIN_MORTAR);
- _mortarYellCooldown = time(NULL) + 5;
+ _mortarYellCooldown = time(nullptr) + 5;
}
}
_events.ScheduleEvent(EVENT_CHECK_MORTAR, 1000);
@@ -1814,7 +1820,7 @@ class npc_gunship_cannon : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_gunship_cannonAI(creature);
+ return GetIcecrownCitadelAI<npc_gunship_cannonAI>(creature);
}
};
@@ -1829,11 +1835,7 @@ 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*/)
@@ -1845,8 +1847,8 @@ class spell_igb_rocket_pack : public SpellScriptLoader
void HandleRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
SpellInfo const* damageInfo = sSpellMgr->AssertSpellInfo(SPELL_ROCKET_PACK_DAMAGE);
- GetTarget()->CastCustomSpell(SPELL_ROCKET_PACK_DAMAGE, SPELLVALUE_BASE_POINT0, 2 * (damageInfo->Effects[EFFECT_0].CalcValue() + aurEff->GetTickNumber() * aurEff->GetAmplitude()), NULL, TRIGGERED_FULL_MASK);
- GetTarget()->CastSpell(NULL, SPELL_ROCKET_BURST, TRIGGERED_FULL_MASK);
+ GetTarget()->CastCustomSpell(SPELL_ROCKET_PACK_DAMAGE, SPELLVALUE_BASE_POINT0, 2 * (damageInfo->Effects[EFFECT_0].CalcValue() + aurEff->GetTickNumber() * aurEff->GetAmplitude()), nullptr, TRIGGERED_FULL_MASK);
+ GetTarget()->CastSpell(nullptr, SPELL_ROCKET_BURST, TRIGGERED_FULL_MASK);
}
void Register() override
@@ -2101,7 +2103,7 @@ class spell_igb_overheat : public SpellScriptLoader
WorldPacket data(SMSG_CLIENT_CONTROL_UPDATE, GetUnitOwner()->GetPackGUID().size() + 1);
data << GetUnitOwner()->GetPackGUID();
data << uint8(value);
- player->GetSession()->SendPacket(&data);
+ player->SendDirectMessage(&data);
}
}
}
@@ -2251,7 +2253,7 @@ class spell_igb_burning_pitch : public SpellScriptLoader
void HandleDummy(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
- GetCaster()->CastCustomSpell(uint32(GetEffectValue()), SPELLVALUE_BASE_POINT0, 8000, NULL, TRIGGERED_FULL_MASK);
+ GetCaster()->CastCustomSpell(uint32(GetEffectValue()), SPELLVALUE_BASE_POINT0, 8000, nullptr, TRIGGERED_FULL_MASK);
GetHitUnit()->CastSpell(GetHitUnit(), SPELL_BURNING_PITCH, TRIGGERED_FULL_MASK);
}
@@ -2317,7 +2319,7 @@ class spell_igb_rocket_artillery_explosion : public SpellScriptLoader
void DamageGunship(SpellEffIndex /*effIndex*/)
{
if (InstanceScript* instance = GetCaster()->GetInstanceScript())
- GetCaster()->CastCustomSpell(instance->GetData(DATA_TEAM_IN_INSTANCE) == HORDE ? SPELL_BURNING_PITCH_DAMAGE_A : SPELL_BURNING_PITCH_DAMAGE_H, SPELLVALUE_BASE_POINT0, 5000, NULL, TRIGGERED_FULL_MASK);
+ GetCaster()->CastCustomSpell(instance->GetData(DATA_TEAM_IN_INSTANCE) == HORDE ? SPELL_BURNING_PITCH_DAMAGE_A : SPELL_BURNING_PITCH_DAMAGE_H, SPELLVALUE_BASE_POINT0, 5000, nullptr, TRIGGERED_FULL_MASK);
}
void Register() override
@@ -2402,7 +2404,7 @@ class spell_igb_check_for_players : public SpellScriptLoader
void TriggerWipe()
{
if (!_playerCount)
- GetCaster()->ToCreature()->AI()->JustDied(NULL);
+ GetCaster()->ToCreature()->AI()->JustDied(nullptr);
}
void TeleportPlayer(SpellEffIndex /*effIndex*/)
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp
index 88f4f9e3399..602c191cfab 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp
@@ -15,14 +15,18 @@
* 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 "InstanceScript.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "PoolMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellInfo.h"
+#include "SpellScript.h"
+#include "TemporarySummon.h"
enum ScriptTexts
{
@@ -453,7 +457,7 @@ class boss_lady_deathwhisper : public CreatureScript
}
}
- void SpellHitTarget(Unit* target, const SpellInfo* spell) override
+ void SpellHitTarget(Unit* target, SpellInfo const* spell) override
{
if (spell->Id == SPELL_SUMMON_SPIRITS)
_nextVengefulShadeTargetGUID.push_back(target->GetGUID());
@@ -540,7 +544,7 @@ class boss_lady_deathwhisper : public CreatureScript
}
// helper for summoning wave mobs
- void Summon(uint32 entry, const Position& pos)
+ void Summon(uint32 entry, Position const& pos)
{
if (TempSummon* summon = me->SummonCreature(entry, pos, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000))
summon->CastSpell(summon, SPELL_TELEPORT_VISUAL);
@@ -1044,9 +1048,7 @@ class spell_deathwhisper_dominated_mind : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DOMINATE_MIND_SCALE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DOMINATE_MIND_SCALE });
}
void HandleApply(AuraEffect const* /*eff*/, AuraEffectHandleModes /*mode*/)
@@ -1078,9 +1080,7 @@ class spell_deathwhisper_summon_spirits : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_SHADE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SUMMON_SHADE });
}
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp
index 361516582c6..c13ce2ed638 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp
@@ -15,13 +15,18 @@
* 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 "MotionMaster.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 +623,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 95996143209..ca10713b47a 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp
@@ -15,15 +15,22 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ObjectMgr.h"
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "SpellAuraEffects.h"
+#include "DBCStores.h"
+#include "GridNotifiers.h"
#include "Group.h"
-#include "Spell.h"
#include "icecrown_citadel.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
+#include "Spell.h"
+#include "SpellAuraEffects.h"
+#include "SpellMgr.h"
+#include "SpellScript.h"
+#include "TemporarySummon.h"
#include "Vehicle.h"
-#include "GridNotifiers.h"
enum Say
{
@@ -373,7 +380,7 @@ class boss_professor_putricide : public CreatureScript
me->SetSpeedRate(MOVE_RUN, _baseSpeed);
DoAction(ACTION_FESTERGUT_GAS);
if (Creature* festergut = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_FESTERGUT)))
- festergut->CastSpell(festergut, SPELL_GASEOUS_BLIGHT_LARGE, false, NULL, NULL, festergut->GetGUID());
+ festergut->CastSpell(festergut, SPELL_GASEOUS_BLIGHT_LARGE, false, nullptr, nullptr, festergut->GetGUID());
break;
case POINT_ROTFACE:
instance->SetBossState(DATA_ROTFACE, IN_PROGRESS); // needed here for delayed gate close
@@ -470,7 +477,7 @@ class boss_professor_putricide : public CreatureScript
case ACTION_ROTFACE_OOZE:
Talk(SAY_ROTFACE_OOZE_FLOOD);
if (Creature* dummy = ObjectAccessor::GetCreature(*me, _oozeFloodDummyGUIDs[_oozeFloodStage]))
- dummy->CastSpell(dummy, oozeFloodSpells[_oozeFloodStage], true, NULL, NULL, me->GetGUID()); // cast from self for LoS (with prof's GUID for logs)
+ dummy->CastSpell(dummy, oozeFloodSpells[_oozeFloodStage], true, nullptr, nullptr, me->GetGUID()); // cast from self for LoS (with prof's GUID for logs)
if (++_oozeFloodStage == 4)
_oozeFloodStage = 0;
break;
@@ -580,7 +587,7 @@ class boss_professor_putricide : public CreatureScript
EnterEvadeMode();
break;
case EVENT_FESTERGUT_GOO:
- me->CastCustomSpell(SPELL_MALLEABLE_GOO_SUMMON, SPELLVALUE_MAX_TARGETS, 1, NULL, true);
+ me->CastCustomSpell(SPELL_MALLEABLE_GOO_SUMMON, SPELLVALUE_MAX_TARGETS, 1, nullptr, true);
events.ScheduleEvent(EVENT_FESTERGUT_GOO, (Is25ManRaid() ? 10000 : 30000) + urand(0, 5000), 0, PHASE_FESTERGUT);
break;
case EVENT_ROTFACE_DIES:
@@ -881,20 +888,9 @@ class spell_putricide_ooze_channel : public SpellScriptLoader
{
PrepareSpellScript(spell_putricide_ooze_channel_SpellScript);
- public:
- spell_putricide_ooze_channel_SpellScript()
- {
- _target = nullptr;
- }
-
- private:
bool Validate(SpellInfo const* spell) override
{
- if (!spell->ExcludeTargetAuraSpell)
- return false;
- if (!sSpellMgr->GetSpellInfo(spell->ExcludeTargetAuraSpell))
- return false;
- return true;
+ return ValidateSpellInfo({ spell->ExcludeTargetAuraSpell });
}
// set up initial variables and check if caster is creature
@@ -942,7 +938,7 @@ class spell_putricide_ooze_channel : public SpellScriptLoader
AfterHit += SpellHitFn(spell_putricide_ooze_channel_SpellScript::StartAttack);
}
- WorldObject* _target;
+ WorldObject* _target = nullptr;
};
SpellScript* GetSpellScript() const override
@@ -1041,7 +1037,7 @@ class spell_putricide_unstable_experiment : public SpellScriptLoader
uint32 stage = creature->AI()->GetData(DATA_EXPERIMENT_STAGE);
creature->AI()->SetData(DATA_EXPERIMENT_STAGE, stage ^ true);
- Creature* target = NULL;
+ Creature* target = nullptr;
std::list<Creature*> creList;
GetCreatureListWithEntryInGrid(creList, GetCaster(), NPC_ABOMINATION_WING_MAD_SCIENTIST_STALKER, 200.0f);
// 2 of them are spawned at green place - weird trick blizz
@@ -1112,10 +1108,7 @@ class spell_putricide_ooze_tank_protection : public SpellScriptLoader
bool Validate(SpellInfo const* spellInfo) override
{
- if (!sSpellMgr->GetSpellInfo(spellInfo->Effects[EFFECT_0].TriggerSpell) ||
- !sSpellMgr->GetSpellInfo(spellInfo->Effects[EFFECT_1].TriggerSpell))
- return false;
- return true;
+ return ValidateSpellInfo({ spellInfo->Effects[EFFECT_0].TriggerSpell, spellInfo->Effects[EFFECT_1].TriggerSpell });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -1157,7 +1150,7 @@ class spell_putricide_choking_gas_bomb : public SpellScriptLoader
continue;
uint32 spellId = uint32(GetSpellInfo()->Effects[i].CalcValue());
- GetCaster()->CastSpell(GetCaster(), spellId, true, NULL, NULL, GetCaster()->GetGUID());
+ GetCaster()->CastSpell(GetCaster(), spellId, true, nullptr, nullptr, GetCaster()->GetGUID());
}
}
@@ -1184,11 +1177,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)
@@ -1332,7 +1321,7 @@ class spell_putricide_mutated_plague : public SpellScriptLoader
damage *= int32(pow(multiplier, GetStackAmount()));
damage = int32(damage * 1.5f);
- GetTarget()->CastCustomSpell(triggerSpell, SPELLVALUE_BASE_POINT0, damage, GetTarget(), true, NULL, aurEff, GetCasterGUID());
+ GetTarget()->CastCustomSpell(triggerSpell, SPELLVALUE_BASE_POINT0, damage, GetTarget(), true, nullptr, aurEff, GetCasterGUID());
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -1344,7 +1333,7 @@ class spell_putricide_mutated_plague : public SpellScriptLoader
return;
int32 heal = healSpellInfo->Effects[0].CalcValue() * GetStackAmount();
- GetTarget()->CastCustomSpell(healSpell, SPELLVALUE_BASE_POINT0, heal, GetTarget(), true, NULL, NULL, GetCasterGUID());
+ GetTarget()->CastCustomSpell(healSpell, SPELLVALUE_BASE_POINT0, heal, GetTarget(), true, nullptr, nullptr, GetCasterGUID());
}
void Register() override
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp
index 21cb420cc5a..337bdc560b4 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp
@@ -15,12 +15,16 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ObjectMgr.h"
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "SpellAuraEffects.h"
#include "GridNotifiers.h"
#include "icecrown_citadel.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
+#include "SpellAuras.h"
+#include "SpellScript.h"
+#include "TemporarySummon.h"
// KNOWN BUGS:
// ~ No Slime Spray animation directly at target spot
@@ -469,7 +473,7 @@ class spell_rotface_ooze_flood : public SpellScriptLoader
return;
triggers.sort(Trinity::ObjectDistanceOrderPred(GetHitUnit()));
- GetHitUnit()->CastSpell(triggers.back(), uint32(GetEffectValue()), false, NULL, NULL, GetOriginalCaster() ? GetOriginalCaster()->GetGUID() : ObjectGuid::Empty);
+ GetHitUnit()->CastSpell(triggers.back(), uint32(GetEffectValue()), false, nullptr, nullptr, GetOriginalCaster() ? GetOriginalCaster()->GetGUID() : ObjectGuid::Empty);
}
void FilterTargets(std::list<WorldObject*>& targets)
@@ -540,9 +544,7 @@ class spell_rotface_mutated_infection : public SpellScriptLoader
bool Validate(SpellInfo const* spellInfo) override
{
- if (!sSpellMgr->GetSpellInfo(uint32(spellInfo->Effects[EFFECT_2].CalcValue())))
- return false;
- return true;
+ return ValidateSpellInfo({ static_cast<uint32>(spellInfo->Effects[EFFECT_2].CalcValue()) });
}
void HandleEffectRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
@@ -676,7 +678,7 @@ class spell_rotface_large_ooze_buff_combine : public SpellScriptLoader
if (Creature* cre = GetCaster()->ToCreature())
cre->AI()->DoAction(EVENT_STICKY_OOZE);
- GetCaster()->CastSpell(GetCaster(), SPELL_UNSTABLE_OOZE_EXPLOSION, false, NULL, NULL, GetCaster()->GetGUID());
+ GetCaster()->CastSpell(GetCaster(), SPELL_UNSTABLE_OOZE_EXPLOSION, false, nullptr, nullptr, GetCaster()->GetGUID());
if (InstanceScript* instance = GetCaster()->GetInstanceScript())
instance->SetData(DATA_OOZE_DANCE_ACHIEVEMENT, uint32(false));
}
@@ -708,9 +710,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)
@@ -759,7 +759,7 @@ class spell_rotface_unstable_ooze_explosion : public SpellScriptLoader
// let Rotface handle the cast - caster dies before this executes
if (InstanceScript* script = GetCaster()->GetInstanceScript())
if (Creature* rotface = script->instance->GetCreature(script->GetGuidData(DATA_ROTFACE)))
- rotface->CastSpell(x, y, z, triggered_spell_id, true, NULL, NULL, GetCaster()->GetGUID());
+ rotface->CastSpell(x, y, z, triggered_spell_id, true, nullptr, nullptr, GetCaster()->GetGUID());
}
void Register() override
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp
index bed297de5c8..36574c9e812 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp
@@ -15,12 +15,19 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ObjectMgr.h"
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "SpellAuraEffects.h"
#include "GridNotifiers.h"
#include "icecrown_citadel.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
+#include "ObjectMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellAuraEffects.h"
+#include "SpellMgr.h"
+#include "SpellScript.h"
+#include "TemporarySummon.h"
enum Texts
{
@@ -187,7 +194,7 @@ class FrostBombExplosion : public BasicEvent
bool Execute(uint64 /*eventTime*/, uint32 /*updateTime*/) override
{
- _owner->CastSpell((Unit*)NULL, SPELL_FROST_BOMB, false, NULL, NULL, _sindragosaGUID);
+ _owner->CastSpell((Unit*)nullptr, SPELL_FROST_BOMB, false, nullptr, nullptr, _sindragosaGUID);
_owner->RemoveAurasDueToSpell(SPELL_FROST_BOMB_VISUAL);
return true;
}
@@ -363,7 +370,7 @@ class boss_sindragosa : public CreatureScript
events.ScheduleEvent(EVENT_AIR_MOVEMENT, 1);
break;
case POINT_AIR_PHASE:
- me->CastCustomSpell(SPELL_ICE_TOMB_TARGET, SPELLVALUE_MAX_TARGETS, RAID_MODE<int32>(2, 5, 2, 6), NULL, TRIGGERED_FULL_MASK);
+ me->CastCustomSpell(SPELL_ICE_TOMB_TARGET, SPELLVALUE_MAX_TARGETS, RAID_MODE<int32>(2, 5, 2, 6), nullptr, TRIGGERED_FULL_MASK);
me->SetFacingTo(float(M_PI), true);
events.ScheduleEvent(EVENT_AIR_MOVEMENT_FAR, 1);
events.ScheduleEvent(EVENT_FROST_BOMB, 9000);
@@ -1063,12 +1070,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()
@@ -1237,15 +1239,13 @@ 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*/)
{
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
- GetTarget()->CastCustomSpell(SPELL_BACKLASH, SPELLVALUE_BASE_POINT0, aurEff->GetAmount(), GetTarget(), true, NULL, aurEff, GetCasterGUID());
+ GetTarget()->CastCustomSpell(SPELL_BACKLASH, SPELLVALUE_BASE_POINT0, aurEff->GetAmount(), GetTarget(), true, nullptr, aurEff, GetCasterGUID());
}
void Register() override
@@ -1271,9 +1271,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*/)
@@ -1327,7 +1325,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);
@@ -1366,9 +1364,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)
@@ -1440,9 +1436,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)
@@ -1492,9 +1486,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 e5736894b4c..b219ded2afd 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp
@@ -15,19 +15,22 @@
* 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 "Spell.h"
-#include "Vehicle.h"
-#include "Cell.h"
#include "CellImpl.h"
-#include "GridNotifiers.h"
-#include "GridNotifiersImpl.h"
#include "CreatureTextMgr.h"
+#include "DBCStores.h"
+#include "GridNotifiersImpl.h"
#include "icecrown_citadel.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
+#include "Spell.h"
+#include "SpellAuraEffects.h"
+#include "SpellScript.h"
+#include "TemporarySummon.h"
+#include "Vehicle.h"
+#include "Weather.h"
enum Texts
{
@@ -469,7 +472,7 @@ class VileSpiritActivateEvent : public BasicEvent
{
_owner->SetReactState(REACT_AGGRESSIVE);
_owner->CastSpell(_owner, SPELL_VILE_SPIRIT_MOVE_SEARCH, true);
- _owner->CastSpell((Unit*)NULL, SPELL_VILE_SPIRIT_DAMAGE_SEARCH, true);
+ _owner->CastSpell((Unit*)nullptr, SPELL_VILE_SPIRIT_DAMAGE_SEARCH, true);
return true;
}
@@ -487,7 +490,7 @@ class TriggerWickedSpirit : public BasicEvent
bool Execute(uint64 /*time*/, uint32 /*diff*/) override
{
- _owner->CastCustomSpell(SPELL_TRIGGER_VILE_SPIRIT_HEROIC, SPELLVALUE_MAX_TARGETS, 1, NULL, true);
+ _owner->CastCustomSpell(SPELL_TRIGGER_VILE_SPIRIT_HEROIC, SPELLVALUE_MAX_TARGETS, 1, nullptr, true);
if (--_counter)
{
@@ -623,8 +626,8 @@ class boss_the_lich_king : public CreatureScript
me->GetMap()->SetZoneOverrideLight(AREA_ICECROWN_CITADEL, 0, 5000);
break;
case ACTION_BREAK_FROSTMOURNE:
- me->CastSpell((Unit*)NULL, SPELL_SUMMON_BROKEN_FROSTMOURNE, TRIGGERED_IGNORE_CAST_IN_PROGRESS);
- me->CastSpell((Unit*)NULL, SPELL_SUMMON_BROKEN_FROSTMOURNE_2, TRIGGERED_IGNORE_CAST_IN_PROGRESS);
+ me->CastSpell((Unit*)nullptr, SPELL_SUMMON_BROKEN_FROSTMOURNE, TRIGGERED_IGNORE_CAST_IN_PROGRESS);
+ me->CastSpell((Unit*)nullptr, SPELL_SUMMON_BROKEN_FROSTMOURNE_2, TRIGGERED_IGNORE_CAST_IN_PROGRESS);
SetEquipmentSlots(false, EQUIP_BROKEN_FROSTMOURNE);
events.ScheduleEvent(EVENT_OUTRO_TALK_6, 2500, 0, PHASE_OUTRO);
break;
@@ -706,7 +709,7 @@ class boss_the_lich_king : public CreatureScript
summons.DespawnAll();
me->GetMap()->SetZoneMusic(AREA_ICECROWN_CITADEL, MUSIC_FURY_OF_FROSTMOURNE);
me->InterruptNonMeleeSpells(true);
- me->CastSpell((Unit*)NULL, SPELL_FURY_OF_FROSTMOURNE, TRIGGERED_NONE);
+ me->CastSpell((Unit*)nullptr, SPELL_FURY_OF_FROSTMOURNE, TRIGGERED_NONE);
me->SetWalk(true);
events.ScheduleEvent(EVENT_OUTRO_TALK_1, 2600, 0, PHASE_OUTRO);
events.ScheduleEvent(EVENT_OUTRO_EMOTE_TALK, 6600, 0, PHASE_OUTRO);
@@ -753,7 +756,7 @@ class boss_the_lich_king : public CreatureScript
break;
case NPC_FROSTMOURNE_TRIGGER:
{
- summon->CastSpell((Unit*)NULL, SPELL_BROKEN_FROSTMOURNE, true);
+ summon->CastSpell((Unit*)nullptr, SPELL_BROKEN_FROSTMOURNE, true);
me->GetMap()->SetZoneOverrideLight(AREA_ICECROWN_CITADEL, LIGHT_SOULSTORM, 10000);
me->GetMap()->SetZoneWeather(AREA_ICECROWN_CITADEL, WEATHER_STATE_BLACKSNOW, 0.5f);
@@ -1064,7 +1067,7 @@ class boss_the_lich_king : public CreatureScript
}
break;
case EVENT_FROSTMOURNE_HEROIC:
- if (TempSummon* terenas = me->GetMap()->SummonCreature(NPC_TERENAS_MENETHIL_FROSTMOURNE_H, TerenasSpawnHeroic, NULL, 50000))
+ if (TempSummon* terenas = me->GetMap()->SummonCreature(NPC_TERENAS_MENETHIL_FROSTMOURNE_H, TerenasSpawnHeroic, nullptr, 50000))
{
terenas->AI()->DoAction(ACTION_FROSTMOURNE_INTRO);
std::list<Creature*> triggers;
@@ -1116,11 +1119,11 @@ class boss_the_lich_king : public CreatureScript
Talk(SAY_LK_OUTRO_6);
if (Creature* tirion = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_HIGHLORD_TIRION_FORDRING)))
tirion->SetFacingToObject(me);
- me->CastSpell((Unit*)NULL, SPELL_SUMMON_BROKEN_FROSTMOURNE_3, TRIGGERED_IGNORE_CAST_IN_PROGRESS);
+ me->CastSpell((Unit*)nullptr, SPELL_SUMMON_BROKEN_FROSTMOURNE_3, TRIGGERED_IGNORE_CAST_IN_PROGRESS);
SetEquipmentSlots(false, EQUIP_UNEQUIP);
break;
case EVENT_OUTRO_SOUL_BARRAGE:
- me->CastSpell((Unit*)NULL, SPELL_SOUL_BARRAGE, TRIGGERED_IGNORE_CAST_IN_PROGRESS);
+ me->CastSpell((Unit*)nullptr, SPELL_SOUL_BARRAGE, TRIGGERED_IGNORE_CAST_IN_PROGRESS);
sCreatureTextMgr->SendSound(me, SOUND_PAIN, CHAT_MSG_MONSTER_YELL, 0, TEXT_RANGE_NORMAL, TEAM_OTHER, false);
// set flight
me->SetDisableGravity(true);
@@ -1690,7 +1693,7 @@ class npc_strangulate_vehicle : public CreatureScript
{
if (Unit* summoner = summ->GetSummoner())
{
- summoner->CastSpell((Unit*)NULL, SPELL_HARVEST_SOUL_VISUAL, true);
+ summoner->CastSpell((Unit*)nullptr, SPELL_HARVEST_SOUL_VISUAL, true);
summoner->ExitVehicle(summoner);
if (!IsHeroic())
summoner->CastSpell(summoner, SPELL_HARVEST_SOUL_TELEPORT, true);
@@ -1772,7 +1775,7 @@ class npc_terenas_menethil : public CreatureScript
}
break;
case ACTION_TELEPORT_BACK:
- me->CastSpell((Unit*)NULL, SPELL_RESTORE_SOUL, TRIGGERED_NONE);
+ me->CastSpell((Unit*)nullptr, SPELL_RESTORE_SOUL, TRIGGERED_NONE);
me->DespawnOrUnsummon(3000);
break;
default:
@@ -1802,7 +1805,7 @@ class npc_terenas_menethil : public CreatureScript
_events.ScheduleEvent(EVENT_TELEPORT_BACK, 1000);
if (Creature* warden = me->FindNearestCreature(NPC_SPIRIT_WARDEN, 20.0f))
{
- warden->CastSpell((Unit*)NULL, SPELL_DESTROY_SOUL, TRIGGERED_NONE);
+ warden->CastSpell((Unit*)nullptr, SPELL_DESTROY_SOUL, TRIGGERED_NONE);
warden->DespawnOrUnsummon(2000);
}
@@ -1860,7 +1863,7 @@ class npc_terenas_menethil : public CreatureScript
case EVENT_DESTROY_SOUL:
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
if (Creature* warden = me->FindNearestCreature(NPC_SPIRIT_WARDEN, 20.0f))
- warden->CastSpell((Unit*)NULL, SPELL_DESTROY_SOUL, TRIGGERED_NONE);
+ warden->CastSpell((Unit*)nullptr, SPELL_DESTROY_SOUL, TRIGGERED_NONE);
DoCast(SPELL_TERENAS_LOSES_INSIDE);
_events.ScheduleEvent(EVENT_TELEPORT_BACK, 1000);
break;
@@ -2112,9 +2115,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*/)
@@ -2132,7 +2133,7 @@ class spell_the_lich_king_necrotic_plague : public SpellScriptLoader
CustomSpellValues values;
//values.AddSpellMod(SPELLVALUE_AURA_STACK, 2);
values.AddSpellMod(SPELLVALUE_MAX_TARGETS, 1);
- GetTarget()->CastCustomSpell(SPELL_NECROTIC_PLAGUE_JUMP, values, NULL, TRIGGERED_FULL_MASK, NULL, NULL, GetCasterGUID());
+ GetTarget()->CastCustomSpell(SPELL_NECROTIC_PLAGUE_JUMP, values, nullptr, TRIGGERED_FULL_MASK, nullptr, nullptr, GetCasterGUID());
if (Unit* caster = GetCaster())
caster->CastSpell(caster, SPELL_PLAGUE_SIPHON, true);
}
@@ -2228,7 +2229,7 @@ class spell_the_lich_king_necrotic_plague_jump : public SpellScriptLoader
CustomSpellValues values;
values.AddSpellMod(SPELLVALUE_AURA_STACK, GetStackAmount());
- GetTarget()->CastCustomSpell(SPELL_NECROTIC_PLAGUE_JUMP, values, NULL, TRIGGERED_FULL_MASK, NULL, NULL, GetCasterGUID());
+ GetTarget()->CastCustomSpell(SPELL_NECROTIC_PLAGUE_JUMP, values, nullptr, TRIGGERED_FULL_MASK, nullptr, nullptr, GetCasterGUID());
if (Unit* caster = GetCaster())
caster->CastSpell(caster, SPELL_PLAGUE_SIPHON, true);
}
@@ -2247,7 +2248,7 @@ class spell_the_lich_king_necrotic_plague_jump : public SpellScriptLoader
CustomSpellValues values;
values.AddSpellMod(SPELLVALUE_AURA_STACK, GetStackAmount());
values.AddSpellMod(SPELLVALUE_BASE_POINT1, AURA_REMOVE_BY_ENEMY_SPELL); // add as marker (spell has no effect 1)
- GetTarget()->CastCustomSpell(SPELL_NECROTIC_PLAGUE_JUMP, values, NULL, TRIGGERED_FULL_MASK, NULL, NULL, GetCasterGUID());
+ GetTarget()->CastCustomSpell(SPELL_NECROTIC_PLAGUE_JUMP, values, nullptr, TRIGGERED_FULL_MASK, nullptr, nullptr, GetCasterGUID());
if (Unit* caster = GetCaster())
caster->CastSpell(caster, SPELL_PLAGUE_SIPHON, true);
@@ -2317,7 +2318,7 @@ class spell_the_lich_king_shadow_trap_periodic : public SpellScriptLoader
if (targets.empty())
return;
- GetCaster()->CastSpell((Unit*)NULL, SPELL_SHADOW_TRAP_KNOCKBACK, true);
+ GetCaster()->CastSpell((Unit*)nullptr, SPELL_SHADOW_TRAP_KNOCKBACK, true);
}
void Register() override
@@ -2343,7 +2344,7 @@ class spell_the_lich_king_quake : public SpellScriptLoader
bool Load() override
{
- return GetCaster()->GetInstanceScript() != NULL;
+ return GetCaster()->GetInstanceScript() != nullptr;
}
void FilterTargets(std::list<WorldObject*>& targets)
@@ -2382,9 +2383,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)
@@ -2540,9 +2539,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*/)
@@ -2572,18 +2569,9 @@ class spell_the_lich_king_valkyr_target_search : public SpellScriptLoader
{
PrepareSpellScript(spell_the_lich_king_valkyr_target_search_SpellScript);
- public:
- spell_the_lich_king_valkyr_target_search_SpellScript()
- {
- _target = nullptr;
- }
-
- private:
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_CHARGE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_CHARGE });
}
void SelectTarget(std::list<WorldObject*>& targets)
@@ -2621,7 +2609,7 @@ class spell_the_lich_king_valkyr_target_search : public SpellScriptLoader
OnEffectHitTarget += SpellEffectFn(spell_the_lich_king_valkyr_target_search_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
- WorldObject* _target;
+ WorldObject* _target = nullptr;
};
SpellScript* GetSpellScript() const override
@@ -2667,9 +2655,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()
@@ -2714,7 +2700,7 @@ class spell_the_lich_king_vile_spirits : public SpellScriptLoader
void OnPeriodic(AuraEffect const* aurEff)
{
if (_is25Man || ((aurEff->GetTickNumber() - 1) % 5))
- GetTarget()->CastSpell((Unit*)NULL, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true, NULL, aurEff, GetCasterGUID());
+ GetTarget()->CastSpell((Unit*)nullptr, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true, nullptr, aurEff, GetCasterGUID());
}
void Register() override
@@ -2837,7 +2823,7 @@ class spell_the_lich_king_vile_spirit_damage_target_search : public SpellScriptL
if (TempSummon* summon = GetCaster()->ToTempSummon())
if (Unit* summoner = summon->GetSummoner())
summoner->GetAI()->SetData(DATA_VILE, 1);
- GetCaster()->CastSpell((Unit*)NULL, SPELL_SPIRIT_BURST, true);
+ GetCaster()->CastSpell((Unit*)nullptr, SPELL_SPIRIT_BURST, true);
GetCaster()->ToCreature()->DespawnOrUnsummon(3000);
GetCaster()->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
}
@@ -2865,14 +2851,14 @@ class spell_the_lich_king_harvest_soul : public SpellScriptLoader
bool Load() override
{
- return GetOwner()->GetInstanceScript() != NULL;
+ return GetOwner()->GetInstanceScript() != nullptr;
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
// m_originalCaster to allow stacking from different casters, meh
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_DEATH)
- GetTarget()->CastSpell((Unit*)NULL, SPELL_HARVESTED_SOUL, true, NULL, NULL, GetTarget()->GetInstanceScript()->GetGuidData(DATA_THE_LICH_KING));
+ GetTarget()->CastSpell((Unit*)nullptr, SPELL_HARVESTED_SOUL, true, nullptr, nullptr, GetTarget()->GetInstanceScript()->GetGuidData(DATA_THE_LICH_KING));
}
void Register() override
@@ -2938,7 +2924,7 @@ class spell_the_lich_king_soul_rip : public SpellScriptLoader
PreventDefaultAction();
// shouldn't be needed, this is channeled
if (Unit* caster = GetCaster())
- caster->CastCustomSpell(SPELL_SOUL_RIP_DAMAGE, SPELLVALUE_BASE_POINT0, 5000 * aurEff->GetTickNumber(), GetTarget(), true, NULL, aurEff, GetCasterGUID());
+ caster->CastCustomSpell(SPELL_SOUL_RIP_DAMAGE, SPELLVALUE_BASE_POINT0, 5000 * aurEff->GetTickNumber(), GetTarget(), true, nullptr, aurEff, GetCasterGUID());
}
void Register() override
@@ -2972,7 +2958,7 @@ class spell_the_lich_king_restore_soul : public SpellScriptLoader
bool Load() override
{
_instance = GetCaster()->GetInstanceScript();
- return _instance != NULL;
+ return _instance != nullptr;
}
void HandleScript(SpellEffIndex /*effIndex*/)
@@ -3024,9 +3010,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)
@@ -3063,14 +3047,14 @@ class spell_the_lich_king_in_frostmourne_room : public SpellScriptLoader
bool Load() override
{
- return GetOwner()->GetInstanceScript() != NULL;
+ return GetOwner()->GetInstanceScript() != nullptr;
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
// m_originalCaster to allow stacking from different casters, meh
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_DEATH)
- GetTarget()->CastSpell((Unit*)NULL, SPELL_HARVESTED_SOUL, true, NULL, NULL, GetTarget()->GetInstanceScript()->GetGuidData(DATA_THE_LICH_KING));
+ GetTarget()->CastSpell((Unit*)nullptr, SPELL_HARVESTED_SOUL, true, nullptr, nullptr, GetTarget()->GetInstanceScript()->GetGuidData(DATA_THE_LICH_KING));
}
void Register() override
@@ -3097,7 +3081,7 @@ class spell_the_lich_king_summon_spirit_bomb : public SpellScriptLoader
void HandleScript(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
- GetHitUnit()->CastSpell((Unit*)NULL, uint32(GetEffectValue()), true);
+ GetHitUnit()->CastSpell((Unit*)nullptr, uint32(GetEffectValue()), true);
}
void Register() override
@@ -3155,7 +3139,7 @@ class spell_the_lich_king_jump : public SpellScriptLoader
{
PreventHitDefaultEffect(effIndex);
GetHitUnit()->RemoveAurasDueToSpell(SPELL_RAISE_DEAD);
- GetHitUnit()->CastSpell((Unit*)NULL, SPELL_JUMP_2, true);
+ GetHitUnit()->CastSpell((Unit*)nullptr, SPELL_JUMP_2, true);
if (Creature* creature = GetHitCreature())
creature->AI()->DoAction(ACTION_BREAK_FROSTMOURNE);
}
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp
index 867fc1ae688..c558aa47d52 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp
@@ -15,15 +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 "Cell.h"
#include "CellImpl.h"
-#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "icecrown_citadel.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
+#include "ObjectMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellAuraEffects.h"
+#include "SpellScript.h"
enum Texts
{
@@ -684,7 +686,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);
}
};
@@ -1265,9 +1267,7 @@ class spell_dreamwalker_summon_suppresser : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_SUPPRESSER))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SUMMON_SUPPRESSER });
}
void PeriodicTick(AuraEffect const* /*aurEff*/)
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp
index 6a56da6e902..789370d8762 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp
@@ -15,18 +15,20 @@
* 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 "CellImpl.h"
-#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
-#include "SpellAuraEffects.h"
-#include "SmartAI.h"
#include "icecrown_citadel.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
+#include "PassiveAI.h"
+#include "ScriptedEscortAI.h"
+#include "SmartAI.h"
+#include "SpellMgr.h"
+#include "SpellScript.h"
+#include "TemporarySummon.h"
+#include "VehicleDefines.h"
// Weekly quest support
// * Deprogramming (DONE)
@@ -731,7 +733,7 @@ class npc_alchemist_adrianna : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_alchemist_adriannaAI(creature);
+ return GetIcecrownCitadelAI<npc_alchemist_adriannaAI>(creature);
}
};
@@ -1119,7 +1121,7 @@ class npc_crok_scourgebane : public CreatureScript
if (!_wipeCheckTimer)
{
_wipeCheckTimer = 1000;
- Player* player = NULL;
+ Player* player = nullptr;
Trinity::AnyPlayerInObjectRangeCheck check(me, 60.0f);
Trinity::PlayerSearcher<Trinity::AnyPlayerInObjectRangeCheck> searcher(me, player, check);
Cell::VisitWorldObjects(me, searcher, 60.0f);
@@ -1433,7 +1435,7 @@ class npc_captain_arnath : public CreatureScript
private:
Creature* FindFriendlyCreature() const
{
- Creature* target = NULL;
+ Creature* target = nullptr;
Trinity::MostHPMissingInRange u_check(me, 60.0f, 0);
Trinity::CreatureLastSearcher<Trinity::MostHPMissingInRange> searcher(me, target, u_check);
Cell::VisitGridObjects(me, searcher, 60.0f);
@@ -1674,7 +1676,7 @@ class npc_frostwing_vrykul : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_frostwing_vrykulAI(creature);
+ return GetIcecrownCitadelAI<npc_frostwing_vrykulAI>(creature);
}
};
@@ -1718,7 +1720,7 @@ class npc_impaling_spear : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_impaling_spearAI(creature);
+ return GetIcecrownCitadelAI<npc_impaling_spearAI>(creature);
}
};
@@ -1768,7 +1770,7 @@ class npc_arthas_teleport_visual : public CreatureScript
return GetIcecrownCitadelAI<npc_arthas_teleport_visualAI>(creature);
// Default to no script
- return NULL;
+ return nullptr;
}
};
@@ -2107,6 +2109,49 @@ 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) { }
+
+ private:
+ 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 8607714ff9c..e40ba687312 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h
+++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h
@@ -18,7 +18,11 @@
#ifndef ICECROWN_CITADEL_H_
#define ICECROWN_CITADEL_H_
-#include "SpellScript.h"
+#include "CreatureAIImpl.h"
+#include "ScriptMgr.h"
+
+struct Position;
+enum TriggerCastFlags : uint32;
#define ICCScriptName "instance_icecrown_citadel"
#define DataHeader "IC"
@@ -527,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, TriggerCastFlags triggerFlags);
+ spell_trigger_spell_from_caster(char const* scriptName, uint32 triggerId);
+ SpellScript* GetSpellScript() const override;
private:
uint32 _triggerId;
TriggerCastFlags _triggerFlags;
};
-template<class AI, class T>
+template <class AI, class 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 571de70bc0a..d9158249649 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel_teleport.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel_teleport.cpp
@@ -15,13 +15,15 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "ScriptMgr.h"
+#include "GameObject.h"
#include "GameObjectAI.h"
+#include "icecrown_citadel.h"
#include "InstanceScript.h"
#include "Player.h"
#include "ScriptedGossip.h"
-#include "ScriptMgr.h"
#include "Spell.h"
-#include "icecrown_citadel.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 4f14a49cf49..37baf7afe8d 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp
@@ -15,17 +15,19 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "AccountMgr.h"
+#include "ScriptMgr.h"
+#include "AreaBoundary.h"
+#include "CreatureAI.h"
+#include "icecrown_citadel.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"
enum EventIds
{
@@ -184,7 +186,7 @@ class instance_icecrown_citadel : public InstanceMapScript
{
if (!TeamInInstance)
{
- Map::PlayerList const &players = instance->GetPlayers();
+ Map::PlayerList const& players = instance->GetPlayers();
if (!players.isEmpty())
if (Player* player = players.begin()->GetSource())
TeamInInstance = player->GetTeam();
@@ -1301,12 +1303,12 @@ 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;
stalkers.sort(Trinity::ObjectDistanceOrderPred(teleporter));
- stalkers.front()->CastSpell((Unit*)NULL, SPELL_ARTHAS_TELEPORTER_CEREMONY, false);
+ stalkers.front()->CastSpell((Unit*)nullptr, SPELL_ARTHAS_TELEPORTER_CEREMONY, false);
stalkers.pop_front();
for (std::list<Creature*>::iterator itr = stalkers.begin(); itr != stalkers.end(); ++itr)
(*itr)->AI()->Reset();
@@ -1443,11 +1445,11 @@ class instance_icecrown_citadel : public InstanceMapScript
}
break;
case EVENT_TELEPORT_TO_FROSTMOURNE: // Harvest Soul (normal mode)
- if (Creature* terenas = instance->SummonCreature(NPC_TERENAS_MENETHIL_FROSTMOURNE, TerenasSpawn, NULL, 63000))
+ if (Creature* terenas = instance->SummonCreature(NPC_TERENAS_MENETHIL_FROSTMOURNE, TerenasSpawn, nullptr, 63000))
{
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));
@@ -1455,7 +1457,7 @@ class instance_icecrown_citadel : public InstanceMapScript
visual->CastSpell(visual, SPELL_FROSTMOURNE_TELEPORT_VISUAL, true);
}
- if (Creature* warden = instance->SummonCreature(NPC_SPIRIT_WARDEN, SpiritWardenSpawn, NULL, 63000))
+ if (Creature* warden = instance->SummonCreature(NPC_SPIRIT_WARDEN, SpiritWardenSpawn, nullptr, 63000))
{
terenas->AI()->AttackStart(warden);
warden->AddThreat(terenas, 300000.0f);
diff --git a/src/server/scripts/Northrend/IsleOfConquest/isle_of_conquest.cpp b/src/server/scripts/Northrend/IsleOfConquest/isle_of_conquest.cpp
index 005abab81a4..7918fae1f77 100644
--- a/src/server/scripts/Northrend/IsleOfConquest/isle_of_conquest.cpp
+++ b/src/server/scripts/Northrend/IsleOfConquest/isle_of_conquest.cpp
@@ -16,13 +16,17 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "PassiveAI.h"
#include "BattlegroundIC.h"
+#include "GameObject.h"
+#include "Map.h"
+#include "MotionMaster.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.
@@ -115,8 +119,8 @@ class npc_ioc_gunship_captain : public CreatureScript
DoCast(me, SPELL_TELEPORT_VISUAL_ONLY);
break;
case EVENT_DESPAWN:
- if (me->GetMap()->ToBattlegroundMap())
- if (Battleground* bgIoC = me->GetMap()->ToBattlegroundMap()->GetBG())
+ if (BattlegroundMap* iocMap = me->GetMap()->ToBattlegroundMap())
+ if (Battleground* bgIoC = iocMap->GetBG())
bgIoC->DelCreature(BG_IC_NPC_GUNSHIP_CAPTAIN_1);
break;
default:
@@ -278,9 +282,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 371b250358b..5454ff7c848 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 "ObjectAccessor.h"
#include "naxxramas.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 2814a504b17..da3d95a5173 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp
@@ -16,11 +16,12 @@
*/
#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"
enum Yells
{
@@ -190,7 +191,7 @@ class boss_faerlina : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_faerlinaAI(creature);
+ return GetNaxxramasAI<boss_faerlinaAI>(creature);
}
};
@@ -244,7 +245,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 c38f388d01b..597471597dd 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp
@@ -15,13 +15,18 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "Player.h"
-#include "GameTime.h"
#include "ScriptMgr.h"
+#include "GameTime.h"
+#include "InstanceScript.h"
+#include "Log.h"
+#include "Map.h"
+#include "MotionMaster.h"
+#include "naxxramas.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptedCreature.h"
-#include "SpellScript.h"
#include "SpellAuraEffects.h"
-#include "naxxramas.h"
+#include "SpellScript.h"
enum Horseman
{
@@ -210,7 +215,7 @@ struct boss_four_horsemen_baseAI : public BossAI
return;
}
instance->SetBossState(BOSS_HORSEMEN, IN_PROGRESS);
- Map::PlayerList const &players = me->GetMap()->GetPlayers();
+ Map::PlayerList const& players = me->GetMap()->GetPlayers();
if (players.isEmpty()) // sanity check
ResetEncounter();
@@ -378,7 +383,7 @@ struct boss_four_horsemen_baseAI : public BossAI
private:
const Horseman _which;
- const Position* _initialPath;
+ Position const* _initialPath;
bool _myMovementFinished;
uint8 _nextMovement;
uint32 _timeDied;
@@ -455,7 +460,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);
}
};
@@ -537,7 +542,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);
}
};
@@ -607,7 +612,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);
}
};
@@ -689,7 +694,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..42fbac5ff86 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp
@@ -16,10 +16,12 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
#include "naxxramas.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
#include "SpellScript.h"
-#include <math.h>
enum Texts
{
@@ -94,7 +96,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_gluthAI>(creature);
+ return GetNaxxramasAI<boss_gluthAI>(creature);
}
struct boss_gluthAI : public BossAI
@@ -192,7 +194,7 @@ public:
Creature* zombie = nullptr;
for (SummonList::const_iterator itr = summons.begin(); !zombie && itr != summons.end(); ++itr)
{
- zombie=ObjectAccessor::GetCreature(*me, *itr);
+ zombie = ObjectAccessor::GetCreature(*me, *itr);
if (!zombie || !zombie->IsAlive() || !zombie->IsWithinDistInMap(me, 10.0))
zombie = nullptr;
}
@@ -326,7 +328,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 +475,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 9fcb35b269b..c09de96f7b6 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp
@@ -16,12 +16,16 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "SpellScript.h"
-#include "GridNotifiers.h"
-#include "CombatAI.h"
#include "AreaBoundary.h"
+#include "CombatAI.h"
+#include "GridNotifiers.h"
+#include "InstanceScript.h"
+#include "Log.h"
+#include "Map.h"
#include "naxxramas.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
/* Constants */
enum Yells
@@ -558,7 +562,7 @@ class boss_gothik : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_gothikAI>(creature);
+ return GetNaxxramasAI<boss_gothikAI>(creature);
}
};
@@ -665,7 +669,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);
}
};
@@ -694,7 +698,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);
}
};
@@ -724,7 +728,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);
}
};
@@ -753,7 +757,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);
}
};
@@ -782,7 +786,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);
}
};
@@ -847,7 +851,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);
}
};
@@ -876,7 +880,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);
}
};
@@ -887,7 +891,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 914db8461d4..626a7c023af 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp
@@ -107,7 +107,7 @@ class boss_grobbulus : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_grobbulusAI(creature);
+ return GetNaxxramasAI<boss_grobbulusAI>(creature);
}
};
@@ -135,7 +135,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 +151,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*/)
@@ -166,7 +163,7 @@ class spell_grobbulus_mutating_injection : public SpellScriptLoader
if (Unit* caster = GetCaster())
{
caster->CastSpell(GetTarget(), SPELL_MUTATING_EXPLOSION, true);
- GetTarget()->CastSpell(GetTarget(), SPELL_POISON_CLOUD, true, NULL, aurEff, GetCasterGUID());
+ GetTarget()->CastSpell(GetTarget(), SPELL_POISON_CLOUD, true, nullptr, aurEff, GetCasterGUID());
}
}
@@ -194,9 +191,7 @@ class spell_grobbulus_poison_cloud : public SpellScriptLoader
bool Validate(SpellInfo const* spellInfo) override
{
- if (!sSpellMgr->GetSpellInfo(spellInfo->Effects[EFFECT_0].TriggerSpell))
- return false;
- return true;
+ return ValidateSpellInfo({ spellInfo->Effects[EFFECT_0].TriggerSpell });
}
void PeriodicTick(AuraEffect const* aurEff)
@@ -205,7 +200,7 @@ class spell_grobbulus_poison_cloud : public SpellScriptLoader
uint32 triggerSpell = GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell;
int32 mod = int32(((float(aurEff->GetTickNumber()) / aurEff->GetTotalTicks()) * 0.9f + 0.1f) * 10000 * 2 / 3);
- GetTarget()->CastCustomSpell(triggerSpell, SPELLVALUE_RADIUS_MOD, mod, (Unit*)NULL, TRIGGERED_FULL_MASK, NULL, aurEff);
+ GetTarget()->CastCustomSpell(triggerSpell, SPELLVALUE_RADIUS_MOD, mod, (Unit*)nullptr, TRIGGERED_FULL_MASK, nullptr, aurEff);
}
void Register() override
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp b/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp
index de24bff691a..add15715165 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp
@@ -16,10 +16,14 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "SpellScript.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "Map.h"
#include "naxxramas.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
enum Spells
{
@@ -77,7 +81,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_heiganAI>(creature);
+ return GetNaxxramasAI<boss_heiganAI>(creature);
}
struct boss_heiganAI : public BossAI
@@ -131,8 +135,8 @@ public:
_eruptTiles[section].clear();
for (uint8 i = 0; i < numEruptions[section]; ++i)
{
- std::pair<std::unordered_multimap<uint32, GameObject*>::const_iterator, std::unordered_multimap<uint32, GameObject*>::const_iterator> tileIt = mapGOs.equal_range(spawnId++);
- for (std::unordered_multimap<uint32, GameObject*>::const_iterator it = tileIt.first; it != tileIt.second; ++it)
+ auto tileIt = mapGOs.equal_range(spawnId++);
+ for (auto it = tileIt.first; it != tileIt.second; ++it)
_eruptTiles[section].push_back(it->second->GetGUID());
}
}
@@ -230,13 +234,13 @@ class spell_heigan_eruption : public SpellScriptLoader
void HandleScript(SpellEffIndex /*eff*/)
{
Unit* caster = GetCaster();
- if (!caster || !GetHitPlayer())
+ if (!caster || !GetHitUnit())
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 42c7af5735c..93b91bec9f3 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp
@@ -16,11 +16,17 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "SpellScript.h"
-#include "SpellAuraEffects.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
#include "naxxramas.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "PlayerAI.h"
+#include "ScriptedCreature.h"
+#include "SpellAuraEffects.h"
+#include "SpellScript.h"
+#include "TemporarySummon.h"
enum Texts
{
@@ -568,7 +574,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_kelthuzadAI>(creature);
+ return GetNaxxramasAI<boss_kelthuzadAI>(creature);
}
};
@@ -699,7 +705,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_kelthuzad_skeletonAI>(creature);
+ return GetNaxxramasAI<npc_kelthuzad_skeletonAI>(creature);
}
};
@@ -725,7 +731,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_kelthuzad_bansheeAI>(creature);
+ return GetNaxxramasAI<npc_kelthuzad_bansheeAI>(creature);
}
};
@@ -768,7 +774,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_kelthuzad_abominationAI>(creature);
+ return GetNaxxramasAI<npc_kelthuzad_abominationAI>(creature);
}
};
@@ -862,7 +868,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_kelthuzad_guardianAI>(creature);
+ return GetNaxxramasAI<npc_kelthuzad_guardianAI>(creature);
}
};
@@ -909,9 +915,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)
@@ -922,7 +926,7 @@ public:
if (int32 mana = int32(target->GetMaxPower(POWER_MANA) / 10))
{
mana = target->ModifyPower(POWER_MANA, -mana);
- target->CastCustomSpell(SPELL_MANA_DETONATION_DAMAGE, SPELLVALUE_BASE_POINT0, -mana * 10, target, true, NULL, aurEff);
+ target->CastCustomSpell(SPELL_MANA_DETONATION_DAMAGE, SPELLVALUE_BASE_POINT0, -mana * 10, target, true, nullptr, aurEff);
}
}
@@ -943,7 +947,7 @@ class at_kelthuzad_center : public AreaTriggerScript
public:
at_kelthuzad_center() : AreaTriggerScript("at_kelthuzad_center") { }
- bool OnTrigger(Player* player, const AreaTriggerEntry* /*at*/) override
+ bool OnTrigger(Player* player, AreaTriggerEntry const* /*at*/) override
{
InstanceScript* instance = player->GetInstanceScript();
if (!instance || instance->GetBossState(BOSS_KELTHUZAD) != NOT_STARTED)
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 d513a4e1583..1627cba08b9 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp
@@ -16,10 +16,14 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
+#include "naxxramas.h"
+#include "ObjectAccessor.h"
#include "PassiveAI.h"
+#include "ScriptedCreature.h"
+#include "SpellMgr.h"
#include "SpellScript.h"
-#include "naxxramas.h"
enum Spells
{
@@ -83,7 +87,7 @@ struct WebTargetSelector : public std::unary_function<Unit*, bool>
}
private:
- const Unit* _maexxna;
+ Unit const* _maexxna;
};
class boss_maexxna : public CreatureScript
@@ -93,7 +97,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_maexxnaAI(creature);
+ return GetNaxxramasAI<boss_maexxnaAI>(creature);
}
struct boss_maexxnaAI : public BossAI
@@ -194,7 +198,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_webwrapAI(creature);
+ return GetNaxxramasAI<npc_webwrapAI>(creature);
}
struct npc_webwrapAI : public NullCreatureAI
@@ -217,7 +221,7 @@ public:
if (Unit* victim = ObjectAccessor::GetUnit(*me, victimGUID))
{
visibleTimer = (me->GetDistance2d(victim)/WEB_WRAP_MOVE_SPEED + 0.5f) * IN_MILLISECONDS;
- victim->CastSpell(victim, SPELL_WEB_WRAP, true, NULL, NULL, me->GetGUID());
+ victim->CastSpell(victim, SPELL_WEB_WRAP, true, nullptr, nullptr, me->GetGUID());
}
}
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp b/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp
index daf9aba31bc..9394ececc08 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp
@@ -16,8 +16,9 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "MotionMaster.h"
#include "naxxramas.h"
+#include "ScriptedCreature.h"
enum Phases
{
@@ -334,7 +335,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 6c5ba318354..92dcdf95da4 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
@@ -119,8 +120,8 @@ public:
// Hateful Strike targets the highest non-MT threat in melee range on 10man
// and the higher HP target out of the two highest non-MT threats in melee range on 25man
float MostThreat = 0.0f;
- Unit* secondThreatTarget = NULL;
- Unit* thirdThreatTarget = NULL;
+ Unit* secondThreatTarget = nullptr;
+ Unit* thirdThreatTarget = nullptr;
std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin();
for (; i != me->getThreatManager().getThreatList().end(); ++i)
@@ -148,7 +149,7 @@ public:
}
}
- Unit* pHatefulTarget = NULL;
+ Unit* pHatefulTarget = nullptr;
if (!thirdThreatTarget)
pHatefulTarget = secondThreatTarget;
else if (secondThreatTarget)
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp b/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp
index 51eb68b6eed..4679fb17358 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp
@@ -16,9 +16,12 @@
*/
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
+#include "naxxramas.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
#include "SpellInfo.h"
-#include "naxxramas.h"
enum Yells
{
@@ -60,7 +63,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 +243,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 29e0d9f1555..205a098d077 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp
@@ -16,12 +16,17 @@
*/
#include "ScriptMgr.h"
+#include "GameObject.h"
#include "GameObjectAI.h"
-#include "ScriptedCreature.h"
-#include "SpellScript.h"
+#include "InstanceScript.h"
+#include "MotionMaster.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
{
@@ -376,7 +381,7 @@ class boss_sapphiron : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_sapphironAI(creature);
+ return GetNaxxramasAI<boss_sapphironAI>(creature);
}
};
@@ -412,7 +417,7 @@ class go_sapphiron_birth : public GameObjectScript
GameObjectAI* GetAI(GameObject* go) const override
{
- return GetInstanceAI<go_sapphiron_birthAI>(go);
+ return GetNaxxramasAI<go_sapphiron_birthAI>(go);
}
};
@@ -486,7 +491,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();
}
@@ -517,7 +522,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 48459ffd3a6..a74dd052695 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp
@@ -16,12 +16,15 @@
*/
#include "ScriptMgr.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "naxxramas.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptedCreature.h"
+#include "SpellInfo.h"
#include "SpellScript.h"
-#include "Player.h"
-#include "ObjectGuid.h"
-#include "naxxramas.h"
-
enum Phases
{
@@ -164,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
@@ -480,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
@@ -748,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
@@ -1019,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
@@ -1044,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)
@@ -1143,15 +1147,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*/)
@@ -1195,7 +1200,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 a76284d803b..f8638a33fa0 100644
--- a/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp
@@ -16,9 +16,14 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "AreaBoundary.h"
+#include "CreatureAI.h"
+#include "GameObject.h"
#include "InstanceScript.h"
+#include "Map.h"
+#include "MotionMaster.h"
#include "naxxramas.h"
+#include "TemporarySummon.h"
BossBoundaryData const boundaries =
{
@@ -104,7 +109,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
{
@@ -490,7 +495,7 @@ class instance_naxxramas : public InstanceMapScript
std::list<TempSummon*> spawns;
instance->SummonCreatureGroup(nextFroggerWave, &spawns);
if (!spawns.empty())
- (*spawns.begin())->GetMotionMaster()->MovePath(10 * NPC_FROGGER + nextFroggerWave, false);
+ spawns.front()->GetMotionMaster()->MovePath(10 * NPC_FROGGER + nextFroggerWave, false);
events.Repeat(Seconds(1) + Milliseconds(666));
nextFroggerWave = (nextFroggerWave+1) % 3;
break;
@@ -546,7 +551,7 @@ class instance_naxxramas : public InstanceMapScript
return true;
}
- bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* /*source*/, Unit const* /*target = NULL*/, uint32 /*miscvalue1 = 0*/) override
+ bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* /*source*/, Unit const* /*target = nullptr*/, uint32 /*miscvalue1 = 0*/) override
{
switch (criteria_id)
{
diff --git a/src/server/scripts/Northrend/Naxxramas/naxxramas.h b/src/server/scripts/Northrend/Naxxramas/naxxramas.h
index e847179ddeb..2813e338245 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,11 @@ enum NAXInstanceTexts
SAY_DIALOGUE_SAPPHIRON_LICH_KING2 = 2
};
-/*
-template<class AI>
-CreatureAI* GetNaxxramasAI(Creature* creature)
-{
- if (InstanceMap* instance = creature->GetMap()->ToInstanceMap())
- if (instance->GetInstanceScript())
- if (instance->GetScriptId() == sObjectMgr->GetScriptId(NaxxramasScriptName))
- return new AI(creature);
- return NULL;
+template <class AI, class T>
+inline AI* GetNaxxramasAI(T* obj)
+{
+ 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 7994c5b640d..dcf26afa14b 100644
--- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp
+++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp
@@ -20,16 +20,22 @@ SDName: Boss Malygos
Script Data End */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "SpellScript.h"
-#include "SpellAuraEffects.h"
+#include "CombatAI.h"
+#include "CreatureTextMgr.h"
#include "eye_of_eternity.h"
+#include "GameObject.h"
+#include "GameObjectAI.h"
+#include "GridNotifiers.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "ScriptedCreature.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
{
@@ -998,7 +1004,7 @@ public:
_JustDied();
Talk(SAY_DEATH);
if (Creature* alexstraszaGiftBoxBunny = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_GIFT_BOX_BUNNY_GUID)))
- alexstraszaGiftBoxBunny->SummonGameObject(RAID_MODE(GO_HEART_OF_MAGIC_10, GO_HEART_OF_MAGIC_25), HeartOfMagicSpawnPos, G3D::Quat(), 0);
+ alexstraszaGiftBoxBunny->SummonGameObject(RAID_MODE(GO_HEART_OF_MAGIC_10, GO_HEART_OF_MAGIC_25), HeartOfMagicSpawnPos, QuaternionData(), 0);
me->SummonCreature(NPC_ALEXSTRASZA, AlexstraszaSpawnPos, TEMPSUMMON_MANUAL_DESPAWN);
me->DespawnOrUnsummon(5*IN_MILLISECONDS);
@@ -1027,7 +1033,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_malygosAI>(creature);
+ return GetEyeOfEternityAI<boss_malygosAI>(creature);
}
};
@@ -1077,7 +1083,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_portal_eoeAI>(creature);
+ return GetEyeOfEternityAI<npc_portal_eoeAI>(creature);
}
};
@@ -1138,7 +1144,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_power_sparkAI>(creature);
+ return GetEyeOfEternityAI<npc_power_sparkAI>(creature);
}
};
@@ -1249,7 +1255,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_melee_hover_diskAI>(creature);
+ return GetEyeOfEternityAI<npc_melee_hover_diskAI>(creature);
}
};
@@ -1312,7 +1318,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_caster_hover_diskAI>(creature);
+ return GetEyeOfEternityAI<npc_caster_hover_diskAI>(creature);
}
};
@@ -1388,7 +1394,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);
}
};
@@ -1455,7 +1461,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);
}
};
@@ -1509,7 +1515,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_arcane_overloadAI>(creature);
+ return GetEyeOfEternityAI<npc_arcane_overloadAI>(creature);
}
};
@@ -1574,7 +1580,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_wyrmrest_skytalonAI(creature);
+ return GetEyeOfEternityAI<npc_wyrmrest_skytalonAI>(creature);
}
};
@@ -1600,7 +1606,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);
}
};
@@ -1620,10 +1626,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*/)
@@ -1723,10 +1726,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)
@@ -1820,10 +1820,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*/)
@@ -1842,7 +1839,7 @@ class spell_malygos_vortex_visual : public SpellScriptLoader
if (InstanceScript* instance = caster->GetInstanceScript())
{
// Teleport spell - I'm not sure but might be it must be cast by each vehicle when it's passenger leaves it.
- if (Creature* trigger = caster->GetMap()->GetCreature(instance->GetGuidData(DATA_TRIGGER)))
+ if (Creature* trigger = ObjectAccessor::GetCreature(*caster, instance->GetGuidData(DATA_TRIGGER)))
trigger->CastSpell(targetPlayer, SPELL_VORTEX_6, true);
}
}
@@ -1978,7 +1975,7 @@ class spell_scion_of_eternity_arcane_barrage : public SpellScriptLoader
bool Load() override
{
- return GetCaster()->GetTypeId() == TYPEID_UNIT && GetCaster()->GetInstanceScript() != NULL;
+ return GetCaster()->GetTypeId() == TYPEID_UNIT && GetCaster()->GetInstanceScript() != nullptr;
}
void FilterMeleeHoverDiskPassangers(std::list<WorldObject*>& targets)
@@ -2063,10 +2060,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*/)
@@ -2105,10 +2099,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*/)
@@ -2153,7 +2144,7 @@ class spell_alexstrasza_bunny_destroy_platform_event : public SpellScriptLoader
void HandleScript(SpellEffIndex /*effIndex*/)
{
- GetCaster()->CastSpell((Unit*)NULL, SPELL_SUMMON_RED_DRAGON_BUDDY_F_CAST);
+ GetCaster()->CastSpell((Unit*)nullptr, SPELL_SUMMON_RED_DRAGON_BUDDY_F_CAST);
}
void Register() override
@@ -2251,10 +2242,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)
@@ -2285,7 +2273,7 @@ class spell_malygos_surge_of_power_warning_selector_25 : public SpellScriptLoade
void ExecuteMainSpell()
{
- GetCaster()->ToCreature()->CastSpell((Unit*)NULL, SPELL_SURGE_OF_POWER_PHASE_3_25);
+ GetCaster()->ToCreature()->CastSpell((Unit*)nullptr, SPELL_SURGE_OF_POWER_PHASE_3_25);
}
void Register() override
@@ -2368,10 +2356,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*/)
@@ -2425,9 +2410,9 @@ class spell_alexstrasza_gift_beam_visual : public SpellScriptLoader
if (Creature* target = GetTarget()->ToCreature())
{
if (target->GetMap()->GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL)
- _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()->GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL)
- _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 52a32da8c60..0de2d1a9e2a 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 EOEInstanceData
@@ -84,4 +87,10 @@ enum EOEInstanceSpells
SPELL_SUMMOM_RED_DRAGON_BUDDY = 56070
};
+template <class AI, class T>
+inline AI* GetEyeOfEternityAI(T* obj)
+{
+ return GetInstanceAI<AI>(obj, 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 d5ef16f7ad5..ef10057f180 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
{
@@ -86,7 +90,7 @@ public:
void SpawnGameObject(uint32 entry, Position const& pos)
{
GameObject* go = new GameObject();
- if (!go->Create(instance->GenerateLowGuid<HighGuid::GameObject>(), entry, instance, PHASEMASK_NORMAL, pos, G3D::Quat(), 255, GO_STATE_READY))
+ if (!go->Create(instance->GenerateLowGuid<HighGuid::GameObject>(), 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 e8c5da8d76e..11322c30d1d 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 3d19f54d84a..cb17a64563a 100644
--- a/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp
+++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp
@@ -16,12 +16,15 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "GameObject.h"
#include "GameObjectAI.h"
-#include "SpellScript.h"
-#include "SpellAuraEffects.h"
-#include "Player.h"
+#include "InstanceScript.h"
#include "nexus.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
+#include "ScriptedCreature.h"
+#include "SpellAuraEffects.h"
+#include "SpellScript.h"
enum Spells
{
@@ -216,7 +219,7 @@ class boss_keristrasza : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_keristraszaAI>(creature);
+ return GetNexusAI<boss_keristraszaAI>(creature);
}
};
@@ -248,7 +251,7 @@ public:
GameObjectAI* GetAI(GameObject* go) const override
{
- return GetInstanceAI<containment_sphereAI>(go);
+ return GetNexusAI<containment_sphereAI>(go);
}
};
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 a3d6f1a107a..09944d921bc 100644
--- a/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp
+++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp
@@ -16,11 +16,14 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "ScriptMgr.h"
#include "GameEventMgr.h"
#include "GameTime.h"
-#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
#include "nexus.h"
+#include "ScriptedCreature.h"
+#include "TemporarySummon.h"
enum Spells
{
@@ -71,7 +74,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 dcb1886e818..cb07de16ab7 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"
class instance_nexus : public InstanceMapScript
{
diff --git a/src/server/scripts/Northrend/Nexus/Nexus/nexus.h b/src/server/scripts/Northrend/Nexus/Nexus/nexus.h
index c4b07c78c3b..3045c922f4b 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 <class AI, class T>
+inline AI* GetNexusAI(T* 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 90eeafb407b..c81f378b8b4 100644
--- a/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp
+++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp
@@ -16,8 +16,10 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
#include "oculus.h"
+#include "ScriptedCreature.h"
enum Spells
{
@@ -201,7 +203,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..06a99cd6c3e 100644
--- a/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp
+++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp
@@ -16,10 +16,10 @@
*/
#include "ScriptMgr.h"
+#include "MotionMaster.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 +258,7 @@ class boss_eregos : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_eregosAI(creature);
+ return GetOculusAI<boss_eregosAI>(creature);
}
};
diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp
index b07c0f22169..459b9cb188d 100644
--- a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp
+++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp
@@ -23,8 +23,9 @@ SDCategory: Instance Script
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "MotionMaster.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..460288d99f0 100644
--- a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp
+++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp
@@ -16,10 +16,13 @@
*/
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
+#include "oculus.h"
#include "ScriptedCreature.h"
+#include "SpellInfo.h"
#include "SpellScript.h"
-#include "SpellAuraEffects.h"
-#include "oculus.h"
enum Says
{
@@ -233,7 +236,7 @@ class npc_azure_ring_captain : public CreatureScript
{
switch (action)
{
- case ACTION_CALL_DRAGON_EVENT:
+ case ACTION_CALL_DRAGON_EVENT:
if (Creature* varos = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_VAROS)))
{
if (Unit* victim = varos->AI()->SelectTarget(SELECT_TARGET_RANDOM, 0))
@@ -255,7 +258,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 +274,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 4d152ba5fa4..41189cf818b 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 "GameObject.h"
#include "InstanceScript.h"
-#include "WorldPacket.h"
+#include "Map.h"
+#include "MotionMaster.h"
#include "oculus.h"
+#include "TemporarySummon.h"
+#include "WorldPacket.h"
DoorData const doorData[] =
{
@@ -111,11 +116,10 @@ class instance_oculus : public InstanceMapScript
void OnGameObjectCreate(GameObject* go) override
{
+ InstanceScript::OnGameObjectCreate(go);
+
switch (go->GetEntry())
{
- case GO_DRAGON_CAGE_DOOR:
- AddDoor(go, true);
- break;
case GO_EREGOS_CACHE_N:
case GO_EREGOS_CACHE_H:
EregosCacheGUID = go->GetGUID();
@@ -125,18 +129,6 @@ class instance_oculus : public InstanceMapScript
}
}
- void OnGameObjectRemove(GameObject* go) override
- {
- switch (go->GetEntry())
- {
- case GO_DRAGON_CAGE_DOOR:
- AddDoor(go, false);
- break;
- default:
- break;
- }
- }
-
void OnUnitDeath(Unit* unit) override
{
Creature* creature = unit->ToCreature();
diff --git a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp
index 4aa0cf0d76e..96b354e9ba2 100644
--- a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp
+++ b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp
@@ -16,15 +16,18 @@
*/
#include "ScriptMgr.h"
+#include "CombatAI.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
+#include "oculus.h"
+#include "Player.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
-#include "SpellScript.h"
+#include "Spell.h"
#include "SpellAuraEffects.h"
-#include "SpellInfo.h"
-#include "CombatAI.h"
-#include "Player.h"
+#include "SpellScript.h"
#include "Vehicle.h"
-#include "oculus.h"
enum GossipNPCs
{
@@ -263,7 +266,7 @@ class npc_ruby_emerald_amber_drake : public CreatureScript
Initialize();
}
- void SpellHit(Unit* /*caster*/, const SpellInfo* spell) override
+ void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
{
if (Unit* creator = ObjectAccessor::GetUnit(*me, me->GetCreatorGUID()))
if (spell->Id == SPELL_GPS)
@@ -478,9 +481,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*/)
@@ -515,9 +516,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()
@@ -557,9 +556,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*/)
@@ -597,9 +594,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 712c7f3963d..4967d3e56e4 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,10 +107,10 @@ enum OCMisc
POINT_MOVE_OUT = 1
};
-template<class AI>
-AI* GetOculusAI(Creature* creature)
+template <class AI, class T>
+inline AI* GetOculusAI(T* obj)
{
- return GetInstanceAI<AI>(creature, OculusScriptName);
+ return GetInstanceAI<AI>(obj, OculusScriptName);
}
#endif // OCULUS_H_
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..a61b5f91489 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp
@@ -21,8 +21,11 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "halls_of_lightning.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
#include "SpellInfo.h"
enum Spells
@@ -69,7 +72,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_ionarAI>(creature);
+ return GetHallsOfLightningAI<boss_ionarAI>(creature);
}
struct boss_ionarAI : public ScriptedAI
@@ -144,7 +147,7 @@ public:
Talk(SAY_SLAY);
}
- void SpellHit(Unit* /*caster*/, const SpellInfo* spell) override
+ void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_DISPERSE)
{
@@ -376,7 +379,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 3cd470d1a37..a749b783fc2 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp
@@ -24,9 +24,11 @@ SDCategory: Halls of Lightning
EndScriptData */
#include "ScriptMgr.h"
+#include "halls_of_lightning.h"
+#include "InstanceScript.h"
#include "ScriptedCreature.h"
+#include "SpellMgr.h"
#include "SpellScript.h"
-#include "halls_of_lightning.h"
enum Texts
{
@@ -205,7 +207,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 c0c2998f874..604fdeb6123 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp
@@ -24,10 +24,12 @@ SDCategory: Halls of Lightning
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "halls_of_lightning.h"
-#include "Player.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
#include "SpellInfo.h"
+#include "SpellMgr.h"
enum Texts
{
@@ -200,7 +202,7 @@ public:
summoned->GetMotionMaster()->MoveFollow(target, 0.0f, 0.0f);
// Why healing when just summoned?
- summoned->CastSpell(summoned, SPELL_HEAT, false, NULL, NULL, me->GetGUID());
+ summoned->CastSpell(summoned, SPELL_HEAT, false, nullptr, nullptr, me->GetGUID());
}
}
@@ -365,9 +367,8 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_volkhanAI>(creature);
+ return GetHallsOfLightningAI<boss_volkhanAI>(creature);
}
-
};
/*######
@@ -381,7 +382,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
@@ -437,7 +438,7 @@ public:
}
}
- void SpellHit(Unit* /*pCaster*/, const SpellInfo* pSpell) override
+ void SpellHit(Unit* /*pCaster*/, SpellInfo const* pSpell) override
{
// This is the dummy effect of the spells
if (pSpell->Id == sSpellMgr->GetSpellIdForDifficulty(SPELL_SHATTER, me))
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..742b36c539f 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,10 +51,10 @@ enum HOLGameObjectIds
GO_LOKEN_THRONE = 192654
};
-template<class AI>
-AI* GetHallsOfLightningAI(Creature* creature)
+template <class AI, class T>
+inline AI* GetHallsOfLightningAI(T* obj)
{
- return GetInstanceAI<AI>(creature, HoLScriptName);
+ return GetInstanceAI<AI>(obj, HoLScriptName);
}
#endif // HALLS_OF_LIGHTNING_H_
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..0508db5fddb 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,15 +16,18 @@
*/
#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[] =
{
{ GO_VOLKHAN_DOOR, DATA_VOLKHAN, DOOR_TYPE_PASSAGE },
{ GO_IONAR_DOOR, DATA_IONAR, DOOR_TYPE_PASSAGE },
{ GO_LOKEN_DOOR, DATA_LOKEN, DOOR_TYPE_PASSAGE },
- { 0, 0, DOOR_TYPE_ROOM } // END
+ { 0, 0, DOOR_TYPE_ROOM } // END
};
class instance_halls_of_lightning : public InstanceMapScript
@@ -64,13 +67,10 @@ class instance_halls_of_lightning : public InstanceMapScript
void OnGameObjectCreate(GameObject* go) override
{
+ InstanceScript::OnGameObjectCreate(go);
+
switch (go->GetEntry())
{
- case GO_VOLKHAN_DOOR:
- case GO_IONAR_DOOR:
- case GO_LOKEN_DOOR:
- AddDoor(go, true);
- break;
case GO_LOKEN_THRONE:
LokenGlobeGUID = go->GetGUID();
break;
@@ -79,20 +79,6 @@ class instance_halls_of_lightning : public InstanceMapScript
}
}
- void OnGameObjectRemove(GameObject* go) override
- {
- switch (go->GetEntry())
- {
- case GO_VOLKHAN_DOOR:
- case GO_IONAR_DOOR:
- case GO_LOKEN_DOOR:
- AddDoor(go, false);
- break;
- default:
- break;
- }
- }
-
bool SetBossState(uint32 type, EncounterState state) override
{
if (!InstanceScript::SetBossState(type, state))
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp
index 4674984d8c3..338b273808f 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp
@@ -16,9 +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
{
@@ -155,7 +156,7 @@ class spell_krystallus_shatter : public SpellScriptLoader
if (Unit* target = GetHitUnit())
{
target->RemoveAurasDueToSpell(SPELL_STONED);
- target->CastSpell((Unit*)NULL, SPELL_SHATTER_EFFECT, true);
+ target->CastSpell((Unit*)nullptr, SPELL_SHATTER_EFFECT, true);
}
}
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 692875c496c..6463c0c1aef 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..9f6ccce5a87 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp
@@ -16,8 +16,11 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "halls_of_stone.h"
+#include "InstanceScript.h"
+#include "MotionMaster.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 9937f4d6fc7..2e926b17710 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 "ScriptedEscortAI.h"
+#include "ScriptedGossip.h"
+#include "TemporarySummon.h"
enum Texts
{
@@ -553,7 +555,7 @@ public:
me->SetStandState(UNIT_STAND_STATE_STAND);
instance->HandleGameObject(instance->GetGuidData(DATA_GO_SKY_FLOOR), true);
if (Creature* temp = ObjectAccessor::GetCreature(*me, uiControllerGUID))
- temp->DealDamage(temp, temp->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
+ temp->DealDamage(temp, temp->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
bIsBattle = true;
SetEscortPaused(false);
JumpToNextStep(6500);
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..358ab05f024 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,10 +69,10 @@ enum HOSGameObjectIds
GO_TRIBUNAL_SKY_FLOOR = 191527
};
-template<class AI>
-AI* GetHallsOfStoneAI(Creature* creature)
+template <class AI, class T>
+inline AI* GetHallsOfStoneAI(T* obj)
{
- return GetInstanceAI<AI>(creature, HoSScriptName);
+ return GetInstanceAI<AI>(obj, HoSScriptName);
}
#endif // HALLS_OF_STONE_H_
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..8f8897cee95 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,13 @@
* 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"
+#include "Player.h"
DoorData const doorData[] =
{
@@ -72,6 +75,8 @@ class instance_halls_of_stone : public InstanceMapScript
void OnGameObjectCreate(GameObject* go) override
{
+ InstanceScript::OnGameObjectCreate(go);
+
switch (go->GetEntry())
{
case GO_ABEDNEUM:
@@ -95,21 +100,6 @@ class instance_halls_of_stone : public InstanceMapScript
case GO_TRIBUNAL_SKY_FLOOR:
TribunalSkyFloorGUID = go->GetGUID();
break;
- case GO_SJONNIR_DOOR:
- AddDoor(go, true);
- break;
- default:
- break;
- }
- }
-
- void OnGameObjectRemove(GameObject* go) override
- {
- switch (go->GetEntry())
- {
- case GO_SJONNIR_DOOR:
- AddDoor(go, false);
- break;
default:
break;
}
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp
index 891263bbfcd..aacf9332a75 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp
@@ -15,16 +15,23 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ObjectMgr.h"
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "SpellScript.h"
-#include "PassiveAI.h"
+#include "DBCStores.h"
+#include "GameObject.h"
#include "GameObjectAI.h"
-#include "MapManager.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "MotionMaster.h"
#include "MoveSplineInit.h"
-#include "ulduar.h"
+#include "ObjectAccessor.h"
+#include "PassiveAI.h"
#include "Player.h"
+#include "ScriptedCreature.h"
+#include "Spell.h"
+#include "SpellInfo.h"
+#include "SpellScript.h"
+#include "TemporarySummon.h"
+#include "ulduar.h"
enum Texts
{
@@ -247,7 +254,7 @@ class ActivateLivingConstellation : public BasicEvent
if (!_instance || _instance->GetBossState(BOSS_ALGALON) != IN_PROGRESS)
return true; // delete event
- _owner->CastSpell((Unit*)NULL, SPELL_TRIGGER_3_ADDS, TRIGGERED_FULL_MASK);
+ _owner->CastSpell((Unit*)nullptr, SPELL_TRIGGER_3_ADDS, TRIGGERED_FULL_MASK);
_owner->m_Events.AddEvent(this, execTime + urand(45000, 50000));
return false;
}
@@ -266,7 +273,7 @@ class CosmicSmashDamageEvent : public BasicEvent
bool Execute(uint64 /*execTime*/, uint32 /*diff*/) override
{
- _caster->CastSpell((Unit*)NULL, SPELL_COSMIC_SMASH_TRIGGERED, TRIGGERED_FULL_MASK);
+ _caster->CastSpell((Unit*)nullptr, SPELL_COSMIC_SMASH_TRIGGERED, TRIGGERED_FULL_MASK);
return true;
}
@@ -283,7 +290,7 @@ class SummonUnleashedDarkMatter : public BasicEvent
bool Execute(uint64 execTime, uint32 /*diff*/) override
{
- _caster->CastSpell((Unit*)NULL, SPELL_SUMMON_UNLEASHED_DARK_MATTER, TRIGGERED_FULL_MASK);
+ _caster->CastSpell((Unit*)nullptr, SPELL_SUMMON_UNLEASHED_DARK_MATTER, TRIGGERED_FULL_MASK);
_caster->m_Events.AddEvent(this, execTime + 30000);
return false;
}
@@ -465,9 +472,9 @@ class boss_algalon_the_observer : public CreatureScript
break;
case NPC_BLACK_HOLE:
summon->SetReactState(REACT_PASSIVE);
- summon->CastSpell((Unit*)NULL, SPELL_BLACK_HOLE_TRIGGER, TRIGGERED_FULL_MASK);
+ summon->CastSpell((Unit*)nullptr, SPELL_BLACK_HOLE_TRIGGER, TRIGGERED_FULL_MASK);
summon->CastSpell(summon, SPELL_CONSTELLATION_PHASE_TRIGGER, TRIGGERED_FULL_MASK);
- summon->CastSpell((Unit*)NULL, SPELL_BLACK_HOLE_EXPLOSION);
+ summon->CastSpell((Unit*)nullptr, SPELL_BLACK_HOLE_EXPLOSION);
summon->CastSpell(summon, SPELL_SUMMON_VOID_ZONE_VISUAL, TRIGGERED_FULL_MASK);
break;
case NPC_ALGALON_VOID_ZONE_VISUAL_STALKER:
@@ -777,7 +784,7 @@ class npc_living_constellation : public CreatureScript
me->DespawnOrUnsummon(1);
if (InstanceScript* instance = me->GetInstanceScript())
instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, EVENT_ID_SUPERMASSIVE_START);
- caster->CastSpell((Unit*)NULL, SPELL_BLACK_HOLE_CREDIT, TRIGGERED_FULL_MASK);
+ caster->CastSpell((Unit*)nullptr, SPELL_BLACK_HOLE_CREDIT, TRIGGERED_FULL_MASK);
caster->ToCreature()->DespawnOrUnsummon(1);
}
@@ -1186,7 +1193,7 @@ class spell_algalon_collapse : public SpellScriptLoader
void HandlePeriodic(AuraEffect const* /*aurEff*/)
{
PreventDefaultAction();
- GetTarget()->DealDamage(GetTarget(), GetTarget()->CountPctFromMaxHealth(1), NULL, NODAMAGE);
+ GetTarget()->DealDamage(GetTarget(), GetTarget()->CountPctFromMaxHealth(1), nullptr, NODAMAGE);
}
void Register() override
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 fe6565664fa..0a22fafb95e 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,14 @@ SDCategory: Ulduar - Ulduar
EndScriptData */
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
+#include "SpellAuras.h"
+#include "SpellMgr.h"
#include "SpellScript.h"
-#include "SpellAuraEffects.h"
+#include "TemporarySummon.h"
#include "ulduar.h"
enum AssemblySpells
@@ -206,7 +211,7 @@ class boss_steelbreaker : public CreatureScript
}
else
{
- me->SetLootRecipient(NULL);
+ me->SetLootRecipient(nullptr);
Talk(SAY_STEELBREAKER_DEATH);
//DoCastAOE(SPELL_SUPERCHARGE, true);
@@ -354,7 +359,7 @@ class boss_runemaster_molgeim : public CreatureScript
}
else
{
- me->SetLootRecipient(NULL);
+ me->SetLootRecipient(nullptr);
Talk(SAY_MOLGEIM_DEATH);
//DoCastAOE(SPELL_SUPERCHARGE, true);
@@ -530,7 +535,7 @@ class boss_stormcaller_brundir : public CreatureScript
}
else
{
- me->SetLootRecipient(NULL);
+ me->SetLootRecipient(nullptr);
Talk(SAY_BRUNDIR_DEATH);
//DoCastAOE(SPELL_SUPERCHARGE, true);
@@ -725,15 +730,13 @@ 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)
{
PreventDefaultAction();
- GetTarget()->CastSpell(GetTarget(), SPELL_RUNE_OF_SUMMONING_SUMMON, true, NULL, aurEff, GetTarget()->IsSummon() ? GetTarget()->ToTempSummon()->GetSummonerGUID() : ObjectGuid::Empty);
+ GetTarget()->CastSpell(GetTarget(), SPELL_RUNE_OF_SUMMONING_SUMMON, true, nullptr, aurEff, GetTarget()->IsSummon() ? GetTarget()->ToTempSummon()->GetSummonerGUID() : ObjectGuid::Empty);
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp
index 8fd85e1c130..b9983785a18 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"
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 d89a9d08fe5..dac2a8707d9 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp
@@ -23,23 +23,21 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
-#include "ScriptedEscortAI.h"
-#include "GameObjectAI.h"
-#include "Cell.h"
#include "CellImpl.h"
-#include "GridNotifiers.h"
-#include "GridNotifiersImpl.h"
#include "CombatAI.h"
+#include "GameObjectAI.h"
+#include "GridNotifiersImpl.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "PassiveAI.h"
-#include "ObjectMgr.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
{
@@ -1007,7 +1005,7 @@ public:
npc_escortAI::UpdateAI(diff);
if (!HasEscortState(STATE_ESCORT_ESCORTING))
- Start(false, true, ObjectGuid::Empty, NULL, false, true);
+ Start(false, true, ObjectGuid::Empty, nullptr, false, true);
else
{
if (infernoTimer <= diff)
@@ -1755,11 +1753,11 @@ class spell_vehicle_throw_passenger : public SpellScriptLoader
{
// use 99 because it is 3d search
std::list<WorldObject*> targetList;
- Trinity::WorldObjectSpellAreaTargetCheck check(99, GetExplTargetDest(), GetCaster(), GetCaster(), GetSpellInfo(), TARGET_CHECK_DEFAULT, NULL);
+ Trinity::WorldObjectSpellAreaTargetCheck check(99, GetExplTargetDest(), GetCaster(), GetCaster(), GetSpellInfo(), TARGET_CHECK_DEFAULT, nullptr);
Trinity::WorldObjectListSearcher<Trinity::WorldObjectSpellAreaTargetCheck> searcher(GetCaster(), targetList, check);
Cell::VisitAllObjects(GetCaster(), searcher, 99.0f);
float minDist = 99 * 99;
- Unit* target = NULL;
+ Unit* target = nullptr;
for (std::list<WorldObject*>::iterator itr = targetList.begin(); itr != targetList.end(); ++itr)
{
if (Unit* unit = (*itr)->ToUnit())
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp
index 61482ac9f83..b8846cace28 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp
@@ -16,12 +16,14 @@
*/
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptedCreature.h"
+#include "SpellAuras.h"
#include "SpellScript.h"
-#include "Cell.h"
-#include "CellImpl.h"
-#include "GridNotifiers.h"
-#include "GridNotifiersImpl.h"
+#include "TemporarySummon.h"
#include "ulduar.h"
enum FreyaYells
@@ -609,7 +611,7 @@ class boss_freya : public CreatureScript
/* 25N */ {62955, 62956, 62957, 62958}
};
- me->CastSpell((Unit*)NULL, summonSpell[me->GetMap()->GetDifficulty()][elderCount], true);
+ me->CastSpell((Unit*)nullptr, summonSpell[me->GetMap()->GetDifficulty()][elderCount], true);
Talk(SAY_DEATH);
@@ -839,7 +841,7 @@ class boss_elder_stonebark : public CreatureScript
if (me->HasAura(SPELL_PETRIFIED_BARK))
{
int32 reflect = damage;
- who->CastCustomSpell(who, SPELL_PETRIFIED_BARK_DMG, &reflect, NULL, NULL, true);
+ who->CastCustomSpell(who, SPELL_PETRIFIED_BARK_DMG, &reflect, nullptr, nullptr, true);
damage = 0;
}
}
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 00370d87516..cba47d66951 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,14 @@
*/
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "MotionMaster.h"
+#include "Player.h"
#include "ScriptedCreature.h"
-#include "SpellScript.h"
#include "SpellAuraEffects.h"
+#include "SpellScript.h"
#include "ulduar.h"
-#include "Player.h"
enum VezaxYells
{
@@ -275,7 +278,7 @@ class boss_general_vezax : public CreatureScript
/* Player Range Check
Purpose: If there are playersMin people within rangeMin, rangeMax: return a random players in that range.
- If not, return NULL and allow other target selection
+ If not, return nullptr and allow other target selection
*/
Unit* CheckPlayersInRange(uint8 playersMin, float rangeMin, float rangeMax)
{
@@ -294,11 +297,11 @@ class boss_general_vezax : public CreatureScript
}
if (PlayerList.empty())
- return NULL;
+ return nullptr;
size_t size = PlayerList.size();
if (size < playersMin)
- return NULL;
+ return nullptr;
return Trinity::Containers::SelectRandomContainerElement(PlayerList);
}
@@ -371,7 +374,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 +444,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 +459,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 +520,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*/)
@@ -530,8 +529,8 @@ class spell_general_vezax_saronite_vapors : public SpellScriptLoader
{
int32 mana = int32(aurEff->GetAmount() * std::pow(2.0f, GetStackAmount())); // mana restore - bp * 2^stackamount
int32 damage = mana * 2;
- caster->CastCustomSpell(GetTarget(), SPELL_SARONITE_VAPORS_ENERGIZE, &mana, NULL, NULL, true);
- caster->CastCustomSpell(GetTarget(), SPELL_SARONITE_VAPORS_DAMAGE, &damage, NULL, NULL, true);
+ caster->CastCustomSpell(GetTarget(), SPELL_SARONITE_VAPORS_ENERGIZE, &mana, nullptr, nullptr, true);
+ caster->CastCustomSpell(GetTarget(), SPELL_SARONITE_VAPORS_DAMAGE, &damage, nullptr, nullptr, true);
}
}
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp
index 59b9cc5bcb1..a7a90595ffe 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp
@@ -16,13 +16,14 @@
*/
#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 "MotionMaster.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
+#include "TemporarySummon.h"
#include "ulduar.h"
/* @todo Achievements
@@ -959,7 +960,7 @@ class npc_toasty_fire : public CreatureScript
DoCast(me, SPELL_SINGED, true);
}
- void SpellHit(Unit* /*who*/, const SpellInfo* spell) override
+ void SpellHit(Unit* /*who*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_BLOCK_OF_ICE || spell->Id == SPELL_ICE_SHARD || spell->Id == SPELL_ICE_SHARD_HIT)
{
@@ -1048,7 +1049,7 @@ public:
return;
int32 damage = int32(200 * std::pow(2.0f, GetStackAmount()));
- caster->CastCustomSpell(caster, SPELL_BITING_COLD_DAMAGE, &damage, NULL, NULL, true);
+ caster->CastCustomSpell(caster, SPELL_BITING_COLD_DAMAGE, &damage, nullptr, nullptr, true);
if (caster->isMoving())
caster->RemoveAuraFromStack(SPELL_BITING_COLD_TRIGGERED);
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp
index 7aa60e8af68..1fb7dda696a 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp
@@ -15,11 +15,13 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "GameTime.h"
#include "ScriptMgr.h"
+#include "GameTime.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"
@@ -252,7 +254,7 @@ class boss_ignis : public CreatureScript
if (Unit* slagPotTarget = ObjectAccessor::GetUnit(*me, _slagPotGUID))
{
slagPotTarget->ExitVehicle();
- slagPotTarget = NULL;
+ slagPotTarget = nullptr;
_slagPotGUID.Clear();
events.CancelEvent(EVENT_END_POT);
}
@@ -454,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 33e97e8baf6..57ace8ec195 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 "MotionMaster.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptedCreature.h"
-#include "SpellScript.h"
#include "SpellAuraEffects.h"
+#include "SpellScript.h"
#include "ulduar.h"
#include "Vehicle.h"
-#include "Player.h"
/* ScriptData
SDName: boss_kologarn
@@ -340,7 +344,7 @@ class spell_ulduar_rubble_summon : public SpellScriptLoader
ObjectGuid originalCaster = caster->GetInstanceScript() ? caster->GetInstanceScript()->GetGuidData(BOSS_KOLOGARN) : ObjectGuid::Empty;
uint32 spellId = GetEffectValue();
for (uint8 i = 0; i < 5; ++i)
- caster->CastSpell(caster, spellId, true, NULL, NULL, originalCaster);
+ caster->CastSpell(caster, spellId, true, nullptr, nullptr, originalCaster);
}
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 7929ab54eb6..9ed4f098ed6 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp
@@ -15,15 +15,17 @@
* 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 "GameObjectAI.h"
+#include "GridNotifiers.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
-#include "SpellScript.h"
#include "SpellAuraEffects.h"
-#include "GameObjectAI.h"
+#include "SpellScript.h"
+#include "TemporarySummon.h"
#include "ulduar.h"
#include "Vehicle.h"
@@ -493,7 +495,7 @@ class boss_mimiron : public CreatureScript
{
case EVENT_SUMMON_FLAMES:
if (Creature* worldtrigger = instance->GetCreature(DATA_MIMIRON_WORLD_TRIGGER))
- worldtrigger->CastCustomSpell(SPELL_SCRIPT_EFFECT_SUMMON_FLAMES_INITIAL, SPELLVALUE_MAX_TARGETS, 3, NULL, true, NULL, NULL, me->GetGUID());
+ worldtrigger->CastCustomSpell(SPELL_SCRIPT_EFFECT_SUMMON_FLAMES_INITIAL, SPELLVALUE_MAX_TARGETS, 3, nullptr, true, nullptr, nullptr, me->GetGUID());
events.RescheduleEvent(EVENT_SUMMON_FLAMES, 28000);
break;
case EVENT_INTRO_1:
@@ -645,10 +647,10 @@ class boss_mimiron : public CreatureScript
{
if (Creature* computer = instance->GetCreature(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:
@@ -1229,15 +1231,15 @@ class boss_aerial_command_unit : public CreatureScript
switch (eventId)
{
case EVENT_SUMMON_FIRE_BOTS:
- me->CastCustomSpell(SPELL_SUMMON_FIRE_BOT_TRIGGER, SPELLVALUE_MAX_TARGETS, 3, NULL, true);
+ me->CastCustomSpell(SPELL_SUMMON_FIRE_BOT_TRIGGER, SPELLVALUE_MAX_TARGETS, 3, nullptr, true);
events.RescheduleEvent(EVENT_SUMMON_FIRE_BOTS, 45000, 0, PHASE_AERIAL_COMMAND_UNIT);
break;
case EVENT_SUMMON_JUNK_BOT:
- me->CastCustomSpell(SPELL_SUMMON_JUNK_BOT_TRIGGER, SPELLVALUE_MAX_TARGETS, 1, NULL, true);
+ me->CastCustomSpell(SPELL_SUMMON_JUNK_BOT_TRIGGER, SPELLVALUE_MAX_TARGETS, 1, nullptr, true);
events.RescheduleEvent(EVENT_SUMMON_JUNK_BOT, urand(11000, 12000), 0, PHASE_AERIAL_COMMAND_UNIT);
break;
case EVENT_SUMMON_ASSAULT_BOT:
- me->CastCustomSpell(SPELL_SUMMON_ASSAULT_BOT_TRIGGER, SPELLVALUE_MAX_TARGETS, 1, NULL, true);
+ me->CastCustomSpell(SPELL_SUMMON_ASSAULT_BOT_TRIGGER, SPELLVALUE_MAX_TARGETS, 1, nullptr, true);
events.RescheduleEvent(EVENT_SUMMON_ASSAULT_BOT, 30000, 0, PHASE_AERIAL_COMMAND_UNIT);
break;
case EVENT_SUMMON_BOMB_BOT:
@@ -1787,9 +1789,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)
@@ -1878,9 +1878,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*/)
@@ -1933,9 +1931,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)
@@ -2011,9 +2007,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
@@ -2087,9 +2081,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*/)
@@ -2122,9 +2114,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)
@@ -2137,7 +2127,7 @@ class spell_mimiron_proximity_trigger : public SpellScriptLoader
void HandleDummy(SpellEffIndex /*effIndex*/)
{
- GetCaster()->CastSpell((Unit*)NULL, SPELL_PROXIMITY_MINE_EXPLOSION, true);
+ GetCaster()->CastSpell((Unit*)nullptr, SPELL_PROXIMITY_MINE_EXPLOSION, true);
}
void Register() override
@@ -2165,9 +2155,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*/)
@@ -2179,7 +2167,7 @@ class spell_mimiron_rapid_burst : public SpellScriptLoader
void HandleDummyTick(AuraEffect const* aurEff)
{
if (GetCaster())
- GetCaster()->CastSpell(GetTarget(), aurEff->GetTickNumber() % 2 == 0 ? SPELL_RAPID_BURST_RIGHT : SPELL_RAPID_BURST_LEFT, true, NULL, aurEff);
+ GetCaster()->CastSpell(GetTarget(), aurEff->GetTickNumber() % 2 == 0 ? SPELL_RAPID_BURST_RIGHT : SPELL_RAPID_BURST_LEFT, true, nullptr, aurEff);
}
void Register() override
@@ -2207,9 +2195,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)
@@ -2227,7 +2213,7 @@ class spell_mimiron_rocket_strike : public SpellScriptLoader
void HandleDummy(SpellEffIndex /*effIndex*/)
{
- GetHitUnit()->CastSpell((Unit*)NULL, SPELL_SCRIPT_EFFECT_ROCKET_STRIKE, true, NULL, NULL, GetCaster()->GetGUID());
+ GetHitUnit()->CastSpell((Unit*)nullptr, SPELL_SCRIPT_EFFECT_ROCKET_STRIKE, true, nullptr, nullptr, GetCaster()->GetGUID());
}
void Register() override
@@ -2255,9 +2241,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()
@@ -2276,7 +2260,7 @@ class spell_mimiron_rocket_strike_damage : public SpellScriptLoader
void HandleFriendlyFire(SpellEffIndex /*effIndex*/)
{
- GetHitUnit()->CastSpell((Unit*)NULL, SPELL_NOT_SO_FRIENDLY_FIRE, true);
+ GetHitUnit()->CastSpell((Unit*)nullptr, SPELL_NOT_SO_FRIENDLY_FIRE, true);
}
void Register() override
@@ -2305,9 +2289,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)
@@ -2329,7 +2311,7 @@ class spell_mimiron_rocket_strike_target_select : public SpellScriptLoader
void HandleScript(SpellEffIndex /*effIndex*/)
{
if (InstanceScript* instance = GetCaster()->GetInstanceScript())
- GetCaster()->CastSpell(GetHitUnit(), SPELL_SUMMON_ROCKET_STRIKE, true, NULL, NULL, instance->GetGuidData(DATA_VX_001));
+ GetCaster()->CastSpell(GetHitUnit(), SPELL_SUMMON_ROCKET_STRIKE, true, nullptr, nullptr, instance->GetGuidData(DATA_VX_001));
GetCaster()->SetDisplayId(11686);
}
@@ -2415,9 +2397,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*/)
@@ -2425,7 +2405,7 @@ class spell_mimiron_summon_assault_bot : public SpellScriptLoader
if (Unit* caster = GetCaster())
if (InstanceScript* instance = caster->GetInstanceScript())
if (instance->GetBossState(BOSS_MIMIRON) == IN_PROGRESS)
- caster->CastSpell(caster, SPELL_SUMMON_ASSAULT_BOT, false, NULL, aurEff, instance->GetGuidData(DATA_AERIAL_COMMAND_UNIT));
+ caster->CastSpell(caster, SPELL_SUMMON_ASSAULT_BOT, false, nullptr, aurEff, instance->GetGuidData(DATA_AERIAL_COMMAND_UNIT));
}
void Register() override
@@ -2452,9 +2432,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*/)
@@ -2486,10 +2464,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*/)
@@ -2497,7 +2472,7 @@ class spell_mimiron_summon_fire_bot : public SpellScriptLoader
if (Unit* caster = GetCaster())
if (InstanceScript* instance = caster->GetInstanceScript())
if (instance->GetBossState(BOSS_MIMIRON) == IN_PROGRESS)
- caster->CastSpell(caster, SPELL_SUMMON_FIRE_BOT, false, NULL, aurEff, instance->GetGuidData(DATA_AERIAL_COMMAND_UNIT));
+ caster->CastSpell(caster, SPELL_SUMMON_FIRE_BOT, false, nullptr, aurEff, instance->GetGuidData(DATA_AERIAL_COMMAND_UNIT));
}
void Register() override
@@ -2524,9 +2499,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*/)
@@ -2595,9 +2568,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*/)
@@ -2632,9 +2603,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)
@@ -2683,9 +2652,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*/)
@@ -2693,7 +2660,7 @@ class spell_mimiron_summon_junk_bot : public SpellScriptLoader
if (Unit* caster = GetCaster())
if (InstanceScript* instance = caster->GetInstanceScript())
if (instance->GetBossState(BOSS_MIMIRON) == IN_PROGRESS)
- caster->CastSpell(caster, SPELL_SUMMON_JUNK_BOT, false, NULL, aurEff, instance->GetGuidData(DATA_AERIAL_COMMAND_UNIT));
+ caster->CastSpell(caster, SPELL_SUMMON_JUNK_BOT, false, nullptr, aurEff, instance->GetGuidData(DATA_AERIAL_COMMAND_UNIT));
}
void Register() override
@@ -2720,9 +2687,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 1ab33be99ba..d571bd541df 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp
@@ -18,13 +18,19 @@
/// @todo Harpoon chain from 62505 should not get removed when other chain is applied
#include "ScriptMgr.h"
+#include "GameObject.h"
+#include "GameObjectAI.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
-#include "GameObjectAI.h"
+#include "SpellInfo.h"
#include "SpellScript.h"
+#include "TemporarySummon.h"
#include "ulduar.h"
-#include "SpellInfo.h"
-#include "Player.h"
enum Says
{
@@ -250,7 +256,7 @@ class boss_razorscale_controller : public CreatureScript
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;
}
}
@@ -265,7 +271,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();
@@ -275,7 +281,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();
@@ -284,7 +290,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();
@@ -294,7 +300,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();
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp
index 0dc4e553ad7..cfa977166ad 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp
@@ -15,16 +15,22 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "ScriptMgr.h"
+#include "AreaBoundary.h"
+#include "CellImpl.h"
+#include "GridNotifiersImpl.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
#include "MoveSplineInit.h"
+#include "ObjectAccessor.h"
#include "Player.h"
-#include "ScriptMgr.h"
#include "ScriptedCreature.h"
-#include "SpellScript.h"
#include "SpellAuraEffects.h"
+#include "SpellMgr.h"
+#include "SpellScript.h"
#include "TypeContainerVisitor.h"
-#include "CellImpl.h"
-#include "GridNotifiersImpl.h"
#include "ulduar.h"
+#include <G3D/Vector3.h>
enum Spells
{
@@ -317,8 +323,7 @@ enum DisplayIds
THORIM_WEAPON_DISPLAY_ID = 45900
};
-uint32 const LightningOrbPathSize = 8;
-G3D::Vector3 const LightningOrbPath[LightningOrbPathSize] =
+Position const LightningOrbPath[] =
{
{ 2134.889893f, -298.632996f, 438.247467f },
{ 2134.570068f, -440.317993f, 438.247467f },
@@ -329,6 +334,7 @@ G3D::Vector3 const LightningOrbPath[LightningOrbPathSize] =
{ 2202.208008f, -262.939270f, 412.168976f },
{ 2182.310059f, -263.233093f, 414.739410f }
};
+std::size_t const LightningOrbPathSize = std::extent<decltype(LightningOrbPath)>::value;
// used for trash jump calculation
Position const ArenaCenter = { 2134.77f, -262.307f };
@@ -352,7 +358,7 @@ class HeightPositionCheck
bool operator()(Position const* pos) const
{
- return pos->GetPositionZ() > THORIM_BALCONY_Z_CHECK == _ret;
+ return (pos->GetPositionZ() > THORIM_BALCONY_Z_CHECK) == _ret;
}
private:
@@ -647,7 +653,12 @@ class boss_thorim : public CreatureScript
summon->GetMotionMaster()->MovePoint(EVENT_CHARGE_PREPATH, LightningOrbPath[LightningOrbPathSize - 1], false);
- Movement::PointsArray path(LightningOrbPath, LightningOrbPath + LightningOrbPathSize);
+ Movement::PointsArray path;
+ path.reserve(LightningOrbPathSize);
+ std::transform(std::begin(LightningOrbPath), std::end(LightningOrbPath), std::back_inserter(path), [](Position const& pos)
+ {
+ return G3D::Vector3(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ());
+ });
Movement::MoveSplineInit init(summon);
init.MovebyPath(path);
@@ -1749,9 +1760,7 @@ class spell_thorim_charge_orb : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_LIGHTNING_PILLAR_1))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_LIGHTNING_PILLAR_1 });
}
void FilterTargets(std::list<WorldObject*>& targets)
@@ -1797,9 +1806,7 @@ class spell_thorim_lightning_charge : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_LIGHTNING_CHARGE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_LIGHTNING_CHARGE });
}
void HandleFocus()
@@ -1880,10 +1887,7 @@ class spell_thorim_stormhammer : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_STORMHAMMER_BOOMERANG)
- || !sSpellMgr->GetSpellInfo(SPELL_DEAFENING_THUNDER))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_STORMHAMMER_BOOMERANG, SPELL_DEAFENING_THUNDER });
}
void FilterTargets(std::list<WorldObject*>& targets)
@@ -1941,10 +1945,7 @@ class spell_thorim_stormhammer_sif : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_STORMHAMMER_BOOMERANG)
- || !sSpellMgr->GetSpellInfo(SPELL_SIF_TRANSFORM))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_STORMHAMMER_BOOMERANG, SPELL_SIF_TRANSFORM });
}
void HandleScript(SpellEffIndex /*effIndex*/)
@@ -2014,9 +2015,7 @@ class spell_thorim_runic_smash : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_RUNIC_SMASH))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_RUNIC_SMASH });
}
void HandleScript(SpellEffIndex effIndex)
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp
index 863740fa70f..2fce8d7a5be 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp
@@ -22,15 +22,18 @@
*/
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
+#include "Opcodes.h"
+#include "PassiveAI.h"
+#include "Player.h"
#include "ScriptedCreature.h"
-#include "SpellScript.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
{
@@ -736,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
@@ -807,7 +810,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_xt_void_zoneAI(creature);
+ return GetUlduarAI<npc_xt_void_zoneAI>(creature);
}
};
@@ -823,9 +826,7 @@ 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*/)
@@ -859,9 +860,7 @@ 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*/)
@@ -943,19 +942,7 @@ 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*/)
@@ -1074,9 +1061,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 a47362b1082..66970ee996f 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 "MotionMaster.h"
+#include "MoveSplineInit.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 "SpellScript.h"
+#include "TemporarySummon.h"
#include "ulduar.h"
enum Yells
@@ -550,7 +558,7 @@ class boss_voice_of_yogg_saron : public CreatureScript
if (Creature* yogg = instance->GetCreature(BOSS_YOGG_SARON))
{
yogg->AI()->Talk(EMOTE_YOGG_SARON_EXTINGUISH_ALL_LIFE, me);
- yogg->CastSpell((Unit*)NULL, SPELL_EXTINGUISH_ALL_LIFE, true);
+ yogg->CastSpell((Unit*)nullptr, SPELL_EXTINGUISH_ALL_LIFE, true);
}
events.ScheduleEvent(EVENT_EXTINGUISH_ALL_LIFE, 10000); // cast it again after a short while, players can survive
break;
@@ -1093,7 +1101,7 @@ class boss_brain_of_yogg_saron : public CreatureScript
uint8 illusion = _instance->GetData(DATA_ILLUSION);
if (++_tentaclesKilled >= (illusion == ICECROWN_ILLUSION ? 9 : 8))
{
- sCreatureTextMgr->SendChat(me, EMOTE_BRAIN_ILLUSION_SHATTERED, NULL, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_AREA);
+ sCreatureTextMgr->SendChat(me, EMOTE_BRAIN_ILLUSION_SHATTERED, nullptr, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_AREA);
_summons.DespawnAll();
DoCastAOE(SPELL_SHATTERED_ILLUSION, true);
_instance->HandleGameObject(_instance->GetGuidData(GO_BRAIN_ROOM_DOOR_1 + illusion), true);
@@ -2061,9 +2069,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*/)
@@ -2133,11 +2139,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*/)
@@ -2231,9 +2233,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*/)
@@ -2332,15 +2332,13 @@ 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*/)
{
if (Unit* target = GetHitUnit())
- target->CastSpell((Unit*)NULL, SPELL_EMPOWERING_SHADOWS, true);
+ target->CastSpell((Unit*)nullptr, SPELL_EMPOWERING_SHADOWS, true);
}
void Register() override
@@ -2367,9 +2365,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*/)
@@ -2400,9 +2396,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*/)
@@ -2495,11 +2489,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*/)
@@ -2600,11 +2590,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*/)
@@ -2612,7 +2598,7 @@ class spell_yogg_saron_death_ray_warning_visual : public SpellScriptLoader /
if (Unit* caster = GetCaster())
{
caster->CastSpell(caster, SPELL_DEATH_RAY_PERIODIC, true);
- caster->CastSpell((Unit*)NULL, SPELL_DEATH_RAY_DAMAGE_VISUAL, true);
+ caster->CastSpell((Unit*)nullptr, SPELL_DEATH_RAY_DAMAGE_VISUAL, true);
// TODO: set better movement
caster->GetMotionMaster()->MoveConfused();
}
@@ -2641,9 +2627,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*/)
@@ -2704,11 +2688,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*/)
@@ -2744,9 +2724,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)
@@ -2783,11 +2761,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*/)
@@ -2802,7 +2776,7 @@ class spell_yogg_saron_induce_madness : public SpellScriptLoader // 64059
void ClearShatteredIllusion()
{
- GetCaster()->CastSpell((Unit*)NULL, SPELL_SHATTERED_ILLUSION_REMOVE);
+ GetCaster()->CastSpell((Unit*)nullptr, SPELL_SHATTERED_ILLUSION_REMOVE);
if (InstanceScript* instance = GetCaster()->GetInstanceScript())
if (Creature* voice = instance->GetCreature(DATA_VOICE_OF_YOGG_SARON))
@@ -2850,11 +2824,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 });
}
void DummyTick(AuraEffect const* /*aurEff*/)
@@ -2909,9 +2879,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*/)
@@ -3151,9 +3119,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/instance_ulduar.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp
index d662578b9d5..e023be23cd4 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp
@@ -15,14 +15,20 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "ScriptMgr.h"
+#include "AreaBoundary.h"
+#include "CreatureAI.h"
+#include "GameObject.h"
#include "InstanceScript.h"
-#include "Vehicle.h"
+#include "Item.h"
+#include "Map.h"
#include "Player.h"
-#include "ScriptedCreature.h"
-#include "ScriptMgr.h"
+#include "Spell.h"
#include "SpellScript.h"
-#include "WorldPacket.h"
+#include "TemporarySummon.h"
#include "ulduar.h"
+#include "Vehicle.h"
+#include "WorldPacket.h"
static BossBoundaryData const boundaries =
{
@@ -885,7 +891,7 @@ class instance_ulduar : public InstanceMapScript
return 0;
}
- bool CheckAchievementCriteriaMeet(uint32 criteriaId, Player const*, Unit const* /* = NULL */, uint32 /* = 0 */) override
+ bool CheckAchievementCriteriaMeet(uint32 criteriaId, Player const*, Unit const* /* = nullptr */, uint32 /* = 0 */) override
{
switch (criteriaId)
{
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h
index 15964534640..4548eac4b97 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h
@@ -18,6 +18,8 @@
#ifndef DEF_ULDUAR_H
#define DEF_ULDUAR_H
+#include "CreatureAIImpl.h"
+
#define UlduarScriptName "instance_ulduar"
#define DataHeader "UU"
@@ -490,8 +492,8 @@ enum YoggSaronIllusions
STORMWIND_ILLUSION = 2,
};
-template<class AI, class T>
-AI* GetUlduarAI(T* obj)
+template <class AI, class T>
+inline AI* GetUlduarAI(T* obj)
{
return GetInstanceAI<AI, T>(obj, UlduarScriptName);
}
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 7eb24fb5dd4..6300fa0e9c1 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
@@ -23,9 +23,12 @@ SDCategory: Utgarde Keep
EndScriptData */
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
+#include "Spell.h"
#include "SpellScript.h"
-#include "SpellAuraEffects.h"
#include "utgarde_keep.h"
enum Yells
@@ -406,7 +409,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);
}
};
@@ -449,9 +452,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)
@@ -466,7 +467,7 @@ class spell_ingvar_woe_strike : public SpellScriptLoader
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
- GetTarget()->CastSpell(eventInfo.GetActor(), SPELL_WOE_STRIKE_EFFECT, true, NULL, aurEff);
+ GetTarget()->CastSpell(eventInfo.GetActor(), SPELL_WOE_STRIKE_EFFECT, true, nullptr, aurEff);
}
void Register() override
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp
index 6c798de3db6..b10a6a97e04 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp
@@ -23,9 +23,12 @@ SDCategory: Utgarde Keep
EndScriptData */
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "MotionMaster.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 27da9c2e8bf..3834f5d7f15 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..90269688eca 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[] =
@@ -85,6 +88,8 @@ class instance_utgarde_keep : public InstanceMapScript
void OnGameObjectCreate(GameObject* go) override
{
+ InstanceScript::OnGameObjectCreate(go);
+
switch (go->GetEntry())
{
case GO_BELLOW_1:
@@ -123,23 +128,6 @@ class instance_utgarde_keep : public InstanceMapScript
Forges[2].AnvilGUID = go->GetGUID();
HandleGameObject(ObjectGuid::Empty, Forges[2].Event != NOT_STARTED, go);
break;
- case GO_GIANT_PORTCULLIS_1:
- case GO_GIANT_PORTCULLIS_2:
- AddDoor(go, true);
- break;
- default:
- break;
- }
- }
-
- void OnGameObjectRemove(GameObject* go) override
- {
- switch (go->GetEntry())
- {
- case GO_GIANT_PORTCULLIS_1:
- case GO_GIANT_PORTCULLIS_2:
- AddDoor(go, false);
- break;
default:
break;
}
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp
index be70f79f2dc..2fa0fc38932 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp
@@ -16,10 +16,13 @@
*/
#include "ScriptMgr.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "MotionMaster.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 +133,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 +170,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 +207,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 +339,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..ac8304f9fd5 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,10 +87,10 @@ struct ForgeInfo
uint32 Event;
};
-template<class AI>
-AI* GetUtgardeKeepAI(Creature* creature)
+template <class AI, class T>
+inline AI* GetUtgardeKeepAI(T* obj)
{
- return GetInstanceAI<AI>(creature, UKScriptName);
+ return GetInstanceAI<AI>(obj, UKScriptName);
}
#endif // UTGARDE_KEEP_H_
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp
index f4eec389275..60426fe448f 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp
@@ -16,11 +16,15 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "InstanceScript.h"
+#include "GameObject.h"
#include "GameObjectAI.h"
-#include "utgarde_pinnacle.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
#include "SpellScript.h"
-#include "SpellAuraEffects.h"
+#include "TemporarySummon.h"
+#include "utgarde_pinnacle.h"
enum Spells
{
@@ -620,9 +624,7 @@ class spell_palehoof_crazed_effect : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_CRAZED_TAUNT))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_CRAZED_TAUNT });
}
void HandleScriptEffect(SpellEffIndex /* effIndex */)
@@ -654,9 +656,7 @@ class spell_palehoof_awaken_subboss : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_ORB_CHANNEL))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_ORB_CHANNEL });
}
void HandleScript(SpellEffIndex /*effIndex*/)
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp
index 1e2da34120e..4ba41149c45 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 "MotionMaster.h"
+#include "MoveSplineInit.h"
+#include "Player.h"
#include "ScriptedCreature.h"
#include "SpellAuras.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);
}
};
@@ -436,7 +439,7 @@ public:
}
}
- void SpellHit(Unit* /*caster*/, const SpellInfo* spell) override
+ void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_LAUNCH_HARPOON)
if (Creature* skadi = _instance->GetCreature(DATA_SKADI_THE_RUTHLESS))
@@ -455,7 +458,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_graufAI>(creature);
+ return GetUtgardePinnacleAI<npc_graufAI>(creature);
}
};
@@ -551,7 +554,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_ymirjar_warriorAI>(creature);
+ return GetUtgardePinnacleAI<npc_ymirjar_warriorAI>(creature);
}
};
@@ -582,7 +585,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_ymirjar_witch_doctorAI>(creature);
+ return GetUtgardePinnacleAI<npc_ymirjar_witch_doctorAI>(creature);
}
};
@@ -619,7 +622,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_ymirjar_harpoonerAI>(creature);
+ return GetUtgardePinnacleAI<npc_ymirjar_harpoonerAI>(creature);
}
};
@@ -634,9 +637,7 @@ class spell_freezing_cloud_area_right : public SpellScriptLoader
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)
@@ -673,9 +674,7 @@ class spell_freezing_cloud_area_left : public SpellScriptLoader
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)
@@ -821,9 +820,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 7eff09338fc..a9337ffcb15 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp
@@ -16,9 +16,14 @@
*/
#include "ScriptMgr.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "MotionMaster.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 a55ddfa6bdd..83b25986222 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 "MotionMaster.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 2afe31455ce..c5e6ea0f80b 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,10 @@
*/
#include "ScriptMgr.h"
+#include "AreaBoundary.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 f4d217c74f3..30fbc460190 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"
@@ -95,8 +97,8 @@ enum UPGameObjectIds
GO_KING_YMIRON_DOOR = 192174
};
-template<class AI, class T>
-AI* GetUtgardePinnacleAI(T* obj)
+template <class AI, class T>
+inline AI* GetUtgardePinnacleAI(T* obj)
{
return GetInstanceAI<AI>(obj, UPScriptName);
}
diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_archavon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_archavon.cpp
index 71ee6285074..03ee2289818 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*/)
@@ -242,12 +243,12 @@ class spell_archavon_rock_shards : public SpellScriptLoader
for (uint8 i = 0; i < 3; ++i)
{
- caster->CastSpell((Unit*)NULL, SPELL_ROCK_SHARDS_VISUAL_L, true);
- caster->CastSpell((Unit*)NULL, SPELL_ROCK_SHARDS_VISUAL_R, true);
+ caster->CastSpell((Unit*)nullptr, SPELL_ROCK_SHARDS_VISUAL_L, true);
+ caster->CastSpell((Unit*)nullptr, SPELL_ROCK_SHARDS_VISUAL_R, true);
}
- caster->CastSpell((Unit*)NULL, SPELL_ROCK_SHARDS_DAMAGE_L, true);
- caster->CastSpell((Unit*)NULL, SPELL_ROCK_SHARDS_DAMAGE_R, true);
+ caster->CastSpell((Unit*)nullptr, SPELL_ROCK_SHARDS_DAMAGE_L, true);
+ caster->CastSpell((Unit*)nullptr, SPELL_ROCK_SHARDS_DAMAGE_R, true);
}
void Register() override
diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp
index 20a86e2c8f7..aa7bd9db9ab 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"
@@ -92,7 +94,7 @@ class boss_emalon : public CreatureScript
{
BossAI::JustSummoned(summoned);
- // AttackStart has NULL-check for victim
+ // AttackStart has nullptr-check for victim
if (summoned->AI())
summoned->AI()->AttackStart(me->GetVictim());
}
@@ -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..93faab4b854 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,15 +195,13 @@ 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)
{
PreventDefaultAction();
- GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_METEOR_FISTS_DAMAGE, true, NULL, aurEff);
+ GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_METEOR_FISTS_DAMAGE, true, nullptr, aurEff);
}
void Register() override
@@ -273,15 +270,13 @@ 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)
{
PreventDefaultAction();
- GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_FW_METEOR_FISTS_DAMAGE, true, NULL, aurEff);
+ GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_FW_METEOR_FISTS_DAMAGE, true, nullptr, aurEff);
}
void Register() override
diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp
index 5747d20160d..0f785817e9b 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..f399449932f 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
{
@@ -84,13 +86,13 @@ class instance_vault_of_archavon : public InstanceMapScript
switch (type)
{
case DATA_ARCHAVON:
- ArchavonDeath = time(NULL);
+ ArchavonDeath = time(nullptr);
break;
case DATA_EMALON:
- EmalonDeath = time(NULL);
+ EmalonDeath = time(nullptr);
break;
case DATA_KORALON:
- KoralonDeath = time(NULL);
+ KoralonDeath = time(nullptr);
break;
default:
return true;
diff --git a/src/server/scripts/Northrend/VaultOfArchavon/vault_of_archavon.h b/src/server/scripts/Northrend/VaultOfArchavon/vault_of_archavon.h
index 3af77979c68..d4f252d3715 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 <class AI, class T>
+inline AI* GetVaultOfArchavonAI(T* obj)
+{
+ return GetInstanceAI<AI>(obj, 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 1bc7223f08e..1346363a920 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp
@@ -16,6 +16,9 @@
*/
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "MotionMaster.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 3ce72ebd74f..12efea5646a 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 "MotionMaster.h"
#include "ScriptedCreature.h"
-#include "SpellAuraEffects.h"
+#include "SpellAuras.h"
#include "SpellScript.h"
#include "violet_hold.h"
@@ -351,9 +353,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*/)
@@ -426,14 +426,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..4434b49a20c 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"
diff --git a/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp b/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp
index cc1e96f78b2..8f8f875b530 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp
@@ -16,9 +16,10 @@
*/
#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "ScriptedCreature.h"
-#include "SpellScript.h"
#include "SpellAuraEffects.h"
+#include "SpellScript.h"
#include "violet_hold.h"
enum Spells
diff --git a/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp b/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp
index 367ab44b466..b55f9bfb91d 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp
@@ -16,10 +16,12 @@
*/
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
+#include "Player.h"
#include "ScriptedCreature.h"
#include "SpellInfo.h"
#include "SpellScript.h"
-#include "Player.h"
#include "violet_hold.h"
/*
@@ -261,9 +263,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 a956c11c11b..cf5d256f3a6 100644
--- a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp
+++ b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp
@@ -16,11 +16,15 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "GameObject.h"
#include "InstanceScript.h"
-#include "WorldPacket.h"
-#include "violet_hold.h"
+#include "Map.h"
+#include "MotionMaster.h"
#include "Player.h"
+#include "ScriptedCreature.h"
+#include "TemporarySummon.h"
+#include "violet_hold.h"
+#include "WorldPacket.h"
/*
* TODO:
@@ -65,7 +69,7 @@ Position const PortalIntroPositions[PortalIntroPositionsSize] = // sniff
uint32 const EncouterPortalsCount = PortalPositionsSize + PortalElitePositionsSize;
uint32 const MoraggPathSize = 3;
-G3D::Vector3 const MoraggPath[MoraggPathSize] = // sniff
+Position const MoraggPath[MoraggPathSize] = // sniff
{
{ 1893.895f, 728.1261f, 47.75016f },
{ 1892.997f, 738.4987f, 47.66684f },
@@ -73,7 +77,7 @@ G3D::Vector3 const MoraggPath[MoraggPathSize] = // sniff
};
uint32 const ErekemPathSize = 3;
-G3D::Vector3 const ErekemPath[ErekemPathSize] = // sniff
+Position const ErekemPath[ErekemPathSize] = // sniff
{
{ 1871.456f, 871.0361f, 43.41524f },
{ 1874.948f, 859.5452f, 43.33349f },
@@ -81,7 +85,7 @@ G3D::Vector3 const ErekemPath[ErekemPathSize] = // sniff
};
uint32 const ErekemGuardLeftPathSize = 3;
-G3D::Vector3 const ErekemGuardLeftPath[ErekemGuardLeftPathSize] = // sniff
+Position const ErekemGuardLeftPath[ErekemGuardLeftPathSize] = // sniff
{
{ 1853.752f, 862.4528f, 43.41614f },
{ 1866.931f, 854.577f, 43.3335f },
@@ -89,7 +93,7 @@ G3D::Vector3 const ErekemGuardLeftPath[ErekemGuardLeftPathSize] = // sniff
};
uint32 const ErekemGuardRightPathSize = 3;
-G3D::Vector3 const ErekemGuardRightPath[ErekemGuardRightPathSize] = // sniff
+Position const ErekemGuardRightPath[ErekemGuardRightPathSize] = // sniff
{
{ 1892.418f, 872.2831f, 43.41563f },
{ 1885.639f, 859.0245f, 43.3335f },
@@ -97,7 +101,7 @@ G3D::Vector3 const ErekemGuardRightPath[ErekemGuardRightPathSize] = // sniff
};
uint32 const IchoronPathSize = 5;
-G3D::Vector3 const IchoronPath[IchoronPathSize] = // sniff
+Position const IchoronPath[IchoronPathSize] = // sniff
{
{ 1942.041f, 749.5228f, 30.95229f },
{ 1930.571f, 762.9065f, 31.98814f },
@@ -107,7 +111,7 @@ G3D::Vector3 const IchoronPath[IchoronPathSize] = // sniff
};
uint32 const LavanthorPathSize = 3;
-G3D::Vector3 const LavanthorPath[LavanthorPathSize] = // sniff
+Position const LavanthorPath[LavanthorPathSize] = // sniff
{
{ 1844.557f, 748.7083f, 38.74205f },
{ 1854.618f, 761.5295f, 38.65631f },
@@ -115,7 +119,7 @@ G3D::Vector3 const LavanthorPath[LavanthorPathSize] = // sniff
};
uint32 const XevozzPathSize = 3;
-G3D::Vector3 const XevozzPath[XevozzPathSize] = // sniff
+Position const XevozzPath[XevozzPathSize] = // sniff
{
{ 1908.417f, 845.8502f, 38.71947f },
{ 1905.557f, 841.3157f, 38.65529f },
@@ -123,7 +127,7 @@ G3D::Vector3 const XevozzPath[XevozzPathSize] = // sniff
};
uint32 const ZuramatPathSize = 3;
-G3D::Vector3 const ZuramatPath[ZuramatPathSize] = // sniff
+Position const ZuramatPath[ZuramatPathSize] = // sniff
{
{ 1934.151f, 860.9463f, 47.29499f },
{ 1927.085f, 852.1342f, 47.19214f },
@@ -330,11 +334,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 4aa2a1aabb5..7f8d987ef31 100644
--- a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp
+++ b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp
@@ -15,14 +15,18 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "Player.h"
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "GameObject.h"
#include "GameObjectAI.h"
-#include "ScriptedGossip.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "MotionMaster.h"
+#include "Player.h"
#include "ScriptedEscortAI.h"
+#include "ScriptedGossip.h"
#include "SpellAuraEffects.h"
#include "SpellScript.h"
+#include "TemporarySummon.h"
#include "violet_hold.h"
/*
@@ -156,7 +160,7 @@ enum Sinclari
SAY_SINCLARI_PORTAL_KEEPER = 2
};
-G3D::Vector3 const FirstPortalWPs[6] =
+Position const FirstPortalWPs[] =
{
{1877.670288f, 842.280273f, 43.333591f},
{1877.338867f, 834.615356f, 38.762287f},
@@ -167,7 +171,7 @@ G3D::Vector3 const FirstPortalWPs[6] =
//{1825.736084f, 807.305847f, 44.363785f}
};
-G3D::Vector3 const SecondPortalFirstWPs[9] =
+Position const SecondPortalFirstWPs[] =
{
{1902.561401f, 853.334656f, 47.106117f},
{1895.486084f, 855.376404f, 44.334591f},
@@ -181,7 +185,7 @@ G3D::Vector3 const SecondPortalFirstWPs[9] =
//{1825.736084f, 807.305847f, 44.363785f}
};
-G3D::Vector3 const SecondPortalSecondWPs[8] =
+Position const SecondPortalSecondWPs[] =
{
{1929.392212f, 837.614990f, 47.136166f},
{1928.290649f, 824.750427f, 45.474411f},
@@ -194,7 +198,7 @@ G3D::Vector3 const SecondPortalSecondWPs[8] =
//{1825.736084f, 807.305847f, 44.363785f}
};
-G3D::Vector3 const ThirdPortalWPs[8] =
+Position const ThirdPortalWPs[] =
{
{1934.049438f, 815.778503f, 52.408699f},
{1928.290649f, 824.750427f, 45.474411f},
@@ -207,7 +211,7 @@ G3D::Vector3 const ThirdPortalWPs[8] =
//{1825.736084f, 807.305847f, 44.363785f}
};
-G3D::Vector3 const FourthPortalWPs[9] =
+Position const FourthPortalWPs[] =
{
{1921.658447f, 761.657043f, 50.866741f},
{1910.559814f, 755.780457f, 47.701447f},
@@ -221,7 +225,7 @@ G3D::Vector3 const FourthPortalWPs[9] =
//{1827.100342f, 801.605957f, 44.363358f}
};
-G3D::Vector3 const FifthPortalWPs[6] =
+Position const FifthPortalWPs[] =
{
{1887.398804f, 763.633240f, 47.666851f},
{1879.020386f, 775.396973f, 38.705990f},
@@ -232,7 +236,7 @@ G3D::Vector3 const FifthPortalWPs[6] =
//{1827.100342f, 801.605957f, 44.363358f}
};
-G3D::Vector3 const SixthPoralWPs[4] =
+Position const SixthPortalWPs[] =
{
{1888.861084f, 805.074768f, 38.375790f},
{1869.793823f, 804.135804f, 38.647018f},
@@ -241,13 +245,12 @@ G3D::Vector3 const SixthPoralWPs[4] =
//{1826.889648f, 803.929993f, 44.363239f}
};
-G3D::Vector3 const DefaultPortalWPs[1] =
+Position const DefaultPortalWPs[] =
{
{ 1843.567017f, 804.288208f, 44.139091f }
};
-uint32 const SaboteurMoraggPathSize = 5;
-G3D::Vector3 const SaboteurMoraggPath[SaboteurMoraggPathSize] = // sniff
+Position const SaboteurMoraggPath[] = // sniff
{
{ 1886.251f, 803.0743f, 38.42326f },
{ 1885.71f, 799.8929f, 38.37241f },
@@ -256,8 +259,7 @@ G3D::Vector3 const SaboteurMoraggPath[SaboteurMoraggPathSize] = // sniff
{ 1894.603f, 739.9231f, 47.66684f },
};
-uint32 const SaboteurErekemPathSize = 5;
-G3D::Vector3 const SaboteurErekemPath[SaboteurErekemPathSize] = // sniff
+Position const SaboteurErekemPath[] = // sniff
{
{ 1886.251f, 803.0743f, 38.42326f },
{ 1881.047f, 829.6866f, 38.64856f },
@@ -266,24 +268,21 @@ G3D::Vector3 const SaboteurErekemPath[SaboteurErekemPathSize] = // sniff
{ 1873.747f, 864.1373f, 43.33349f }
};
-uint32 const SaboteurIchoronPathSize = 3;
-G3D::Vector3 const SaboteurIchoronPath[SaboteurIchoronPathSize] = // sniff
+Position const SaboteurIchoronPath[] = // sniff
{
{ 1886.251f, 803.0743f, 38.42326f },
{ 1888.672f, 801.2348f, 38.42305f },
{ 1901.987f, 793.3254f, 38.65126f }
};
-uint32 const SaboteurLavanthorPathSize = 3;
-G3D::Vector3 const SaboteurLavanthorPath[SaboteurLavanthorPathSize] = // sniff
+Position const SaboteurLavanthorPath[] = // sniff
{
{ 1886.251f, 803.0743f, 38.42326f },
{ 1867.925f, 778.8035f, 38.64702f },
{ 1853.304f, 759.0161f, 38.65761f }
};
-uint32 const SaboteurXevozzPathSize = 4;
-G3D::Vector3 const SaboteurXevozzPath[SaboteurXevozzPathSize] = // sniff
+Position const SaboteurXevozzPath[] = // sniff
{
{ 1886.251f, 803.0743f, 38.42326f },
{ 1889.096f, 810.0487f, 38.43871f },
@@ -291,8 +290,7 @@ G3D::Vector3 const SaboteurXevozzPath[SaboteurXevozzPathSize] = // sniff
{ 1906.666f, 842.3111f, 38.63351f }
};
-uint32 const SaboteurZuramatPathSize = 7;
-G3D::Vector3 const SaboteurZuramatPath[SaboteurZuramatPathSize] = // sniff
+Position const SaboteurZuramatPath[] = // sniff
{
{ 1886.251f, 803.0743f, 38.42326f },
{ 1889.69f, 807.0032f, 38.39914f },
@@ -543,41 +541,35 @@ class npc_azure_saboteur : public CreatureScript
_bossId = _instance->GetData(DATA_2ND_BOSS);
}
- void StartMovement()
+ template <size_t N>
+ void StartSmoothPath(Position const (&path)[N])
{
- uint32 pathSize = 0;
- G3D::Vector3 const* path = nullptr;
+ me->GetMotionMaster()->MoveSmoothPath(POINT_INTRO, &path[0], N, false);
+ }
+ void StartMovement()
+ {
switch (_bossId)
{
case DATA_MORAGG:
- pathSize = SaboteurMoraggPathSize;
- path = SaboteurMoraggPath;
+ StartSmoothPath(SaboteurMoraggPath);
break;
case DATA_EREKEM:
- pathSize = SaboteurErekemPathSize;
- path = SaboteurErekemPath;
+ StartSmoothPath(SaboteurErekemPath);
break;
case DATA_ICHORON:
- pathSize = SaboteurIchoronPathSize;
- path = SaboteurIchoronPath;
+ StartSmoothPath(SaboteurIchoronPath);
break;
case DATA_LAVANTHOR:
- pathSize = SaboteurLavanthorPathSize;
- path = SaboteurLavanthorPath;
+ StartSmoothPath(SaboteurLavanthorPath);
break;
case DATA_XEVOZZ:
- pathSize = SaboteurXevozzPathSize;
- path = SaboteurXevozzPath;
+ StartSmoothPath(SaboteurXevozzPath);
break;
case DATA_ZURAMAT:
- pathSize = SaboteurZuramatPathSize;
- path = SaboteurZuramatPath;
+ StartSmoothPath(SaboteurZuramatPath);
break;
}
-
- if (path)
- me->GetMotionMaster()->MoveSmoothPath(POINT_INTRO, path, pathSize, false);
}
void Reset() override
@@ -849,58 +841,57 @@ struct violet_hold_trashAI : public npc_escortAI
_scheduler.CancelAll();
}
+ template <size_t N>
+ Position const* GetPathAndInitLastWaypointFrom(Position const (&path)[N])
+ {
+ _lastWaypointId = N - 1;
+ return &path[0];
+ }
+
void SetData(uint32 type, uint32 data) override
{
if (type == DATA_PORTAL_LOCATION)
{
- G3D::Vector3 const* path = nullptr;
+ Position const* path = nullptr;
switch (data)
{
case 0:
- _lastWaypointId = 5;
- path = FirstPortalWPs;
+ path = GetPathAndInitLastWaypointFrom(FirstPortalWPs);
break;
case 7:
switch (urand(0, 1))
{
case 0:
- _lastWaypointId = 8;
- path = SecondPortalFirstWPs;
+ path = GetPathAndInitLastWaypointFrom(SecondPortalFirstWPs);
break;
case 1:
- _lastWaypointId = 7;
- path = SecondPortalSecondWPs;
+ path = GetPathAndInitLastWaypointFrom(SecondPortalSecondWPs);
break;
}
break;
case 2:
- _lastWaypointId = 7;
- path = ThirdPortalWPs;
+ path = GetPathAndInitLastWaypointFrom(ThirdPortalWPs);
break;
case 6:
- _lastWaypointId = 8;
- path = FourthPortalWPs;
+ path = GetPathAndInitLastWaypointFrom(FourthPortalWPs);
break;
case 1:
- _lastWaypointId = 5;
- path = FifthPortalWPs;
+ path = GetPathAndInitLastWaypointFrom(FifthPortalWPs);
break;
case 5:
- _lastWaypointId = 3;
- path = SixthPoralWPs;
+ path = GetPathAndInitLastWaypointFrom(SixthPortalWPs);
break;
default:
- _lastWaypointId = 0;
- path = DefaultPortalWPs;
+ path = GetPathAndInitLastWaypointFrom(DefaultPortalWPs);
break;
}
if (path)
{
for (uint32 i = 0; i <= _lastWaypointId; i++)
- AddWaypoint(i, path[i].x + irand(-1, 1), path[i].y + irand(-1, 1), path[i].z, 0);
- me->SetHomePosition(path[_lastWaypointId].x, path[_lastWaypointId].y, path[_lastWaypointId].z, float(M_PI));
+ AddWaypoint(i, path[i].GetPositionX() + irand(-1, 1), path[i].GetPositionY() + irand(-1, 1), path[i].GetPositionZ(), 0);
+ me->SetHomePosition(path[_lastWaypointId].GetPositionX(), path[_lastWaypointId].GetPositionY(), path[_lastWaypointId].GetPositionZ(), float(M_PI));
}
Start(true, true);
@@ -1299,7 +1290,7 @@ class npc_violet_hold_defense_system : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_violet_hold_defense_systemAI(creature);
+ return GetVioletHoldAI<npc_violet_hold_defense_systemAI>(creature);
}
};
@@ -1404,9 +1395,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 4238634d8c1..e6095bd5c01 100644
--- a/src/server/scripts/Northrend/VioletHold/violet_hold.h
+++ b/src/server/scripts/Northrend/VioletHold/violet_hold.h
@@ -18,6 +18,8 @@
#ifndef VIOLET_HOLD_H_
#define VIOLET_HOLD_H_
+#include "CreatureAIImpl.h"
+
#define VioletHoldScriptName "instance_violet_hold"
#define DataHeader "VH"
@@ -151,7 +153,7 @@ enum VHInstanceMisc
POINT_INTRO = 1
};
-template<class AI, class T>
+template <class AI, class T>
inline AI* GetVioletHoldAI(T* obj)
{
return GetInstanceAI<AI>(obj, VioletHoldScriptName);
diff --git a/src/server/scripts/Northrend/zone_borean_tundra.cpp b/src/server/scripts/Northrend/zone_borean_tundra.cpp
index d67df0875aa..2e62c09bc17 100644
--- a/src/server/scripts/Northrend/zone_borean_tundra.cpp
+++ b/src/server/scripts/Northrend/zone_borean_tundra.cpp
@@ -34,15 +34,19 @@ npc_lurgglbr
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
+#include "GameObject.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
+#include "ObjectMgr.h"
+#include "Player.h"
#include "ScriptedEscortAI.h"
#include "ScriptedFollowerAI.h"
-#include "Player.h"
+#include "ScriptedGossip.h"
+#include "SpellAuraEffects.h"
#include "SpellInfo.h"
-#include "WorldSession.h"
#include "SpellScript.h"
-#include "SpellAuraEffects.h"
+#include "TemporarySummon.h"
+#include "WorldSession.h"
/*######
## npc_sinkhole_kill_credit
@@ -87,7 +91,7 @@ public:
Initialize();
}
- void SpellHit(Unit* caster, const SpellInfo* spell) override
+ void SpellHit(Unit* caster, SpellInfo const* spell) override
{
if (phase || spell->Id != SPELL_SET_CART)
return;
@@ -463,7 +467,7 @@ public:
void JustDied(Unit* /*killer*/) override
{
- if (GameObject* go_caribou = me->GetMap()->GetGameObject(go_caribouGUID))
+ if (GameObject* go_caribou = ObjectAccessor::GetGameObject(*me, go_caribouGUID))
go_caribou->SetLootState(GO_JUST_DEACTIVATED);
if (TempSummon* summon = me->ToTempSummon())
@@ -472,7 +476,7 @@ public:
if (Player* player = temp->ToPlayer())
player->KilledMonsterCredit(me->GetEntry());
- if (GameObject* go_caribou = me->GetMap()->GetGameObject(go_caribouGUID))
+ if (GameObject* go_caribou = ObjectAccessor::GetGameObject(*me, go_caribouGUID))
go_caribou->SetGoState(GO_STATE_READY);
}
@@ -516,7 +520,7 @@ public:
break;
case 7:
{
- GameObject* go_caribou = NULL;
+ GameObject* go_caribou = nullptr;
for (uint8 i = 0; i < CaribouTrapsNum; ++i)
{
go_caribou = me->FindNearestGameObject(CaribouTraps[i], 5.0f);
@@ -1457,7 +1461,7 @@ public:
AttackStart(who);
}
- void SpellHit(Unit* pCaster, const SpellInfo* pSpell) override
+ void SpellHit(Unit* pCaster, SpellInfo const* pSpell) override
{
if (pSpell->Id == SPELL_ARCANE_CHAINS && pCaster->GetTypeId() == TYPEID_PLAYER && !HealthAbovePct(50) && !bEnslaved)
{
@@ -1567,7 +1571,7 @@ public:
{
}
- void SpellHit(Unit* unit, const SpellInfo* spell) override
+ void SpellHit(Unit* unit, SpellInfo const* spell) override
{
if (spell->Id == SPELL_NEURAL_NEEDLE && unit->GetTypeId() == TYPEID_PLAYER)
if (Player* player = unit->ToPlayer())
@@ -1645,7 +1649,7 @@ public:
void JustDied(Unit* /*killer*/) override
{
- if (Player* player=GetPlayerForEscort())
+ if (Player* player = GetPlayerForEscort())
player->FailQuest(QUEST_ESCAPING_THE_MIST);
}
@@ -1860,7 +1864,7 @@ public:
{
Initialize();
- GameObject* pTrap = NULL;
+ GameObject* pTrap = nullptr;
for (uint8 i = 0; i < MammothTrapsNum; ++i)
{
pTrap = me->FindNearestGameObject(MammothTraps[i], 11.0f);
@@ -1899,7 +1903,7 @@ public:
me->DisappearAndDie();
- GameObject* pTrap = NULL;
+ GameObject* pTrap = nullptr;
for (uint8 i = 0; i < MammothTrapsNum; ++i)
{
pTrap = me->FindNearestGameObject(MammothTraps[i], 11.0f);
@@ -2160,9 +2164,9 @@ enum HiddenCultist
SAY_HIDDEN_CULTIST_4 = 3
};
-const char* GOSSIP_ITEM_TOM_HEGGER = "What do you know about the Cult of the Damned?";
-const char* GOSSIP_ITEM_GUARD_MITCHELLS = "How long have you worked for the Cult of the Damned?";
-const char* GOSSIP_ITEM_SALTY_JOHN_THORPE = "I have a reason to believe you're involved in the cultist activity";
+char const* GOSSIP_ITEM_TOM_HEGGER = "What do you know about the Cult of the Damned?";
+char const* GOSSIP_ITEM_GUARD_MITCHELLS = "How long have you worked for the Cult of the Damned?";
+char const* GOSSIP_ITEM_SALTY_JOHN_THORPE = "I have a reason to believe you're involved in the cultist activity";
class npc_hidden_cultist : public CreatureScript
{
@@ -2290,7 +2294,7 @@ public:
bool GossipHello(Player* player) override
{
uint32 uiGossipText = 0;
- const char* charGossipItem;
+ char const* charGossipItem;
switch (me->GetEntry())
{
@@ -2365,7 +2369,7 @@ public:
{
if (GetTarget()->isDead())
if (Unit* caster = GetCaster())
- caster->CastSpell(NULL, SPELL_WINDSOUL_CREDT);
+ caster->CastSpell(nullptr, SPELL_WINDSOUL_CREDT);
}
void Register() override
diff --git a/src/server/scripts/Northrend/zone_crystalsong_forest.cpp b/src/server/scripts/Northrend/zone_crystalsong_forest.cpp
index 4dadebb1cda..b58ac0ac144 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
@@ -97,7 +97,6 @@ public:
if (Creature* pOrb = ObjectAccessor::GetCreature(*me, targetGUID))
DoCast(pOrb, SPELL_TRANSITUS_SHIELD_BEAM);
-
}
};
diff --git a/src/server/scripts/Northrend/zone_dalaran.cpp b/src/server/scripts/Northrend/zone_dalaran.cpp
index 0e51de2382a..a8920ff3a07 100644
--- a/src/server/scripts/Northrend/zone_dalaran.cpp
+++ b/src/server/scripts/Northrend/zone_dalaran.cpp
@@ -24,9 +24,13 @@ SDCategory: Dalaran
Script Data End */
#include "ScriptMgr.h"
+#include "DatabaseEnv.h"
+#include "Mail.h"
+#include "Map.h"
+#include "MotionMaster.h"
+#include "Player.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
-#include "Player.h"
#include "WorldSession.h"
/*******************************************************
@@ -165,17 +169,16 @@ class npc_minigob_manabonk : public CreatureScript
Player* SelectTargetInDalaran()
{
- std::list<Player*> PlayerInDalaranList;
- PlayerInDalaranList.clear();
+ std::vector<Player*> PlayerInDalaranList;
- Map::PlayerList const &players = me->GetMap()->GetPlayers();
+ Map::PlayerList const& players = me->GetMap()->GetPlayers();
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
if (Player* player = itr->GetSource()->ToPlayer())
if (player->GetZoneId() == ZONE_DALARAN && !player->IsFlying() && !player->IsMounted() && !player->IsGameMaster())
PlayerInDalaranList.push_back(player);
if (PlayerInDalaranList.empty())
- return NULL;
+ return nullptr;
return Trinity::Containers::SelectRandomContainerElement(PlayerInDalaranList);
}
diff --git a/src/server/scripts/Northrend/zone_dragonblight.cpp b/src/server/scripts/Northrend/zone_dragonblight.cpp
index 0d718c6b365..e8b70b98010 100644
--- a/src/server/scripts/Northrend/zone_dragonblight.cpp
+++ b/src/server/scripts/Northrend/zone_dragonblight.cpp
@@ -28,14 +28,16 @@ npc_alexstrasza_wr_gate
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "CombatAI.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
+#include "ObjectMgr.h"
+#include "Player.h"
+#include "ScriptedEscortAI.h"
#include "ScriptedGossip.h"
+#include "SpellInfo.h"
#include "SpellScript.h"
-#include "SpellAuraEffects.h"
-#include "ScriptedEscortAI.h"
#include "Vehicle.h"
-#include "CombatAI.h"
-#include "Player.h"
/*#####
# npc_commander_eligor_dawnbringer
@@ -640,7 +642,7 @@ class npc_torturer_lecraft : public CreatureScript
Talk (SAY_AGGRO, player);
}
- void SpellHit(Unit* caster, const SpellInfo* spell) override
+ void SpellHit(Unit* caster, SpellInfo const* spell) override
{
if (spell->Id != SPELL_HIGH_EXECUTORS_BRANDING_IRON)
return;
@@ -715,7 +717,7 @@ class at_nearby_messenger_torvus : public AreaTriggerScript
public:
at_nearby_messenger_torvus() : AreaTriggerScript("at_nearby_messenger_torvus") { }
- bool OnTrigger(Player* player, const AreaTriggerEntry* /*at*/) override
+ bool OnTrigger(Player* player, AreaTriggerEntry const* /*at*/) override
{
if (player->IsAlive())
if (Quest const* quest = sObjectMgr->GetQuestTemplate(QUEST_MESSAGE_FROM_THE_WEST))
diff --git a/src/server/scripts/Northrend/zone_grizzly_hills.cpp b/src/server/scripts/Northrend/zone_grizzly_hills.cpp
index fb724e0dc93..78be007420d 100644
--- a/src/server/scripts/Northrend/zone_grizzly_hills.cpp
+++ b/src/server/scripts/Northrend/zone_grizzly_hills.cpp
@@ -17,12 +17,15 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedEscortAI.h"
+#include "CombatAI.h"
+#include "CreatureTextMgr.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "ScriptedEscortAI.h"
+#include "SpellInfo.h"
#include "SpellScript.h"
-#include "CreatureTextMgr.h"
-#include "CombatAI.h"
+#include "TemporarySummon.h"
/*######
## Quest 12027: Mr. Floppy's Perilous Adventure
@@ -300,7 +303,7 @@ public:
_gender = Data;
}
- void SpellHit(Unit* Caster, const SpellInfo* Spell) override
+ void SpellHit(Unit* Caster, SpellInfo const* Spell) override
{
if (Spell->Id == SPELL_OUTHOUSE_GROANS)
{
@@ -495,7 +498,7 @@ public:
me->DespawnOrUnsummon(_despawnTimer);
}
- void SpellHit(Unit* caster, const SpellInfo* spell) override
+ void SpellHit(Unit* caster, SpellInfo const* spell) override
{
if (spell->Id == SPELL_RENEW_SKIRMISHER && caster->GetTypeId() == TYPEID_PLAYER
&& caster->ToPlayer()->GetQuestStatus(QUEST_OVERWHELMED) == QUEST_STATUS_INCOMPLETE)
@@ -953,9 +956,7 @@ 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*/)
@@ -997,9 +998,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 595008c38a7..aeb2fa3e59a 100644
--- a/src/server/scripts/Northrend/zone_howling_fjord.cpp
+++ b/src/server/scripts/Northrend/zone_howling_fjord.cpp
@@ -28,12 +28,14 @@ npc_apothecary_hanes
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
-#include "ScriptedEscortAI.h"
+#include "MotionMaster.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
@@ -560,9 +562,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 849a3d5568b..b7f60c8e9d2 100644
--- a/src/server/scripts/Northrend/zone_icecrown.cpp
+++ b/src/server/scripts/Northrend/zone_icecrown.cpp
@@ -17,12 +17,14 @@
*/
#include "ScriptMgr.h"
+#include "CombatAI.h"
+#include "MotionMaster.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 4022c293aae..118aae0da83 100644
--- a/src/server/scripts/Northrend/zone_sholazar_basin.cpp
+++ b/src/server/scripts/Northrend/zone_sholazar_basin.cpp
@@ -29,14 +29,18 @@ npc_haiphoon (Quest: "Song of Wind and Water")
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
+#include "CombatAI.h"
+#include "Map.h"
+#include "MotionMaster.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
@@ -275,7 +279,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:
@@ -286,7 +290,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 806aff4f3b3..5bc39c7e47d 100644
--- a/src/server/scripts/Northrend/zone_storm_peaks.cpp
+++ b/src/server/scripts/Northrend/zone_storm_peaks.cpp
@@ -16,15 +16,18 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
+#include "CombatAI.h"
+#include "GameObject.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptedEscortAI.h"
+#include "ScriptedGossip.h"
+#include "SpellAuraEffects.h"
#include "SpellHistory.h"
#include "SpellScript.h"
-#include "SpellAuraEffects.h"
+#include "TemporarySummon.h"
#include "Vehicle.h"
-#include "CombatAI.h"
-#include "Player.h"
#include "WorldSession.h"
/////////////////////
@@ -222,7 +225,7 @@ public:
me->DespawnOrUnsummon();
}
- void SpellHit(Unit* caster, const SpellInfo* spell) override
+ void SpellHit(Unit* caster, SpellInfo const* spell) override
{
if (spell->Id != SPELL_ICE_LANCE)
return;
@@ -528,7 +531,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;
@@ -536,7 +539,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;
@@ -544,7 +547,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;
@@ -552,7 +555,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;
@@ -560,7 +563,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;
@@ -968,9 +971,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*/)
@@ -1001,9 +1002,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*/)
@@ -1038,22 +1037,15 @@ class spell_close_rift : public SpellScriptLoader
{
PrepareAuraScript(spell_close_rift_AuraScript);
- public:
- spell_close_rift_AuraScript()
- {
- _counter = 0;
- }
-
- private:
bool Validate(SpellInfo const* /*spell*/) override
{
- return sSpellMgr->GetSpellInfo(SPELL_DESPAWN_RIFT) != nullptr;
+ return ValidateSpellInfo({ SPELL_DESPAWN_RIFT });
}
void HandlePeriodic(AuraEffect const* /* aurEff */)
{
if (++_counter == 5)
- GetTarget()->CastSpell((Unit*)NULL, SPELL_DESPAWN_RIFT, true);
+ GetTarget()->CastSpell((Unit*)nullptr, SPELL_DESPAWN_RIFT, true);
}
void Register() override
@@ -1062,7 +1054,7 @@ class spell_close_rift : public SpellScriptLoader
}
private:
- uint8 _counter;
+ uint8 _counter = 0;
};
@@ -1084,9 +1076,7 @@ class spell_eject_passenger_wild_wyrm : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_FIGHT_WYRM))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_FIGHT_WYRM });
}
void HandleScript(SpellEffIndex /*effIndex*/)
@@ -1246,9 +1236,7 @@ class spell_low_health_trigger : public SpellScriptLoader
bool Validate(SpellInfo const* spellInfo) override
{
- if (!sSpellMgr->GetSpellInfo(spellInfo->Effects[EFFECT_0].CalcValue()))
- return false;
- return true;
+ return ValidateSpellInfo({ static_cast<uint32>(spellInfo->Effects[EFFECT_0].CalcValue()) });
}
void HandleScript(SpellEffIndex /*effIndex*/)
@@ -1352,9 +1340,7 @@ class spell_fatal_strike : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_FATAL_STRIKE_DAMAGE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_FATAL_STRIKE_DAMAGE });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -1431,9 +1417,7 @@ class spell_player_mount_wyrm : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_FIGHT_WYRM))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_FIGHT_WYRM });
}
void HandleDummy(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
diff --git a/src/server/scripts/Northrend/zone_wintergrasp.cpp b/src/server/scripts/Northrend/zone_wintergrasp.cpp
index 5f8148dcfa9..64ac0441f93 100644
--- a/src/server/scripts/Northrend/zone_wintergrasp.cpp
+++ b/src/server/scripts/Northrend/zone_wintergrasp.cpp
@@ -1,31 +1,35 @@
-/* Copyright (C) 2008 - 2009 Trinity <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.
+/*
+ * Copyright (C) 2008-2017 TrinityCore <http://www.trinitycore.org/>
*
- * 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.
+ * 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.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * 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 "ScriptMgr.h"
+#include "Battlefield.h"
#include "BattlefieldMgr.h"
#include "BattlefieldWG.h"
-#include "Battlefield.h"
-#include "ScriptSystem.h"
-#include "WorldSession.h"
-#include "ObjectMgr.h"
-#include "Vehicle.h"
+#include "DBCStores.h"
+#include "GameObject.h"
#include "GameObjectAI.h"
+#include "ObjectMgr.h"
+#include "Player.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
+#include "ScriptSystem.h"
#include "SpellScript.h"
-#include "Player.h"
+#include "Vehicle.h"
+#include "WorldSession.h"
#define GOSSIP_HELLO_DEMO1 "Build catapult."
#define GOSSIP_HELLO_DEMO2 "Build demolisher."
@@ -304,7 +308,7 @@ class npc_wg_queue : public CreatureScript
else
{
uint32 timer = wintergrasp->GetTimer() / 1000;
- player->SendUpdateWorldState(4354, time(NULL) + timer);
+ player->SendUpdateWorldState(4354, time(nullptr) + timer);
if (timer < 15 * MINUTE)
{
AddGossipItemFor(player, GOSSIP_ICON_CHAT, player->GetSession()->GetTrinityString(WG_NPCQUEUE_TEXTOPTION_JOIN), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
@@ -431,12 +435,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 a4eac22f16c..607e6845157 100644
--- a/src/server/scripts/Northrend/zone_zuldrak.cpp
+++ b/src/server/scripts/Northrend/zone_zuldrak.cpp
@@ -16,15 +16,18 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
-#include "ScriptedEscortAI.h"
+#include "GameObject.h"
#include "GameObjectAI.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "ScriptedCreature.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"
/*####
@@ -86,7 +89,7 @@ public:
me->setDeathState(DEAD);
}
- void SpellHit(Unit* caster, const SpellInfo* spell) override
+ void SpellHit(Unit* caster, SpellInfo const* spell) override
{
if (spell->Id == SPELL_UNLOCK_SHACKLE)
{
@@ -142,7 +145,7 @@ public:
void MoveInLineOfSight(Unit* /*who*/) override { }
- void SpellHit(Unit* /*caster*/, const SpellInfo* spell) override
+ void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_FREE_RAGECLAW)
{
@@ -646,9 +649,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*/)
@@ -693,15 +699,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 */)
@@ -725,7 +746,7 @@ class spell_random_ingredient : public SpellScriptLoader
if (Creature* finklestein = GetClosestCreatureWithEntry(player, NPC_FINKLESTEIN, 25.0f))
{
- finklestein->CastSpell(player, FetchIngredients[ingredient][0], true, NULL);
+ finklestein->CastSpell(player, FetchIngredients[ingredient][0], true, nullptr);
finklestein->AI()->Talk(FetchIngredients[ingredient][3], player);
}
}
@@ -757,22 +778,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 */)
@@ -900,7 +929,7 @@ public:
Reset();
}
- void SpellHit(Unit* caster, const SpellInfo* spell) override
+ void SpellHit(Unit* caster, SpellInfo const* spell) override
{
if (spell->Id != GYMERS_GRAB)
return;
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp
index c73327f652c..01598548041 100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp
@@ -31,9 +31,9 @@ uint32 const EP_AllianceBuffs[4] = { 11413, 11414, 11415, 1386 };
uint32 const EP_HordeBuffs[4] = { 30880, 30683, 30682, 29520 };
-uint32 const EP_GraveYardZone = 139;
+uint32 const EP_GraveyardZone = 139;
-uint32 const EP_GraveYardId = 927;
+uint32 const EP_GraveyardId = 927;
uint8 const EPBuffZonesNum = 3;
@@ -116,14 +116,14 @@ void OPvPCapturePointEP_EWT::ChangeState()
artkit = 2;
SummonSupportUnitAtNorthpassTower(ALLIANCE);
((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_EWT, ALLIANCE);
- m_PvP->SendDefenseMessage(EP_GraveYardZone, TEXT_EASTWALL_TOWER_TAKEN_ALLIANCE);
+ m_PvP->SendDefenseMessage(EP_GraveyardZone, TEXT_EASTWALL_TOWER_TAKEN_ALLIANCE);
break;
case OBJECTIVESTATE_HORDE:
m_TowerState = EP_TS_H;
artkit = 1;
SummonSupportUnitAtNorthpassTower(HORDE);
((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_EWT, HORDE);
- m_PvP->SendDefenseMessage(EP_GraveYardZone, TEXT_EASTWALL_TOWER_TAKEN_HORDE);
+ m_PvP->SendDefenseMessage(EP_GraveyardZone, TEXT_EASTWALL_TOWER_TAKEN_HORDE);
break;
case OBJECTIVESTATE_NEUTRAL:
m_TowerState = EP_TS_N;
@@ -214,14 +214,14 @@ void OPvPCapturePointEP_NPT::ChangeState()
artkit = 2;
SummonGO(ALLIANCE);
((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_NPT, ALLIANCE);
- m_PvP->SendDefenseMessage(EP_GraveYardZone, TEXT_NORTHPASS_TOWER_TAKEN_ALLIANCE);
+ m_PvP->SendDefenseMessage(EP_GraveyardZone, TEXT_NORTHPASS_TOWER_TAKEN_ALLIANCE);
break;
case OBJECTIVESTATE_HORDE:
m_TowerState = EP_TS_H;
artkit = 1;
SummonGO(HORDE);
((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_NPT, HORDE);
- m_PvP->SendDefenseMessage(EP_GraveYardZone, TEXT_NORTHPASS_TOWER_TAKEN_HORDE);
+ m_PvP->SendDefenseMessage(EP_GraveyardZone, TEXT_NORTHPASS_TOWER_TAKEN_HORDE);
break;
case OBJECTIVESTATE_NEUTRAL:
m_TowerState = EP_TS_N;
@@ -317,16 +317,16 @@ void OPvPCapturePointEP_CGT::ChangeState()
case OBJECTIVESTATE_ALLIANCE:
m_TowerState = EP_TS_A;
artkit = 2;
- LinkGraveYard(ALLIANCE);
+ LinkGraveyard(ALLIANCE);
((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_CGT, ALLIANCE);
- m_PvP->SendDefenseMessage(EP_GraveYardZone, TEXT_CROWN_GUARD_TOWER_TAKEN_ALLIANCE);
+ m_PvP->SendDefenseMessage(EP_GraveyardZone, TEXT_CROWN_GUARD_TOWER_TAKEN_ALLIANCE);
break;
case OBJECTIVESTATE_HORDE:
m_TowerState = EP_TS_H;
artkit = 1;
- LinkGraveYard(HORDE);
+ LinkGraveyard(HORDE);
((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_CGT, HORDE);
- m_PvP->SendDefenseMessage(EP_GraveYardZone, TEXT_CROWN_GUARD_TOWER_TAKEN_HORDE);
+ m_PvP->SendDefenseMessage(EP_GraveyardZone, TEXT_CROWN_GUARD_TOWER_TAKEN_HORDE);
break;
case OBJECTIVESTATE_NEUTRAL:
m_TowerState = EP_TS_N;
@@ -375,13 +375,13 @@ void OPvPCapturePointEP_CGT::UpdateTowerState()
m_PvP->SendUpdateWorldState(EP_CGT_N, (m_TowerState & EP_TS_N) != 0);
}
-void OPvPCapturePointEP_CGT::LinkGraveYard(uint32 team)
+void OPvPCapturePointEP_CGT::LinkGraveyard(uint32 team)
{
if (m_GraveyardSide != team)
{
m_GraveyardSide = team;
- sObjectMgr->RemoveGraveYardLink(EP_GraveYardId, EP_GraveYardZone, team, false);
- sObjectMgr->AddGraveYardLink(EP_GraveYardId, EP_GraveYardZone, team, false);
+ sObjectMgr->RemoveGraveyardLink(EP_GraveyardId, EP_GraveyardZone, team, false);
+ sObjectMgr->AddGraveyardLink(EP_GraveyardId, EP_GraveyardZone, team, false);
}
}
@@ -408,14 +408,14 @@ void OPvPCapturePointEP_PWT::ChangeState()
SummonFlightMaster(ALLIANCE);
artkit = 2;
((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_PWT, ALLIANCE);
- m_PvP->SendDefenseMessage(EP_GraveYardZone, TEXT_PLAGUEWOOD_TOWER_TAKEN_ALLIANCE);
+ m_PvP->SendDefenseMessage(EP_GraveyardZone, TEXT_PLAGUEWOOD_TOWER_TAKEN_ALLIANCE);
break;
case OBJECTIVESTATE_HORDE:
m_TowerState = EP_TS_H;
SummonFlightMaster(HORDE);
artkit = 1;
((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_PWT, HORDE);
- m_PvP->SendDefenseMessage(EP_GraveYardZone, TEXT_PLAGUEWOOD_TOWER_TAKEN_HORDE);
+ m_PvP->SendDefenseMessage(EP_GraveyardZone, TEXT_PLAGUEWOOD_TOWER_TAKEN_HORDE);
break;
case OBJECTIVESTATE_NEUTRAL:
m_TowerState = EP_TS_N;
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPEP.h b/src/server/scripts/OutdoorPvP/OutdoorPvPEP.h
index e5c92129c47..5d9dbf97296 100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPEP.h
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPEP.h
@@ -175,7 +175,7 @@ class OPvPCapturePointEP_CGT : public OPvPCapturePoint
void FillInitialWorldStates(WorldPacket & data);
protected:
- void LinkGraveYard(uint32 team);
+ void LinkGraveyard(uint32 team);
void UpdateTowerState();
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp
index 99fa669d731..72fb3efc961 100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp
@@ -15,16 +15,14 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "MapManager.h"
#include "ScriptMgr.h"
+#include "GameObject.h"
+#include "Map.h"
#include "OutdoorPvPHP.h"
-#include "OutdoorPvP.h"
#include "OutdoorPvPMgr.h"
#include "Player.h"
-#include "ObjectMgr.h"
#include "WorldPacket.h"
-
uint32 const OutdoorPvPHPBuffZonesNum = 6;
// HP, citadel, ramparts, blood furnace, shattered halls, mag's lair
uint32 const OutdoorPvPHPBuffZones[OutdoorPvPHPBuffZonesNum] = { 3483, 3563, 3562, 3713, 3714, 3836 };
@@ -254,7 +252,7 @@ void OPvPCapturePointHP::ChangeState()
break;
}
- Map* map = sMapMgr->FindMap(530, 0);
+ Map* map = m_PvP->GetMap();
auto bounds = map->GetGameObjectBySpawnIdStore().equal_range(m_capturePointSpawnId);
for (auto itr = bounds.first; itr != bounds.second; ++itr)
itr->second->SetGoArtKit(artkit);
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp
index 2b3eb49c13f..12070e4130a 100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp
@@ -15,12 +15,14 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "MapManager.h"
#include "ScriptMgr.h"
-#include "OutdoorPvPNA.h"
-#include "Player.h"
+#include "Creature.h"
+#include "GameObject.h"
#include "ObjectMgr.h"
#include "OutdoorPvPMgr.h"
+#include "OutdoorPvPNA.h"
+#include "Map.h"
+#include "Player.h"
#include "WorldPacket.h"
// kill credit for pks
@@ -132,7 +134,7 @@ creature_type const AllianceControlNPCs[NA_CONTROL_NPC_NUM] =
OutdoorPvPNA::OutdoorPvPNA()
{
m_TypeId = OUTDOOR_PVP_NA;
- m_obj = NULL;
+ m_obj = nullptr;
}
void OutdoorPvPNA::HandleKillImpl(Player* player, Unit* killed)
@@ -154,30 +156,30 @@ uint32 OPvPCapturePointNA::GetAliveGuardsCount()
{
switch (itr->first)
{
- case NA_NPC_GUARD_01:
- case NA_NPC_GUARD_02:
- case NA_NPC_GUARD_03:
- case NA_NPC_GUARD_04:
- case NA_NPC_GUARD_05:
- case NA_NPC_GUARD_06:
- case NA_NPC_GUARD_07:
- case NA_NPC_GUARD_08:
- case NA_NPC_GUARD_09:
- case NA_NPC_GUARD_10:
- case NA_NPC_GUARD_11:
- case NA_NPC_GUARD_12:
- case NA_NPC_GUARD_13:
- case NA_NPC_GUARD_14:
- case NA_NPC_GUARD_15:
- {
- auto bounds = m_PvP->GetMap()->GetCreatureBySpawnIdStore().equal_range(itr->second);
- for (auto itr2 = bounds.first; itr2 != bounds.second; ++itr2)
- if (itr2->second->IsAlive())
- ++cnt;
- break;
- }
- default:
- break;
+ case NA_NPC_GUARD_01:
+ case NA_NPC_GUARD_02:
+ case NA_NPC_GUARD_03:
+ case NA_NPC_GUARD_04:
+ case NA_NPC_GUARD_05:
+ case NA_NPC_GUARD_06:
+ case NA_NPC_GUARD_07:
+ case NA_NPC_GUARD_08:
+ case NA_NPC_GUARD_09:
+ case NA_NPC_GUARD_10:
+ case NA_NPC_GUARD_11:
+ case NA_NPC_GUARD_12:
+ case NA_NPC_GUARD_13:
+ case NA_NPC_GUARD_14:
+ case NA_NPC_GUARD_15:
+ {
+ auto bounds = m_PvP->GetMap()->GetCreatureBySpawnIdStore().equal_range(itr->second);
+ for (auto itr2 = bounds.first; itr2 != bounds.second; ++itr2)
+ if (itr2->second->IsAlive())
+ ++cnt;
+ break;
+ }
+ default:
+ break;
}
}
return cnt;
@@ -241,11 +243,11 @@ void OPvPCapturePointNA::DeSpawnGOs()
void OPvPCapturePointNA::FactionTakeOver(uint32 team)
{
if (m_ControllingFaction)
- sObjectMgr->RemoveGraveYardLink(NA_HALAA_GRAVEYARD, NA_HALAA_GRAVEYARD_ZONE, m_ControllingFaction, false);
+ sObjectMgr->RemoveGraveyardLink(NA_HALAA_GRAVEYARD, NA_HALAA_GRAVEYARD_ZONE, m_ControllingFaction, false);
m_ControllingFaction = team;
if (m_ControllingFaction)
- sObjectMgr->AddGraveYardLink(NA_HALAA_GRAVEYARD, NA_HALAA_GRAVEYARD_ZONE, m_ControllingFaction, false);
+ sObjectMgr->AddGraveyardLink(NA_HALAA_GRAVEYARD, NA_HALAA_GRAVEYARD_ZONE, m_ControllingFaction, false);
DeSpawnGOs();
DeSpawnNPCs();
SpawnGOsForTeam(team);
@@ -487,11 +489,11 @@ int32 OPvPCapturePointNA::HandleOpenGo(Player* player, GameObject* go)
int32 retval = OPvPCapturePoint::HandleOpenGo(player, go);
if (retval >= 0)
{
- const go_type * gos = NULL;
+ go_type const* gos = nullptr;
if (m_ControllingFaction == ALLIANCE)
- gos=AllianceControlGOs;
+ gos = AllianceControlGOs;
else if (m_ControllingFaction == HORDE)
- gos=HordeControlGOs;
+ gos = HordeControlGOs;
else
return -1;
@@ -502,101 +504,101 @@ int32 OPvPCapturePointNA::HandleOpenGo(Player* player, GameObject* go)
switch (retval)
{
- case NA_DESTROYED_ROOST_S:
- del = NA_DESTROYED_ROOST_S;
- add = NA_ROOST_S;
- add2 = NA_BOMB_WAGON_S;
- if (m_ControllingFaction == HORDE)
- m_WyvernStateSouth = WYVERN_ALLIANCE;
- else
- m_WyvernStateSouth = WYVERN_HORDE;
- UpdateWyvernRoostWorldState(NA_ROOST_S);
- break;
- case NA_DESTROYED_ROOST_N:
- del = NA_DESTROYED_ROOST_N;
- add = NA_ROOST_N;
- add2 = NA_BOMB_WAGON_N;
- if (m_ControllingFaction == HORDE)
- m_WyvernStateNorth = WYVERN_ALLIANCE;
- else
- m_WyvernStateNorth = WYVERN_HORDE;
- UpdateWyvernRoostWorldState(NA_ROOST_N);
- break;
- case NA_DESTROYED_ROOST_W:
- del = NA_DESTROYED_ROOST_W;
- add = NA_ROOST_W;
- add2 = NA_BOMB_WAGON_W;
- if (m_ControllingFaction == HORDE)
- m_WyvernStateWest = WYVERN_ALLIANCE;
- else
- m_WyvernStateWest = WYVERN_HORDE;
- UpdateWyvernRoostWorldState(NA_ROOST_W);
- break;
- case NA_DESTROYED_ROOST_E:
- del = NA_DESTROYED_ROOST_E;
- add = NA_ROOST_E;
- add2 = NA_BOMB_WAGON_E;
- if (m_ControllingFaction == HORDE)
- m_WyvernStateEast = WYVERN_ALLIANCE;
- else
- m_WyvernStateEast = WYVERN_HORDE;
- UpdateWyvernRoostWorldState(NA_ROOST_E);
- break;
- case NA_BOMB_WAGON_S:
- del = NA_BOMB_WAGON_S;
- del2 = NA_ROOST_S;
- add = NA_DESTROYED_ROOST_S;
- if (m_ControllingFaction == HORDE)
- m_WyvernStateSouth = WYVERN_NEU_ALLIANCE;
- else
- m_WyvernStateSouth = WYVERN_NEU_HORDE;
- UpdateWyvernRoostWorldState(NA_ROOST_S);
- break;
- case NA_BOMB_WAGON_N:
- del = NA_BOMB_WAGON_N;
- del2 = NA_ROOST_N;
- add = NA_DESTROYED_ROOST_N;
- if (m_ControllingFaction == HORDE)
- m_WyvernStateNorth = WYVERN_NEU_ALLIANCE;
- else
- m_WyvernStateNorth = WYVERN_NEU_HORDE;
- UpdateWyvernRoostWorldState(NA_ROOST_N);
- break;
- case NA_BOMB_WAGON_W:
- del = NA_BOMB_WAGON_W;
- del2 = NA_ROOST_W;
- add = NA_DESTROYED_ROOST_W;
- if (m_ControllingFaction == HORDE)
- m_WyvernStateWest = WYVERN_NEU_ALLIANCE;
- else
- m_WyvernStateWest = WYVERN_NEU_HORDE;
- UpdateWyvernRoostWorldState(NA_ROOST_W);
- break;
- case NA_BOMB_WAGON_E:
- del = NA_BOMB_WAGON_E;
- del2 = NA_ROOST_E;
- add = NA_DESTROYED_ROOST_E;
- if (m_ControllingFaction == HORDE)
- m_WyvernStateEast = WYVERN_NEU_ALLIANCE;
- else
- m_WyvernStateEast = WYVERN_NEU_HORDE;
- UpdateWyvernRoostWorldState(NA_ROOST_E);
- break;
- default:
- return -1;
- break;
+ case NA_DESTROYED_ROOST_S:
+ del = NA_DESTROYED_ROOST_S;
+ add = NA_ROOST_S;
+ add2 = NA_BOMB_WAGON_S;
+ if (m_ControllingFaction == HORDE)
+ m_WyvernStateSouth = WYVERN_ALLIANCE;
+ else
+ m_WyvernStateSouth = WYVERN_HORDE;
+ UpdateWyvernRoostWorldState(NA_ROOST_S);
+ break;
+ case NA_DESTROYED_ROOST_N:
+ del = NA_DESTROYED_ROOST_N;
+ add = NA_ROOST_N;
+ add2 = NA_BOMB_WAGON_N;
+ if (m_ControllingFaction == HORDE)
+ m_WyvernStateNorth = WYVERN_ALLIANCE;
+ else
+ m_WyvernStateNorth = WYVERN_HORDE;
+ UpdateWyvernRoostWorldState(NA_ROOST_N);
+ break;
+ case NA_DESTROYED_ROOST_W:
+ del = NA_DESTROYED_ROOST_W;
+ add = NA_ROOST_W;
+ add2 = NA_BOMB_WAGON_W;
+ if (m_ControllingFaction == HORDE)
+ m_WyvernStateWest = WYVERN_ALLIANCE;
+ else
+ m_WyvernStateWest = WYVERN_HORDE;
+ UpdateWyvernRoostWorldState(NA_ROOST_W);
+ break;
+ case NA_DESTROYED_ROOST_E:
+ del = NA_DESTROYED_ROOST_E;
+ add = NA_ROOST_E;
+ add2 = NA_BOMB_WAGON_E;
+ if (m_ControllingFaction == HORDE)
+ m_WyvernStateEast = WYVERN_ALLIANCE;
+ else
+ m_WyvernStateEast = WYVERN_HORDE;
+ UpdateWyvernRoostWorldState(NA_ROOST_E);
+ break;
+ case NA_BOMB_WAGON_S:
+ del = NA_BOMB_WAGON_S;
+ del2 = NA_ROOST_S;
+ add = NA_DESTROYED_ROOST_S;
+ if (m_ControllingFaction == HORDE)
+ m_WyvernStateSouth = WYVERN_NEU_ALLIANCE;
+ else
+ m_WyvernStateSouth = WYVERN_NEU_HORDE;
+ UpdateWyvernRoostWorldState(NA_ROOST_S);
+ break;
+ case NA_BOMB_WAGON_N:
+ del = NA_BOMB_WAGON_N;
+ del2 = NA_ROOST_N;
+ add = NA_DESTROYED_ROOST_N;
+ if (m_ControllingFaction == HORDE)
+ m_WyvernStateNorth = WYVERN_NEU_ALLIANCE;
+ else
+ m_WyvernStateNorth = WYVERN_NEU_HORDE;
+ UpdateWyvernRoostWorldState(NA_ROOST_N);
+ break;
+ case NA_BOMB_WAGON_W:
+ del = NA_BOMB_WAGON_W;
+ del2 = NA_ROOST_W;
+ add = NA_DESTROYED_ROOST_W;
+ if (m_ControllingFaction == HORDE)
+ m_WyvernStateWest = WYVERN_NEU_ALLIANCE;
+ else
+ m_WyvernStateWest = WYVERN_NEU_HORDE;
+ UpdateWyvernRoostWorldState(NA_ROOST_W);
+ break;
+ case NA_BOMB_WAGON_E:
+ del = NA_BOMB_WAGON_E;
+ del2 = NA_ROOST_E;
+ add = NA_DESTROYED_ROOST_E;
+ if (m_ControllingFaction == HORDE)
+ m_WyvernStateEast = WYVERN_NEU_ALLIANCE;
+ else
+ m_WyvernStateEast = WYVERN_NEU_HORDE;
+ UpdateWyvernRoostWorldState(NA_ROOST_E);
+ break;
+ default:
+ return -1;
+ break;
}
- if (del>-1)
+ if (del > -1)
DelObject(del);
- if (del2>-1)
+ if (del2 > -1)
DelObject(del2);
- if (add>-1)
+ if (add > -1)
AddObject(add, gos[add].entry, gos[add].map, gos[add].pos, gos[add].rot);
- if (add2>-1)
+ if (add2 > -1)
AddObject(add2, gos[add2].entry, gos[add2].map, gos[add2].pos, gos[add2].rot);
return retval;
@@ -677,7 +679,7 @@ void OPvPCapturePointNA::ChangeState()
break;
}
- auto bounds = sMapMgr->FindMap(530, 0)->GetGameObjectBySpawnIdStore().equal_range(m_capturePointSpawnId);
+ auto bounds = m_PvP->GetMap()->GetGameObjectBySpawnIdStore().equal_range(m_capturePointSpawnId);
for (auto itr = bounds.first; itr != bounds.second; ++itr)
itr->second->SetGoArtKit(artkit);
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp
index 89fb30a5b6a..cea1d482d51 100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp
@@ -16,16 +16,17 @@
*/
#include "ScriptMgr.h"
-#include "OutdoorPvPSI.h"
-#include "WorldPacket.h"
-#include "Player.h"
+#include "DBCStores.h"
#include "GameObject.h"
-#include "MapManager.h"
+#include "Language.h"
+#include "Map.h"
#include "ObjectMgr.h"
#include "OutdoorPvPMgr.h"
+#include "OutdoorPvPSI.h"
+#include "Player.h"
#include "ReputationMgr.h"
-#include "Language.h"
#include "World.h"
+#include "WorldPacket.h"
uint32 const SI_MAX_RESOURCES = 200;
@@ -120,7 +121,7 @@ bool OutdoorPvPSI::HandleAreaTrigger(Player* player, uint32 trigger)
// reward player
player->CastSpell(player, SI_TRACES_OF_SILITHYST, true);
// add 19 honor
- player->RewardHonor(NULL, 1, 19);
+ player->RewardHonor(nullptr, 1, 19);
// add 20 cenarion circle repu
player->GetReputationMgr().ModifyReputation(sFactionStore.LookupEntry(609), 20);
// complete quest
@@ -146,7 +147,7 @@ bool OutdoorPvPSI::HandleAreaTrigger(Player* player, uint32 trigger)
// reward player
player->CastSpell(player, SI_TRACES_OF_SILITHYST, true);
// add 19 honor
- player->RewardHonor(NULL, 1, 19);
+ player->RewardHonor(nullptr, 1, 19);
// add 20 cenarion circle repu
player->GetReputationMgr().ModifyReputation(sFactionStore.LookupEntry(609), 20);
// complete quest
@@ -176,7 +177,7 @@ bool OutdoorPvPSI::HandleDropFlag(Player* player, uint32 spellId)
GameObject* go = new GameObject;
Map* map = player->GetMap();
- if (!go->Create(map->GenerateLowGuid<HighGuid::GameObject>(), SI_SILITHYST_MOUND, map, player->GetPhaseMask(), *player, G3D::Quat(), 255, GO_STATE_READY))
+ if (!go->Create(map->GenerateLowGuid<HighGuid::GameObject>(), SI_SILITHYST_MOUND, map, player->GetPhaseMask(), *player, QuaternionData(), 255, GO_STATE_READY))
{
delete go;
return true;
@@ -205,7 +206,7 @@ bool OutdoorPvPSI::HandleDropFlag(Player* player, uint32 spellId)
GameObject* go = new GameObject;
Map* map = player->GetMap();
- if (!go->Create(map->GenerateLowGuid<HighGuid::GameObject>(), SI_SILITHYST_MOUND, map, player->GetPhaseMask(), *player, G3D::Quat(), 255, GO_STATE_READY))
+ if (!go->Create(map->GenerateLowGuid<HighGuid::GameObject>(), 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 6f87e29034f..efd3f7836d1 100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp
@@ -15,14 +15,14 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "MapManager.h"
#include "ScriptMgr.h"
-#include "OutdoorPvPTF.h"
+#include "GameObject.h"
+#include "Map.h"
+#include "ObjectAccessor.h"
#include "OutdoorPvPMgr.h"
-#include "OutdoorPvP.h"
-#include "WorldPacket.h"
+#include "OutdoorPvPTF.h"
#include "Player.h"
-#include "ObjectMgr.h"
+#include "WorldPacket.h"
uint8 const OutdoorPvPTFBuffZonesNum = 5;
uint32 const OutdoorPvPTFBuffZones[OutdoorPvPTFBuffZonesNum] =
@@ -341,46 +341,46 @@ void OPvPCapturePointTF::ChangeState()
switch (m_State)
{
- case OBJECTIVESTATE_ALLIANCE:
- {
- m_TowerState = TF_TOWERSTATE_A;
- artkit = 2;
- uint32 alliance_towers = ((OutdoorPvPTF*)m_PvP)->GetAllianceTowersControlled();
- if (alliance_towers < TF_TOWER_NUM)
- ((OutdoorPvPTF*)m_PvP)->SetAllianceTowersControlled(++alliance_towers);
-
- m_PvP->SendDefenseMessage(OutdoorPvPTFBuffZones[0], TEXT_SPIRIT_TOWER_TAKEN_ALLIANCE);
-
- for (GuidSet::iterator itr = m_activePlayers[0].begin(); itr != m_activePlayers[0].end(); ++itr)
- if (Player* player = ObjectAccessor::FindPlayer(*itr))
- player->AreaExploredOrEventHappens(TF_ALLY_QUEST);
- break;
- }
- case OBJECTIVESTATE_HORDE:
- {
- m_TowerState = TF_TOWERSTATE_H;
- artkit = 1;
- uint32 horde_towers = ((OutdoorPvPTF*)m_PvP)->GetHordeTowersControlled();
- if (horde_towers < TF_TOWER_NUM)
- ((OutdoorPvPTF*)m_PvP)->SetHordeTowersControlled(++horde_towers);
-
- m_PvP->SendDefenseMessage(OutdoorPvPTFBuffZones[0], TEXT_SPIRIT_TOWER_TAKEN_HORDE);
-
- for (GuidSet::iterator itr = m_activePlayers[1].begin(); itr != m_activePlayers[1].end(); ++itr)
- if (Player* player = ObjectAccessor::FindPlayer(*itr))
- player->AreaExploredOrEventHappens(TF_HORDE_QUEST);
- break;
- }
- case OBJECTIVESTATE_NEUTRAL:
- case OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE:
- case OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE:
- case OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE:
- case OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE:
- m_TowerState = TF_TOWERSTATE_N;
- break;
+ case OBJECTIVESTATE_ALLIANCE:
+ {
+ m_TowerState = TF_TOWERSTATE_A;
+ artkit = 2;
+ uint32 alliance_towers = ((OutdoorPvPTF*)m_PvP)->GetAllianceTowersControlled();
+ if (alliance_towers < TF_TOWER_NUM)
+ ((OutdoorPvPTF*)m_PvP)->SetAllianceTowersControlled(++alliance_towers);
+
+ m_PvP->SendDefenseMessage(OutdoorPvPTFBuffZones[0], TEXT_SPIRIT_TOWER_TAKEN_ALLIANCE);
+
+ for (GuidSet::iterator itr = m_activePlayers[0].begin(); itr != m_activePlayers[0].end(); ++itr)
+ if (Player* player = ObjectAccessor::FindPlayer(*itr))
+ player->AreaExploredOrEventHappens(TF_ALLY_QUEST);
+ break;
+ }
+ case OBJECTIVESTATE_HORDE:
+ {
+ m_TowerState = TF_TOWERSTATE_H;
+ artkit = 1;
+ uint32 horde_towers = ((OutdoorPvPTF*)m_PvP)->GetHordeTowersControlled();
+ if (horde_towers < TF_TOWER_NUM)
+ ((OutdoorPvPTF*)m_PvP)->SetHordeTowersControlled(++horde_towers);
+
+ m_PvP->SendDefenseMessage(OutdoorPvPTFBuffZones[0], TEXT_SPIRIT_TOWER_TAKEN_HORDE);
+
+ for (GuidSet::iterator itr = m_activePlayers[1].begin(); itr != m_activePlayers[1].end(); ++itr)
+ if (Player* player = ObjectAccessor::FindPlayer(*itr))
+ player->AreaExploredOrEventHappens(TF_HORDE_QUEST);
+ break;
+ }
+ case OBJECTIVESTATE_NEUTRAL:
+ case OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE:
+ case OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE:
+ case OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE:
+ case OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE:
+ m_TowerState = TF_TOWERSTATE_N;
+ break;
}
- auto bounds = sMapMgr->FindMap(530, 0)->GetGameObjectBySpawnIdStore().equal_range(m_capturePointSpawnId);
+ auto bounds = m_PvP->GetMap()->GetGameObjectBySpawnIdStore().equal_range(m_capturePointSpawnId);
for (auto itr = bounds.first; itr != bounds.second; ++itr)
itr->second->SetGoArtKit(artkit);
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp
index 738c6ab685f..64b7aa88321 100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp
@@ -164,11 +164,11 @@ bool OutdoorPvPZM::Update(uint32 diff)
if (changed)
{
if (m_AllianceTowersControlled == ZM_NUM_BEACONS)
- m_GraveYard->SetBeaconState(ALLIANCE);
+ m_Graveyard->SetBeaconState(ALLIANCE);
else if (m_HordeTowersControlled == ZM_NUM_BEACONS)
- m_GraveYard->SetBeaconState(HORDE);
+ m_Graveyard->SetBeaconState(HORDE);
else
- m_GraveYard->SetBeaconState(0);
+ m_Graveyard->SetBeaconState(0);
}
return changed;
}
@@ -177,12 +177,12 @@ void OutdoorPvPZM::HandlePlayerEnterZone(Player* player, uint32 zone)
{
if (player->GetTeam() == ALLIANCE)
{
- if (m_GraveYard->GetGraveYardState() & ZM_GRAVEYARD_A)
+ if (m_Graveyard->GetGraveyardState() & ZM_GRAVEYARD_A)
player->CastSpell(player, ZM_CAPTURE_BUFF, true);
}
else
{
- if (m_GraveYard->GetGraveYardState() & ZM_GRAVEYARD_H)
+ if (m_Graveyard->GetGraveyardState() & ZM_GRAVEYARD_H)
player->CastSpell(player, ZM_CAPTURE_BUFF, true);
}
OutdoorPvP::HandlePlayerEnterZone(player, zone);
@@ -201,7 +201,7 @@ void OutdoorPvPZM::HandlePlayerLeaveZone(Player* player, uint32 zone)
OutdoorPvPZM::OutdoorPvPZM()
{
m_TypeId = OUTDOOR_PVP_ZM;
- m_GraveYard = NULL;
+ m_Graveyard = nullptr;
m_AllianceTowersControlled = 0;
m_HordeTowersControlled = 0;
}
@@ -219,8 +219,8 @@ bool OutdoorPvPZM::SetupOutdoorPvP()
AddCapturePoint(new OPvPCapturePointZM_Beacon(this, ZM_BEACON_WEST));
AddCapturePoint(new OPvPCapturePointZM_Beacon(this, ZM_BEACON_EAST));
- m_GraveYard = new OPvPCapturePointZM_GraveYard(this);
- AddCapturePoint(m_GraveYard); // though the update function isn't used, the handleusego is!
+ m_Graveyard = new OPvPCapturePointZM_Graveyard(this);
+ AddCapturePoint(m_Graveyard); // though the update function isn't used, the handleusego is!
return true;
}
@@ -236,36 +236,36 @@ void OutdoorPvPZM::HandleKillImpl(Player* player, Unit* killed)
player->CastSpell(player, ZM_HordePlayerKillReward, true);
}
-bool OPvPCapturePointZM_GraveYard::Update(uint32 /*diff*/)
+bool OPvPCapturePointZM_Graveyard::Update(uint32 /*diff*/)
{
bool retval = m_State != m_OldState;
m_State = m_OldState;
return retval;
}
-int32 OPvPCapturePointZM_GraveYard::HandleOpenGo(Player* player, GameObject* go)
+int32 OPvPCapturePointZM_Graveyard::HandleOpenGo(Player* player, GameObject* go)
{
int32 retval = OPvPCapturePoint::HandleOpenGo(player, go);
if (retval >= 0)
{
- if (player->HasAura(ZM_BATTLE_STANDARD_A) && m_GraveYardState != ZM_GRAVEYARD_A)
+ if (player->HasAura(ZM_BATTLE_STANDARD_A) && m_GraveyardState != ZM_GRAVEYARD_A)
{
- m_GraveYardState = ZM_GRAVEYARD_A;
+ m_GraveyardState = ZM_GRAVEYARD_A;
DelObject(0); // only one gotype is used in the whole outdoor pvp, no need to call it a constant
AddObject(0, ZM_Banner_A.entry, ZM_Banner_A.map, ZM_Banner_A.pos, ZM_Banner_A.rot);
- sObjectMgr->RemoveGraveYardLink(ZM_GRAVEYARD_ID, ZM_GRAVEYARD_ZONE, HORDE); // rem gy
- sObjectMgr->AddGraveYardLink(ZM_GRAVEYARD_ID, ZM_GRAVEYARD_ZONE, ALLIANCE, false); // add gy
+ sObjectMgr->RemoveGraveyardLink(ZM_GRAVEYARD_ID, ZM_GRAVEYARD_ZONE, HORDE); // rem gy
+ sObjectMgr->AddGraveyardLink(ZM_GRAVEYARD_ID, ZM_GRAVEYARD_ZONE, ALLIANCE, false); // add gy
m_PvP->TeamApplyBuff(TEAM_ALLIANCE, ZM_CAPTURE_BUFF);
player->RemoveAurasDueToSpell(ZM_BATTLE_STANDARD_A);
m_PvP->SendDefenseMessage(ZM_GRAVEYARD_ZONE, TEXT_TWIN_SPIRE_RUINS_TAKEN_ALLIANCE);
}
- else if (player->HasAura(ZM_BATTLE_STANDARD_H) && m_GraveYardState != ZM_GRAVEYARD_H)
+ else if (player->HasAura(ZM_BATTLE_STANDARD_H) && m_GraveyardState != ZM_GRAVEYARD_H)
{
- m_GraveYardState = ZM_GRAVEYARD_H;
+ m_GraveyardState = ZM_GRAVEYARD_H;
DelObject(0); // only one gotype is used in the whole outdoor pvp, no need to call it a constant
AddObject(0, ZM_Banner_H.entry, ZM_Banner_H.map, ZM_Banner_H.pos, ZM_Banner_H.rot);
- sObjectMgr->RemoveGraveYardLink(ZM_GRAVEYARD_ID, ZM_GRAVEYARD_ZONE, ALLIANCE); // rem gy
- sObjectMgr->AddGraveYardLink(ZM_GRAVEYARD_ID, ZM_GRAVEYARD_ZONE, HORDE, false); // add gy
+ sObjectMgr->RemoveGraveyardLink(ZM_GRAVEYARD_ID, ZM_GRAVEYARD_ZONE, ALLIANCE); // rem gy
+ sObjectMgr->AddGraveyardLink(ZM_GRAVEYARD_ID, ZM_GRAVEYARD_ZONE, HORDE, false); // add gy
m_PvP->TeamApplyBuff(TEAM_HORDE, ZM_CAPTURE_BUFF);
player->RemoveAurasDueToSpell(ZM_BATTLE_STANDARD_H);
m_PvP->SendDefenseMessage(ZM_GRAVEYARD_ZONE, TEXT_TWIN_SPIRE_RUINS_TAKEN_HORDE);
@@ -275,11 +275,11 @@ int32 OPvPCapturePointZM_GraveYard::HandleOpenGo(Player* player, GameObject* go)
return retval;
}
-OPvPCapturePointZM_GraveYard::OPvPCapturePointZM_GraveYard(OutdoorPvP* pvp)
+OPvPCapturePointZM_Graveyard::OPvPCapturePointZM_Graveyard(OutdoorPvP* pvp)
: OPvPCapturePoint(pvp)
{
m_BothControllingFaction = 0;
- m_GraveYardState = ZM_GRAVEYARD_N;
+ m_GraveyardState = ZM_GRAVEYARD_N;
m_FlagCarrierGUID.Clear();
// add field scouts here
AddCreature(ZM_ALLIANCE_FIELD_SCOUT, ZM_AllianceFieldScout.entry, ZM_AllianceFieldScout.map, ZM_AllianceFieldScout.pos);
@@ -288,11 +288,11 @@ OPvPCapturePointZM_GraveYard::OPvPCapturePointZM_GraveYard(OutdoorPvP* pvp)
AddObject(0, ZM_Banner_N.entry, ZM_Banner_N.map, ZM_Banner_N.pos, ZM_Banner_N.rot);
}
-void OPvPCapturePointZM_GraveYard::UpdateTowerState()
+void OPvPCapturePointZM_Graveyard::UpdateTowerState()
{
- m_PvP->SendUpdateWorldState(ZM_MAP_GRAVEYARD_N, uint32((m_GraveYardState & ZM_GRAVEYARD_N) != 0));
- m_PvP->SendUpdateWorldState(ZM_MAP_GRAVEYARD_H, uint32((m_GraveYardState & ZM_GRAVEYARD_H) != 0));
- m_PvP->SendUpdateWorldState(ZM_MAP_GRAVEYARD_A, uint32((m_GraveYardState & ZM_GRAVEYARD_A) != 0));
+ m_PvP->SendUpdateWorldState(ZM_MAP_GRAVEYARD_N, uint32((m_GraveyardState & ZM_GRAVEYARD_N) != 0));
+ m_PvP->SendUpdateWorldState(ZM_MAP_GRAVEYARD_H, uint32((m_GraveyardState & ZM_GRAVEYARD_H) != 0));
+ m_PvP->SendUpdateWorldState(ZM_MAP_GRAVEYARD_A, uint32((m_GraveyardState & ZM_GRAVEYARD_A) != 0));
m_PvP->SendUpdateWorldState(ZM_MAP_ALLIANCE_FLAG_READY, uint32(m_BothControllingFaction == ALLIANCE));
m_PvP->SendUpdateWorldState(ZM_MAP_ALLIANCE_FLAG_NOT_READY, uint32(m_BothControllingFaction != ALLIANCE));
@@ -300,11 +300,11 @@ void OPvPCapturePointZM_GraveYard::UpdateTowerState()
m_PvP->SendUpdateWorldState(ZM_MAP_HORDE_FLAG_NOT_READY, uint32(m_BothControllingFaction != HORDE));
}
-void OPvPCapturePointZM_GraveYard::FillInitialWorldStates(WorldPacket &data)
+void OPvPCapturePointZM_Graveyard::FillInitialWorldStates(WorldPacket &data)
{
- data << ZM_MAP_GRAVEYARD_N << uint32((m_GraveYardState & ZM_GRAVEYARD_N) != 0);
- data << ZM_MAP_GRAVEYARD_H << uint32((m_GraveYardState & ZM_GRAVEYARD_H) != 0);
- data << ZM_MAP_GRAVEYARD_A << uint32((m_GraveYardState & ZM_GRAVEYARD_A) != 0);
+ data << ZM_MAP_GRAVEYARD_N << uint32((m_GraveyardState & ZM_GRAVEYARD_N) != 0);
+ data << ZM_MAP_GRAVEYARD_H << uint32((m_GraveyardState & ZM_GRAVEYARD_H) != 0);
+ data << ZM_MAP_GRAVEYARD_A << uint32((m_GraveyardState & ZM_GRAVEYARD_A) != 0);
data << ZM_MAP_ALLIANCE_FLAG_READY << uint32(m_BothControllingFaction == ALLIANCE);
data << ZM_MAP_ALLIANCE_FLAG_NOT_READY << uint32(m_BothControllingFaction != ALLIANCE);
@@ -312,7 +312,7 @@ void OPvPCapturePointZM_GraveYard::FillInitialWorldStates(WorldPacket &data)
data << ZM_MAP_HORDE_FLAG_NOT_READY << uint32(m_BothControllingFaction != HORDE);
}
-void OPvPCapturePointZM_GraveYard::SetBeaconState(uint32 controlling_faction)
+void OPvPCapturePointZM_Graveyard::SetBeaconState(uint32 controlling_faction)
{
// nothing to do here
if (m_BothControllingFaction == controlling_faction)
@@ -323,20 +323,20 @@ void OPvPCapturePointZM_GraveYard::SetBeaconState(uint32 controlling_faction)
{
case ALLIANCE:
// if ally already controls the gy and taken back both beacons, return, nothing to do for us
- if (m_GraveYardState & ZM_GRAVEYARD_A)
+ if (m_GraveyardState & ZM_GRAVEYARD_A)
return;
// ally doesn't control the gy, but controls the side beacons -> add gossip option, add neutral banner
break;
case HORDE:
// if horde already controls the gy and taken back both beacons, return, nothing to do for us
- if (m_GraveYardState & ZM_GRAVEYARD_H)
+ if (m_GraveyardState & ZM_GRAVEYARD_H)
return;
// horde doesn't control the gy, but controls the side beacons -> add gossip option, add neutral banner
break;
default:
// if the graveyard is not neutral, then leave it that way
// if the graveyard is neutral, then we have to dispel the buff from the flag carrier
- if (m_GraveYardState & ZM_GRAVEYARD_N)
+ if (m_GraveyardState & ZM_GRAVEYARD_N)
{
// gy was neutral, thus neutral banner was spawned, it is possible that someone was taking the flag to the gy
if (m_FlagCarrierGUID)
@@ -357,21 +357,21 @@ void OPvPCapturePointZM_GraveYard::SetBeaconState(uint32 controlling_faction)
UpdateTowerState();
}
-bool OPvPCapturePointZM_GraveYard::CanTalkTo(Player* player, Creature* c, GossipMenuItems const& /*gso*/)
+bool OPvPCapturePointZM_Graveyard::CanTalkTo(Player* player, Creature* c, GossipMenuItems const& /*gso*/)
{
std::map<uint32, uint32>::iterator itr = m_CreatureTypes.find(c->GetSpawnId());
if (itr != m_CreatureTypes.end())
{
- if (itr->second == ZM_ALLIANCE_FIELD_SCOUT && player->GetTeam() == ALLIANCE && m_BothControllingFaction == ALLIANCE && !m_FlagCarrierGUID && m_GraveYardState != ZM_GRAVEYARD_A)
+ if (itr->second == ZM_ALLIANCE_FIELD_SCOUT && player->GetTeam() == ALLIANCE && m_BothControllingFaction == ALLIANCE && !m_FlagCarrierGUID && m_GraveyardState != ZM_GRAVEYARD_A)
return true;
- else if (itr->second == ZM_HORDE_FIELD_SCOUT && player->GetTeam() == HORDE && m_BothControllingFaction == HORDE && !m_FlagCarrierGUID && m_GraveYardState != ZM_GRAVEYARD_H)
+ else if (itr->second == ZM_HORDE_FIELD_SCOUT && player->GetTeam() == HORDE && m_BothControllingFaction == HORDE && !m_FlagCarrierGUID && m_GraveyardState != ZM_GRAVEYARD_H)
return true;
}
return false;
}
-bool OPvPCapturePointZM_GraveYard::HandleGossipOption(Player* player, Creature* creature, uint32 /*gossipid*/)
+bool OPvPCapturePointZM_Graveyard::HandleGossipOption(Player* player, Creature* creature, uint32 /*gossipid*/)
{
std::map<uint32, uint32>::iterator itr = m_CreatureTypes.find(creature->GetSpawnId());
@@ -397,7 +397,7 @@ bool OPvPCapturePointZM_GraveYard::HandleGossipOption(Player* player, Creature*
return false;
}
-bool OPvPCapturePointZM_GraveYard::HandleDropFlag(Player* /*player*/, uint32 spellId)
+bool OPvPCapturePointZM_Graveyard::HandleDropFlag(Player* /*player*/, uint32 spellId)
{
switch (spellId)
{
@@ -411,9 +411,9 @@ bool OPvPCapturePointZM_GraveYard::HandleDropFlag(Player* /*player*/, uint32 spe
return false;
}
-uint32 OPvPCapturePointZM_GraveYard::GetGraveYardState() const
+uint32 OPvPCapturePointZM_Graveyard::GetGraveyardState() const
{
- return m_GraveYardState;
+ return m_GraveyardState;
}
uint32 OutdoorPvPZM::GetAllianceTowersControlled() const
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.h b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.h
index 77301b96328..e042c47a64c 100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.h
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.h
@@ -114,17 +114,17 @@ class OPvPCapturePointZM_Beacon : public OPvPCapturePoint
uint32 m_TowerState;
};
-enum ZM_GraveYardState
+enum ZM_GraveyardState
{
ZM_GRAVEYARD_N = 1,
ZM_GRAVEYARD_A = 2,
ZM_GRAVEYARD_H = 4
};
-class OPvPCapturePointZM_GraveYard : public OPvPCapturePoint
+class OPvPCapturePointZM_Graveyard : public OPvPCapturePoint
{
public:
- OPvPCapturePointZM_GraveYard(OutdoorPvP* pvp);
+ OPvPCapturePointZM_Graveyard(OutdoorPvP* pvp);
bool Update(uint32 diff) override;
@@ -144,10 +144,10 @@ class OPvPCapturePointZM_GraveYard : public OPvPCapturePoint
bool CanTalkTo(Player* player, Creature* creature, GossipMenuItems const& gso) override;
- uint32 GetGraveYardState() const;
+ uint32 GetGraveyardState() const;
private:
- uint32 m_GraveYardState;
+ uint32 m_GraveyardState;
protected:
uint32 m_BothControllingFaction;
@@ -180,7 +180,7 @@ class OutdoorPvPZM : public OutdoorPvP
void SetHordeTowersControlled(uint32 count);
private:
- OPvPCapturePointZM_GraveYard * m_GraveYard;
+ OPvPCapturePointZM_Graveyard * m_Graveyard;
uint32 m_AllianceTowersControlled;
uint32 m_HordeTowersControlled;
diff --git a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/auchenai_crypts.h b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/auchenai_crypts.h
index 18354890ba9..5bc6d049f5a 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,10 +32,10 @@ enum ACDataTypes
DATA_EXARCH_MALADAAR = 1
};
-template<class AI>
-AI* GetAuchenaiCryptsAI(Creature* creature)
+template <class AI, class T>
+inline AI* GetAuchenaiCryptsAI(T* obj)
{
- return GetInstanceAI<AI>(creature, ACScriptName);
+ return GetInstanceAI<AI>(obj, ACScriptName);
}
#endif // AUCHENAI_CRYPTS_H_
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 386d65c31ce..a6ef54233bb 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 1037fcebcf8..b59cf598454 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
{
@@ -55,7 +58,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_shirrak_the_dead_watcherAI(creature);
+ return GetAuchenaiCryptsAI<boss_shirrak_the_dead_watcherAI>(creature);
}
struct boss_shirrak_the_dead_watcherAI : public ScriptedAI
@@ -109,7 +112,7 @@ public:
if (Inhibitmagic_Timer <= diff)
{
float dist;
- Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers();
+ Map::PlayerList const& PlayerList = me->GetMap()->GetPlayers();
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
if (Player* i_pl = i->GetSource())
if (i_pl->IsAlive() && (dist = i_pl->GetDistance(me)) < 45)
@@ -172,7 +175,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_focus_fireAI(creature);
+ return GetAuchenaiCryptsAI<npc_focus_fireAI>(creature);
}
struct npc_focus_fireAI : public ScriptedAI
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..6623feead32 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,9 @@ SDCategory: Auchindoun, Mana Tombs
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "mana_tombs.h"
+#include "MotionMaster.h"
+#include "ScriptedCreature.h"
enum Yells
{
@@ -259,7 +260,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 +325,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 +381,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/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..0a48696cfbf 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,10 +34,10 @@ enum MTDataTypes
DATA_YOR = 3
};
-template<class AI>
-AI* GetManaTombsAI(Creature* creature)
+template <class AI, class T>
+inline AI* GetManaTombsAI(T* obj)
{
- return GetInstanceAI<AI>(creature, MTScriptName);
+ return GetInstanceAI<AI>(obj, MTScriptName);
}
#endif // MANA_TOMBS_H_
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..c97fa51a502 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
@@ -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..40882ea933b 100644
--- a/src/server/scripts/Outland/Auchindoun/SethekkHalls/instance_sethekk_halls.cpp
+++ b/src/server/scripts/Outland/Auchindoun/SethekkHalls/instance_sethekk_halls.cpp
@@ -16,13 +16,16 @@
*/
#include "ScriptMgr.h"
+#include "Creature.h"
+#include "GameObject.h"
#include "InstanceScript.h"
+#include "Map.h"
#include "sethekk_halls.h"
DoorData const doorData[] =
{
{ GO_IKISS_DOOR, DATA_TALON_KING_IKISS, DOOR_TYPE_PASSAGE },
- { 0, 0, DOOR_TYPE_ROOM } // END
+ { 0, 0, DOOR_TYPE_ROOM } // END
};
ObjectData const gameObjectData[] =
diff --git a/src/server/scripts/Outland/Auchindoun/SethekkHalls/sethekk_halls.h b/src/server/scripts/Outland/Auchindoun/SethekkHalls/sethekk_halls.h
index 3471b23daa2..39f8aa9511c 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,10 +48,10 @@ enum SHGameObjectIds
GO_TALON_KING_COFFER = 187372
};
-template<class AI>
-AI* GetSethekkHallsAI(Creature* creature)
+template <class AI, class T>
+inline AI* GetSethekkHallsAI(T* obj)
{
- return GetInstanceAI<AI>(creature, SHScriptName);
+ return GetInstanceAI<AI>(obj, SHScriptName);
}
#endif // SETHEKK_HALLS_H_
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..c12dd178729 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"
@@ -115,7 +115,7 @@ class boss_ambassador_hellmaw : public CreatureScript
me->RemoveAurasDueToSpell(SPELL_BANISH);
Talk(SAY_INTRO);
- Start(true, false, ObjectGuid::Empty, NULL, false, true);
+ Start(true, false, ObjectGuid::Empty, nullptr, false, true);
}
void EnterCombat(Unit* /*who*/) override
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 2c9eba30a12..35276572243 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,14 @@ Category: Auchindoun, Shadow Labyrinth
*/
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptedCreature.h"
#include "shadow_labyrinth.h"
-#include "Player.h"
+#include "TemporarySummon.h"
enum GrandmasterVorpil
{
@@ -182,7 +187,7 @@ class boss_grandmaster_vorpil : public CreatureScript
break;
case EVENT_DRAW_SHADOWS:
{
- Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers();
+ Map::PlayerList const& PlayerList = me->GetMap()->GetPlayers();
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
if (Player* i_pl = i->GetSource())
if (i_pl->IsAlive() && !i_pl->HasAura(SPELL_BANISH))
diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp
index ac9ef77cd82..896deca41f7 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,14 +189,12 @@ 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*/)
{
- GetCaster()->CastSpell((Unit*)NULL, SPELL_SONIC_BOOM_EFFECT, true);
+ GetCaster()->CastSpell((Unit*)nullptr, SPELL_SONIC_BOOM_EFFECT, true);
}
void Register() override
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 8b830ccad65..cbfd8b2c197 100644
--- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/shadow_labyrinth.cpp
+++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/shadow_labyrinth.cpp
@@ -36,9 +36,7 @@ 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*/)
diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/shadow_labyrinth.h b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/shadow_labyrinth.h
index 48334af4ab9..0c7e7b5afca 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,10 +56,10 @@ enum SLMisc
ACTION_AMBASSADOR_HELLMAW_BANISH = 2,
};
-template<class AI>
-AI* GetShadowLabyrinthAI(Creature* creature)
+template <class AI, class T>
+inline AI* GetShadowLabyrinthAI(T* obj)
{
- return GetInstanceAI<AI>(creature, SLScriptName);
+ return GetInstanceAI<AI>(obj, SLScriptName);
}
#endif // SHADOW_LABYRINTH_H_
diff --git a/src/server/scripts/Outland/BlackTemple/black_temple.cpp b/src/server/scripts/Outland/BlackTemple/black_temple.cpp
index 042cff87618..08b00caa519 100644
--- a/src/server/scripts/Outland/BlackTemple/black_temple.cpp
+++ b/src/server/scripts/Outland/BlackTemple/black_temple.cpp
@@ -16,10 +16,11 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "black_temple.h"
-#include "SpellScript.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
#include "SpellAuraEffects.h"
+#include "SpellScript.h"
enum Spells
{
@@ -137,11 +138,11 @@ public:
{
for (ObjectGuid guid : _bloodmageList)
if (Creature* bloodmage = ObjectAccessor::GetCreature(*me, guid))
- bloodmage->CastSpell((Unit*)NULL, SPELL_SUMMON_CHANNEL);
+ bloodmage->CastSpell((Unit*)nullptr, SPELL_SUMMON_CHANNEL);
for (ObjectGuid guid : _deathshaperList)
if (Creature* deathshaper = ObjectAccessor::GetCreature(*me, guid))
- deathshaper->CastSpell((Unit*)NULL, SPELL_SUMMON_CHANNEL);
+ deathshaper->CastSpell((Unit*)nullptr, SPELL_SUMMON_CHANNEL);
_events.ScheduleEvent(EVENT_SET_CHANNELERS, 12000);
@@ -298,9 +299,7 @@ class spell_illidari_nightlord_shadow_inferno : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SHADOW_INFERNO_DAMAGE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SHADOW_INFERNO_DAMAGE });
}
void OnPeriodic(AuraEffect const* aurEffect)
diff --git a/src/server/scripts/Outland/BlackTemple/black_temple.h b/src/server/scripts/Outland/BlackTemple/black_temple.h
index b1c4b31ca63..bdade01ab33 100644
--- a/src/server/scripts/Outland/BlackTemple/black_temple.h
+++ b/src/server/scripts/Outland/BlackTemple/black_temple.h
@@ -18,6 +18,8 @@
#ifndef BLACK_TEMPLE_H_
#define BLACK_TEMPLE_H_
+#include "CreatureAIImpl.h"
+
#define BTScriptName "instance_black_temple"
#define DataHeader "BT"
@@ -138,8 +140,8 @@ enum BlackTempleMisc
ACTION_OPEN_DOOR = 4
};
-template<class AI, class T>
-AI* GetBlackTempleAI(T* obj)
+template <class AI, class T>
+inline AI* GetBlackTempleAI(T* obj)
{
return GetInstanceAI<AI>(obj, BTScriptName);
}
diff --git a/src/server/scripts/Outland/BlackTemple/boss_gurtogg_bloodboil.cpp b/src/server/scripts/Outland/BlackTemple/boss_gurtogg_bloodboil.cpp
index 7d851ec8bf7..085ea796f05 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_gurtogg_bloodboil.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_gurtogg_bloodboil.cpp
@@ -16,12 +16,12 @@
*/
#include "ScriptMgr.h"
+#include "black_temple.h"
+#include "GridNotifiers.h"
+#include "ObjectAccessor.h"
+#include "PassiveAI.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
-#include "PassiveAI.h"
-#include "GridNotifiers.h"
-
-#include "black_temple.h"
enum Says
{
@@ -381,9 +381,7 @@ public:
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_FEL_RAGE_TARGET))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_FEL_RAGE_TARGET });
}
void FilterTargets(std::list<WorldObject*>& targets)
diff --git a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp
index 84ce4d42354..a7bfbf317c3 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp
@@ -16,15 +16,20 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
-#include "PassiveAI.h"
#include "black_temple.h"
+#include "GridNotifiersImpl.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
+#include "PassiveAI.h"
#include "Player.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
+#include "SpellAuraEffects.h"
#include "SpellInfo.h"
#include "SpellScript.h"
-#include "SpellAuraEffects.h"
-#include "GridNotifiersImpl.h"
+#include "TemporarySummon.h"
enum IllidanSay
{
@@ -676,7 +681,7 @@ public:
void EnterEvadeModeIfNeeded()
{
- Map::PlayerList const &players = me->GetMap()->GetPlayers();
+ Map::PlayerList const& players = me->GetMap()->GetPlayers();
for (Map::PlayerList::const_iterator i = players.begin(); i != players.end(); ++i)
if (Player* player = i->GetSource())
if (player->IsAlive() && !player->IsGameMaster() && CheckBoundary(player))
@@ -1889,9 +1894,7 @@ class spell_illidan_akama_door_channel : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_ARCANE_EXPLOSION))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_ARCANE_EXPLOSION });
}
void OnRemoveDummy(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -1928,9 +1931,7 @@ class spell_illidan_draw_soul : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DRAW_SOUL_HEAL))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DRAW_SOUL_HEAL });
}
void HandleScriptEffect(SpellEffIndex effIndex)
@@ -1964,9 +1965,7 @@ class spell_illidan_parasitic_shadowfiend : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_PARASITIC_SHADOWFIENDS))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SUMMON_PARASITIC_SHADOWFIENDS });
}
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -2028,9 +2027,7 @@ class spell_illidan_tear_of_azzinoth_channel : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_UNCAGED_WRATH))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_UNCAGED_WRATH });
}
void OnPeriodic(AuraEffect const* /*aurEff*/)
@@ -2071,9 +2068,7 @@ class spell_illidan_flame_blast : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_BLAZE_SUMMON))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_BLAZE_SUMMON });
}
void HandleBlaze(SpellEffIndex /*effIndex*/)
@@ -2135,9 +2130,7 @@ class spell_illidan_agonizing_flames : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_AGONIZING_FLAMES))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_AGONIZING_FLAMES });
}
void FilterTargets(std::list<WorldObject*>& targets)
@@ -2180,9 +2173,7 @@ class spell_illidan_demon_transform1 : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DEMON_TRANSFORM_2))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DEMON_TRANSFORM_2 });
}
void OnPeriodic(AuraEffect const* /*aurEff*/)
@@ -2216,10 +2207,7 @@ class spell_illidan_demon_transform2 : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DEMON_FORM)
- || !sSpellMgr->GetSpellInfo(SPELL_DEMON_TRANSFORM_3))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DEMON_FORM, SPELL_DEMON_TRANSFORM_3 });
}
void OnPeriodic(AuraEffect const* aurEff)
@@ -2267,9 +2255,7 @@ class spell_illidan_flame_burst : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_FLAME_BURST_EFFECT))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_FLAME_BURST_EFFECT });
}
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
@@ -2301,9 +2287,7 @@ class spell_illidan_find_target : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PARALYZE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_PARALYZE });
}
void FilterTargets(std::list<WorldObject*>& targets)
@@ -2420,9 +2404,7 @@ class spell_illidan_caged : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_CAGED_DEBUFF))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_CAGED_DEBUFF });
}
void OnPeriodic(AuraEffect const* /*aurEff*/)
diff --git a/src/server/scripts/Outland/BlackTemple/boss_illidari_council.cpp b/src/server/scripts/Outland/BlackTemple/boss_illidari_council.cpp
index e19b0189147..245f7960628 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_illidari_council.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_illidari_council.cpp
@@ -16,15 +16,14 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "SpellScript.h"
-#include "SpellAuraEffects.h"
#include "black_temple.h"
-#include "Cell.h"
#include "CellImpl.h"
-#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
+#include "InstanceScript.h"
#include "PassiveAI.h"
+#include "ScriptedCreature.h"
+#include "SpellAuraEffects.h"
+#include "SpellScript.h"
enum Says
{
@@ -631,9 +630,7 @@ class spell_illidari_council_empyreal_balance : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_BALANCE_OF_POWER))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_BALANCE_OF_POWER });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -698,9 +695,7 @@ class spell_illidari_council_balance_of_power : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SHARED_RULE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SHARED_RULE });
}
void Absorb(AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& /*absorbAmount*/)
@@ -734,9 +729,7 @@ class spell_illidari_council_deadly_strike : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DEADLY_POISON))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DEADLY_POISON });
}
void OnTrigger(AuraEffect const* aurEff)
@@ -771,9 +764,7 @@ class spell_illidari_council_deadly_poison : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_ENVENOM))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_ENVENOM });
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -806,12 +797,10 @@ class spell_illidari_council_reflective_shield : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_REFLECTIVE_SHIELD_DAMAGE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_REFLECTIVE_SHIELD_DAMAGE });
}
- void OnAbsorb(AuraEffect* aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount)
+ void OnAbsorb(AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount)
{
Unit* target = GetTarget();
if (dmgInfo.GetAttacker() == target)
@@ -845,11 +834,12 @@ class spell_illidari_council_judgement : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_JUDGEMENT_OF_BLOOD)
- || !sSpellMgr->GetSpellInfo(SPELL_JUDGEMENT_OF_COMMAND)
- || !sSpellMgr->GetSpellInfo(SPELL_JUDGEMENT_PRIMER))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_JUDGEMENT_OF_BLOOD,
+ SPELL_JUDGEMENT_OF_COMMAND,
+ SPELL_JUDGEMENT_PRIMER
+ });
}
void HandleScript(SpellEffIndex /*effIndex*/)
@@ -893,10 +883,11 @@ class spell_illidari_council_seal : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SEAL_OF_COMMAND)
- || !sSpellMgr->GetSpellInfo(SPELL_SEAL_OF_BLOOD))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_SEAL_OF_COMMAND,
+ SPELL_SEAL_OF_BLOOD
+ });
}
void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
diff --git a/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp b/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp
index d1993aae981..38fa695c5db 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp
@@ -218,10 +218,11 @@ class spell_mother_shahraz_fatal_attraction : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SABER_LASH_IMMUNITY)
- || !sSpellMgr->GetSpellInfo(SPELL_FATAL_ATTRACTION))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_SABER_LASH_IMMUNITY,
+ SPELL_FATAL_ATTRACTION
+ });
}
void FilterTargets(std::list<WorldObject*>& targets)
@@ -265,9 +266,7 @@ class spell_mother_shahraz_fatal_attraction_link : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_FATAL_ATTRACTION_DAMAGE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_FATAL_ATTRACTION_DAMAGE });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -299,9 +298,7 @@ class spell_mother_shahraz_saber_lash : public SpellScriptLoader
bool Validate(SpellInfo const* spellInfo) override
{
- if (!sSpellMgr->GetSpellInfo(spellInfo->Effects[EFFECT_1].TriggerSpell))
- return false;
- return true;
+ return ValidateSpellInfo({ spellInfo->Effects[EFFECT_1].TriggerSpell });
}
void OnTrigger(AuraEffect const* aurEff)
@@ -340,9 +337,7 @@ class spell_mother_shahraz_generic_periodic : public SpellScriptLoader
bool Validate(SpellInfo const* spellInfo) override
{
- if (!sSpellMgr->GetSpellInfo(spellInfo->Effects[EFFECT_0].TriggerSpell))
- return false;
- return true;
+ return ValidateSpellInfo({ spellInfo->Effects[EFFECT_0].TriggerSpell });
}
void OnTrigger(AuraEffect const* aurEff)
@@ -378,10 +373,7 @@ class spell_mother_shahraz_random_periodic : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- for (uint32 spellId : RandomBeam)
- if (!sSpellMgr->GetSpellInfo(spellId))
- return false;
- return true;
+ return ValidateSpellInfo(RandomBeam);
}
void OnPeriodic(AuraEffect const* /*aurEffect*/)
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 d5f52b2fc7c..ae3d961ca68 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp
@@ -16,12 +16,14 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "black_temple.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
+#include "Player.h"
+#include "ScriptedCreature.h"
#include "Spell.h"
-#include "SpellScript.h"
#include "SpellAuraEffects.h"
-#include "Player.h"
+#include "SpellScript.h"
enum Says
{
@@ -727,9 +729,7 @@ class spell_reliquary_of_souls_aura_of_desire : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_AURA_OF_DESIRE_DAMAGE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_AURA_OF_DESIRE_DAMAGE });
}
void OnProcSpell(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -809,9 +809,7 @@ class spell_reliquary_of_souls_spite : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SPITE_DAMAGE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SPITE_DAMAGE });
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
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 c2131a46696..231fa47fbda 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 "GridNotifiers.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "PassiveAI.h"
+#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
-#include "GridNotifiers.h"
-#include "black_temple.h"
-#include "SpellScript.h"
#include "SpellAuraEffects.h"
+#include "SpellScript.h"
+#include "TemporarySummon.h"
enum Says
{
@@ -286,7 +290,7 @@ public:
void EnterEvadeModeIfNeeded()
{
- Map::PlayerList const &players = me->GetMap()->GetPlayers();
+ Map::PlayerList const& players = me->GetMap()->GetPlayers();
for (Map::PlayerList::const_iterator i = players.begin(); i != players.end(); ++i)
if (Player* player = i->GetSource())
if (player->IsAlive() && !player->IsGameMaster() && CheckBoundary(player))
@@ -1200,9 +1204,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 67dfa42b543..e2ec4990ccd 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp
@@ -16,9 +16,11 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "PassiveAI.h"
#include "black_temple.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
+#include "PassiveAI.h"
+#include "ScriptedCreature.h"
enum Texts
{
diff --git a/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp b/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp
index 0e5d5d26f73..4061eed85ec 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp
@@ -16,12 +16,15 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "black_temple.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "PassiveAI.h"
#include "Player.h"
-#include "SpellScript.h"
+#include "ScriptedCreature.h"
#include "SpellAuraEffects.h"
+#include "SpellScript.h"
enum Says
{
@@ -388,15 +391,16 @@ class spell_teron_gorefiend_shadow_of_death : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_SPIRIT)
- || !sSpellMgr->GetSpellInfo(SPELL_POSSESS_SPIRIT_IMMUNE)
- || !sSpellMgr->GetSpellInfo(SPELL_SPIRITUAL_VENGEANCE)
- || !sSpellMgr->GetSpellInfo(SPELL_SUMMON_SKELETRON_1)
- || !sSpellMgr->GetSpellInfo(SPELL_SUMMON_SKELETRON_2)
- || !sSpellMgr->GetSpellInfo(SPELL_SUMMON_SKELETRON_3)
- || !sSpellMgr->GetSpellInfo(SPELL_SUMMON_SKELETRON_4))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_SUMMON_SPIRIT,
+ SPELL_POSSESS_SPIRIT_IMMUNE,
+ SPELL_SPIRITUAL_VENGEANCE,
+ SPELL_SUMMON_SKELETRON_1,
+ SPELL_SUMMON_SKELETRON_2,
+ SPELL_SUMMON_SKELETRON_3,
+ SPELL_SUMMON_SKELETRON_4
+ });
}
void Absorb(AuraEffect* /*aurEff*/, DamageInfo& /*dmgInfo*/, uint32& /*absorbAmount*/)
@@ -472,11 +476,12 @@ class spell_teron_gorefiend_shadow_of_death_remove : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SHADOW_OF_DEATH)
- || !sSpellMgr->GetSpellInfo(SPELL_POSSESS_SPIRIT_IMMUNE)
- || !sSpellMgr->GetSpellInfo(SPELL_SPIRITUAL_VENGEANCE))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_SHADOW_OF_DEATH,
+ SPELL_POSSESS_SPIRIT_IMMUNE,
+ SPELL_SPIRITUAL_VENGEANCE
+ });
}
void RemoveAuras()
diff --git a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp
index faaa2887e34..b49ad6e3f20 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp
@@ -16,13 +16,15 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "GameObjectAI.h"
#include "black_temple.h"
+#include "GameObjectAI.h"
+#include "GridNotifiers.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "ScriptedCreature.h"
#include "SpellInfo.h"
#include "SpellScript.h"
-#include "GridNotifiers.h"
enum Texts
{
@@ -88,7 +90,7 @@ public:
Talk(SAY_DEATH);
}
- void SpellHit(Unit* /*caster*/, const SpellInfo* spell) override
+ void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_HURL_SPINE && me->HasAura(SPELL_TIDAL_SHIELD))
{
@@ -140,7 +142,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.Repeat(Seconds(20), Seconds(25));
@@ -211,9 +213,7 @@ class spell_najentus_needle_spine : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_NEEDLE_SPINE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_NEEDLE_SPINE });
}
void FilterTargets(std::list<WorldObject*>& targets)
diff --git a/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp b/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp
index a12d920736d..f679428e44e 100644
--- a/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp
+++ b/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp
@@ -16,8 +16,13 @@
*/
#include "ScriptMgr.h"
-#include "InstanceScript.h"
+#include "AreaBoundary.h"
#include "black_temple.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/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp
index a468f9714ad..0554505ae74 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,12 @@ SDCategory: Coilfang Resevoir, Serpent Shrine Cavern
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "serpent_shrine.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "ScriptedEscortAI.h"
+#include "serpent_shrine.h"
+#include "TemporarySummon.h"
enum FathomlordKarathress
{
@@ -104,7 +107,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
@@ -303,7 +306,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
@@ -341,7 +344,7 @@ public:
Creature* Pet = ObjectAccessor::GetCreature(*me, SummonedPet);
if (Pet && Pet->IsAlive())
- Pet->DealDamage(Pet, Pet->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
+ Pet->DealDamage(Pet, Pet->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
SummonedPet.Clear();
@@ -447,7 +450,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
@@ -569,7 +572,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
@@ -674,9 +677,9 @@ public:
if (Heal_Timer <= diff)
{
// It can be cast on any of the mobs
- Unit* unit = NULL;
+ Unit* unit = nullptr;
- while (unit == NULL || !unit->IsAlive())
+ while (unit == nullptr || !unit->IsAlive())
unit = selectAdvisorUnit();
if (unit && unit->IsAlive())
@@ -691,7 +694,7 @@ public:
Unit* selectAdvisorUnit()
{
- Unit* unit = NULL;
+ Unit* unit = nullptr;
switch (rand32() % 4)
{
case 0:
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 a7b00d4ef70..c9727c196ef 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
@@ -217,7 +220,7 @@ public:
if (!beam)
{
SummonBeams();
- beam=true;
+ beam = true;
}
//Return since we have no target
if (!UpdateVictim())
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 6e2a0f3c192..e8259aa34dd 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp
@@ -24,10 +24,16 @@ SDCategory: Coilfang Resevoir, Serpent Shrine Cavern
EndScriptData */
#include "ScriptMgr.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptedCreature.h"
#include "serpent_shrine.h"
#include "Spell.h"
-#include "Player.h"
+#include "TemporarySummon.h"
#include "WorldSession.h"
enum LadyVashj
@@ -140,7 +146,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
@@ -257,7 +263,7 @@ public:
void EnterCombat(Unit* who) override
{
// remove old tainted cores to prevent cheating in phase 2
- Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers();
+ Map::PlayerList const& PlayerList = me->GetMap()->GetPlayers();
for (Map::PlayerList::const_iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr)
if (Player* player = itr->GetSource())
player->DestroyItemCount(31088, 1, true);
@@ -327,7 +333,7 @@ public:
}
else
{
- AggroTimer-=diff;
+ AggroTimer -= diff;
return;
}
}
@@ -555,7 +561,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 +656,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 +730,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 +832,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
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 3342b423f14..ced4aeb9fd3 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,14 @@ SDCategory: Coilfang Resevoir, Serpent Shrine Cavern
EndScriptData */
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptedCreature.h"
#include "serpent_shrine.h"
-#include "Player.h"
+#include "TemporarySummon.h"
enum LeotherasTheBlind
{
@@ -76,7 +81,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
@@ -153,7 +158,7 @@ public:
AttackStart(owner);
} else if (owner && owner->isDead())
{
- me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
+ me->DealDamage(me, me->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
return;
}
}
@@ -186,7 +191,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
@@ -327,7 +332,7 @@ public:
if (instance->GetGuidData(DATA_LEOTHERAS_EVENT_STARTER))
{
- Unit* victim = NULL;
+ Unit* victim = nullptr;
victim = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_LEOTHERAS_EVENT_STARTER));
if (victim)
me->getThreatManager().addThreat(victim, 1);
@@ -514,7 +519,7 @@ public:
{
//DoCastVictim(SPELL_CHAOS_BLAST, true);
int damage = 100;
- me->CastCustomSpell(me->GetVictim(), SPELL_CHAOS_BLAST, &damage, NULL, NULL, false, NULL, NULL, me->GetGUID());
+ me->CastCustomSpell(me->GetVictim(), SPELL_CHAOS_BLAST, &damage, nullptr, nullptr, false, nullptr, nullptr, me->GetGUID());
}
ChaosBlast_Timer = 3000;
} else ChaosBlast_Timer -= diff;
@@ -580,7 +585,7 @@ public:
//at this point he divides himself in two parts
CastConsumingMadness();
DespawnDemon();
- Creature* Copy = NULL;
+ Creature* Copy = nullptr;
Copy = DoSpawnCreature(DEMON_FORM, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 6000);
if (Copy)
{
@@ -608,7 +613,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
@@ -672,7 +677,7 @@ public:
{
//DoCastVictim(SPELL_CHAOS_BLAST, true);
int damage = 100;
- me->CastCustomSpell(me->GetVictim(), SPELL_CHAOS_BLAST, &damage, NULL, NULL, false, NULL, NULL, me->GetGUID());
+ me->CastCustomSpell(me->GetVictim(), SPELL_CHAOS_BLAST, &damage, nullptr, nullptr, false, nullptr, nullptr, me->GetGUID());
ChaosBlast_Timer = 3000;
}
} else ChaosBlast_Timer -= diff;
@@ -689,7 +694,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
@@ -758,7 +763,7 @@ public:
if (!me->IsInCombat() && instance->GetGuidData(DATA_LEOTHERAS_EVENT_STARTER))
{
- Unit* victim = NULL;
+ Unit* victim = nullptr;
victim = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_LEOTHERAS_EVENT_STARTER));
if (victim)
AttackStart(victim);
@@ -778,7 +783,7 @@ public:
if (Mindblast_Timer <= diff)
{
- Unit* target = NULL;
+ Unit* target = nullptr;
target = SelectTarget(SELECT_TARGET_RANDOM, 0);
if (target)DoCast(target, SPELL_MINDBLAST);
@@ -788,7 +793,7 @@ public:
if (Earthshock_Timer <= diff)
{
- Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers();
+ Map::PlayerList const& PlayerList = me->GetMap()->GetPlayers();
for (Map::PlayerList::const_iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr)
{
if (Player* i_pl = itr->GetSource())
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 7337763c298..e93ea5e7ec9 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp
@@ -24,11 +24,16 @@ SDCategory: The Lurker Below
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "GameObject.h"
#include "GameObjectAI.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "MotionMaster.h"
+#include "Player.h"
+#include "ScriptedCreature.h"
#include "serpent_shrine.h"
#include "Spell.h"
-#include "Player.h"
+#include "TemporarySummon.h"
enum Spells
{
@@ -84,7 +89,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
@@ -170,7 +175,6 @@ public:
}
void MoveInLineOfSight(Unit* who) override
-
{
if (!CanStartEvent) // boss is invisible, don't attack
return;
@@ -239,7 +243,9 @@ public:
DoCast(me, SPELL_SUBMERGE);
PhaseTimer = 60000; // 60secs submerged
Submerged = true;
- } else PhaseTimer-=diff;
+ }
+ else
+ PhaseTimer -= diff;
if (SpoutTimer <= diff)
{
@@ -250,19 +256,23 @@ public:
WhirlTimer = 20000; // whirl directly after spout
RotTimer = 20000;
return;
- } else SpoutTimer -= diff;
+ }
+ else
+ SpoutTimer -= diff;
// Whirl directly after a Spout and at random times
if (WhirlTimer <= diff)
{
WhirlTimer = 18000;
DoCast(me, SPELL_WHIRL);
- } else WhirlTimer -= diff;
+ }
+ else
+ WhirlTimer -= diff;
if (CheckTimer <= diff)//check if there are players in melee range
{
InRange = false;
- Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers();
+ Map::PlayerList const& PlayerList = me->GetMap()->GetPlayers();
if (!PlayerList.isEmpty())
{
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
@@ -272,11 +282,13 @@ public:
}
}
CheckTimer = 2000;
- } else CheckTimer -= diff;
+ }
+ else
+ CheckTimer -= diff;
if (RotTimer)
{
- Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers();
+ Map::PlayerList const& PlayerList = me->GetMap()->GetPlayers();
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
{
if (i->GetSource() && i->GetSource()->IsAlive() && me->HasInArc(diff/20000.f*float(M_PI)*2.f, i->GetSource()) && me->IsWithinDist(i->GetSource(), SPOUT_DIST) && !i->GetSource()->IsInWater())
@@ -292,7 +304,9 @@ public:
if (RotTimer <= diff)
{
RotTimer = 0;
- } else RotTimer -= diff;
+ }
+ else
+ RotTimer -= diff;
return;
}
@@ -304,7 +318,9 @@ public:
if (target)
DoCast(target, SPELL_GEYSER, true);
GeyserTimer = rand32() % 5000 + 15000;
- } else GeyserTimer -= diff;
+ }
+ else
+ GeyserTimer -= diff;
if (!InRange) // if on players in melee range cast Waterbolt
{
@@ -316,7 +332,9 @@ public:
if (target)
DoCast(target, SPELL_WATERBOLT, true);
WaterboltTimer = 3000;
- } else WaterboltTimer -= diff;
+ }
+ else
+ WaterboltTimer -= diff;
}
if (!UpdateVictim())
@@ -339,7 +357,9 @@ public:
SpoutTimer = 3000; // directly cast Spout after emerging!
PhaseTimer = 120000;
return;
- } else PhaseTimer-=diff;
+ }
+ else
+ PhaseTimer -= diff;
if (me->getThreatManager().getThreatList().empty()) // check if should evade
{
@@ -371,7 +391,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
@@ -421,7 +441,7 @@ public:
{
int bp0 = 1100;
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
- me->CastCustomSpell(target, SPELL_SHOOT, &bp0, NULL, NULL, true);
+ me->CastCustomSpell(target, SPELL_SHOOT, &bp0, nullptr, nullptr, true);
ShootBowTimer = 4000 + rand32() % 5000;
MultiShotTimer += 1500; // add global cooldown
} else ShootBowTimer -= diff;
@@ -460,7 +480,7 @@ class go_strange_pool : public GameObjectScript
GameObjectAI* GetAI(GameObject* go) const override
{
- return GetInstanceAI<go_strange_poolAI>(go);
+ return GetSerpentshrineCavernAI<go_strange_poolAI>(go);
}
};
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 8640213703e..02ccdb7f075 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 0844e1a3e0f..4b694ab5861 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp
@@ -24,11 +24,14 @@ SDCategory: Coilfang Resevoir, Serpent Shrine Cavern
EndScriptData */
#include "ScriptMgr.h"
+#include "GameObject.h"
+#include "GameObjectAI.h"
#include "InstanceScript.h"
-#include "serpent_shrine.h"
+#include "Log.h"
+#include "Map.h"
#include "Player.h"
+#include "serpent_shrine.h"
#include "TemporarySummon.h"
-#include "GameObjectAI.h"
#define MAX_ENCOUNTER 6
@@ -81,14 +84,14 @@ class go_bridge_console : public GameObjectScript
GameObjectAI* GetAI(GameObject* go) const override
{
- return GetInstanceAI<go_bridge_consoleAI>(go);
+ return GetSerpentshrineCavernAI<go_bridge_consoleAI>(go);
}
};
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
{
@@ -130,7 +133,7 @@ class instance_serpent_shrine : public InstanceMapScript
else
Water = WATERSTATE_FRENZY;
- Map::PlayerList const &PlayerList = instance->GetPlayers();
+ Map::PlayerList const& PlayerList = instance->GetPlayers();
if (PlayerList.isEmpty())
return;
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
@@ -141,12 +144,11 @@ class instance_serpent_shrine : public InstanceMapScript
{
if (Water == WATERSTATE_SCALDING)
{
-
if (!player->HasAura(SPELL_SCALDINGWATER))
- {
player->CastSpell(player, SPELL_SCALDINGWATER, true);
- }
- } else if (Water == WATERSTATE_FRENZY)
+
+ }
+ else if (Water == WATERSTATE_FRENZY)
{
//spawn frenzy
if (DoSpawnFrenzy)
@@ -390,7 +392,7 @@ class instance_serpent_shrine : public InstanceMapScript
return stream.str();
}
- void Load(const char* in) override
+ void Load(char const* in) override
{
if (!in)
{
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/serpent_shrine.h b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/serpent_shrine.h
index 0fe6a947e05..0878bb7352d 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,4 +60,10 @@ enum SSDataTypes
DATA_TRASH = 25,
};
+template <class AI, class T>
+inline AI* GetSerpentshrineCavernAI(T* obj)
+{
+ return GetInstanceAI<AI>(obj, 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..cc57cc53ffa 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
@@ -148,7 +149,7 @@ public:
Talk(SAY_SLAY);
}
- void SpellHit(Unit* /*caster*/, const SpellInfo* spell) override
+ void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
{
//hack :(
if (spell->Id == SPELL_WARLORDS_RAGE_PROC)
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 e1ee926e85d..be3afe3f2a8 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,12 @@
*/
#include "ScriptMgr.h"
+#include "Creature.h"
+#include "GameObject.h"
#include "GameObjectAI.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 ceed2eaaa14..8d0a6136cef 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, class T>
-AI* GetSteamVaultAI(T* obj)
+template <class AI, class T>
+inline AI* GetSteamVaultAI(T* obj)
{
return GetInstanceAI<AI>(obj, SteamVaultScriptName);
}
diff --git a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_ahune.cpp b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_ahune.cpp
index f50506784a9..4bbbb8f6a29 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_ahune.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_ahune.cpp
@@ -15,14 +15,22 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "ScriptMgr.h"
#include "CreatureTextMgr.h"
+#include "GameObject.h"
+#include "GameObjectAI.h"
+#include "Group.h"
+#include "InstanceScript.h"
#include "LFGMgr.h"
-#include "ScriptedGossip.h"
+#include "Map.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptedCreature.h"
-#include "GameObjectAI.h"
-#include "ScriptMgr.h"
+#include "ScriptedGossip.h"
#include "SpellAuraEffects.h"
#include "SpellScript.h"
+#include "TemporarySummon.h"
#include "the_slave_pens.h"
enum Spells
@@ -280,7 +288,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_ahuneAI>(creature);
+ return GetSlavePensAI<boss_ahuneAI>(creature);
}
};
@@ -358,7 +366,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_frozen_coreAI>(creature);
+ return GetSlavePensAI<npc_frozen_coreAI>(creature);
}
};
@@ -396,7 +404,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
@@ -510,7 +518,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_ahune_bunnyAI>(creature);
+ return GetSlavePensAI<npc_ahune_bunnyAI>(creature);
}
};
@@ -638,7 +646,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<npc_earthen_ring_flamecallerAI>(creature);
+ return GetSlavePensAI<npc_earthen_ring_flamecallerAI>(creature);
}
};
@@ -672,7 +680,7 @@ public:
GameObjectAI* GetAI(GameObject* go) const override
{
- return GetInstanceAI<go_ahune_ice_stoneAI>(go);
+ return GetSlavePensAI<go_ahune_ice_stoneAI>(go);
}
};
@@ -688,9 +696,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*/)
@@ -724,9 +730,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)
@@ -742,14 +746,14 @@ public:
switch (aurEff->GetTickNumber())
{
case 1:
- sCreatureTextMgr->SendChat(caster, SAY_PLAYER_TEXT_1, NULL, CHAT_MSG_SAY, LANG_UNIVERSAL, TEXT_RANGE_NORMAL, 0, TEAM_OTHER, false, player);
+ sCreatureTextMgr->SendChat(caster, SAY_PLAYER_TEXT_1, nullptr, CHAT_MSG_SAY, LANG_UNIVERSAL, TEXT_RANGE_NORMAL, 0, TEAM_OTHER, false, player);
player->CastSpell(player, SPELL_SUMMONING_RHYME_BONFIRE, true);
break;
case 2:
- sCreatureTextMgr->SendChat(caster, SAY_PLAYER_TEXT_2, NULL, CHAT_MSG_SAY, LANG_UNIVERSAL, TEXT_RANGE_NORMAL, 0, TEAM_OTHER, false, player);
+ sCreatureTextMgr->SendChat(caster, SAY_PLAYER_TEXT_2, nullptr, CHAT_MSG_SAY, LANG_UNIVERSAL, TEXT_RANGE_NORMAL, 0, TEAM_OTHER, false, player);
break;
case 3:
- sCreatureTextMgr->SendChat(caster, SAY_PLAYER_TEXT_3, NULL, CHAT_MSG_SAY, LANG_UNIVERSAL, TEXT_RANGE_NORMAL, 0, TEAM_OTHER, false, player);
+ sCreatureTextMgr->SendChat(caster, SAY_PLAYER_TEXT_3, nullptr, CHAT_MSG_SAY, LANG_UNIVERSAL, TEXT_RANGE_NORMAL, 0, TEAM_OTHER, false, player);
Remove();
break;
}
@@ -779,9 +783,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)
@@ -832,9 +834,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*/)
@@ -867,9 +867,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)
@@ -912,9 +910,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*/)
@@ -951,9 +947,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)
@@ -1013,9 +1007,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..22650515c90 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
@@ -23,7 +23,9 @@ 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..3127941e392 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 <class AI, class T>
+inline AI* GetSlavePensAI(T* obj)
+{
+ return GetInstanceAI<AI>(obj, 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 a21d4238625..9794b7d331a 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..7de1686dfb7
--- /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 <class AI, class T>
+inline AI* GetTheUnderbogAI(T* obj)
+{
+ return GetInstanceAI<AI>(obj, 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 1406c118ad1..4d65803a7cd 100644
--- a/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp
+++ b/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp
@@ -24,9 +24,11 @@ SDCategory: Gruul's Lair
EndScriptData */
#include "ScriptMgr.h"
+#include "gruuls_lair.h"
+#include "MotionMaster.h"
#include "ScriptedCreature.h"
+#include "SpellInfo.h"
#include "SpellScript.h"
-#include "gruuls_lair.h"
enum Yells
{
@@ -121,7 +123,7 @@ class boss_gruul : public CreatureScript
Talk(SAY_DEATH);
}
- void SpellHitTarget(Unit* target, const SpellInfo* pSpell) override
+ void SpellHitTarget(Unit* target, SpellInfo const* pSpell) override
{
//This to emulate effect1 (77) of SPELL_GROUND_SLAM, knock back to any direction
//It's initially wrong, since this will cause fall damage, which is by comments, not intended.
@@ -132,11 +134,11 @@ class boss_gruul : public CreatureScript
switch (urand(0, 1))
{
case 0:
- target->CastSpell(target, SPELL_MAGNETIC_PULL, true, NULL, NULL, me->GetGUID());
+ target->CastSpell(target, SPELL_MAGNETIC_PULL, true, nullptr, nullptr, me->GetGUID());
break;
case 1:
- target->CastSpell(target, SPELL_KNOCK_BACK, true, NULL, NULL, me->GetGUID());
+ target->CastSpell(target, SPELL_KNOCK_BACK, true, nullptr, nullptr, me->GetGUID());
break;
}
}
@@ -234,7 +236,7 @@ class boss_gruul : public CreatureScript
if (m_uiCaveIn_StaticTimer >= 4000)
m_uiCaveIn_StaticTimer -= 2000;
- m_uiCaveIn_Timer = m_uiCaveIn_StaticTimer;
+ m_uiCaveIn_Timer = m_uiCaveIn_StaticTimer;
}
else
m_uiCaveIn_Timer -= diff;
@@ -275,11 +277,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*/)
@@ -287,7 +285,7 @@ class spell_gruul_shatter : public SpellScriptLoader
if (Unit* target = GetHitUnit())
{
target->RemoveAurasDueToSpell(SPELL_STONED);
- target->CastSpell((Unit*)NULL, SPELL_SHATTER_EFFECT, true);
+ target->CastSpell((Unit*)nullptr, SPELL_SHATTER_EFFECT, true);
}
}
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 2d3cd909ff6..b3aafe004a6 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,11 @@ SDCategory: Gruul's Lair
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "gruuls_lair.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
enum HighKingMaulgar
{
@@ -178,7 +181,7 @@ public:
//Charging_Timer
if (Charging_Timer <= diff)
{
- Unit* target = NULL;
+ Unit* target = nullptr;
target = SelectTarget(SELECT_TARGET_RANDOM, 0);
if (target)
{
@@ -290,7 +293,7 @@ public:
//DeathCoil Timer /need correct timer
if (DeathCoil_Timer <= diff)
{
- Unit* target = NULL;
+ Unit* target = nullptr;
target = SelectTarget(SELECT_TARGET_RANDOM, 0);
if (target)
DoCast(target, SPELL_DEATH_COIL);
@@ -555,7 +558,7 @@ public:
//BlastWave_Timer
if (BlastWave_Timer <= diff)
{
- Unit* target = NULL;
+ Unit* target = nullptr;
std::list<HostileReference*> t_list = me->getThreatManager().getThreatList();
std::vector<Unit*> target_list;
for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
@@ -564,7 +567,7 @@ public:
//15 yard radius minimum
if (target && target->IsWithinDist(me, 15, false))
target_list.push_back(target);
- target = NULL;
+ target = nullptr;
}
if (!target_list.empty())
target = *(target_list.begin() + rand32() % target_list.size());
diff --git a/src/server/scripts/Outland/GruulsLair/gruuls_lair.h b/src/server/scripts/Outland/GruulsLair/gruuls_lair.h
index dd9017d780d..4497d88ca05 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,10 +47,10 @@ enum GLGameObjectIds
GO_GRUUL_DOOR = 184662
};
-template<class AI>
-AI* GetGruulsLairAI(Creature* creature)
+template <class AI, class T>
+inline AI* GetGruulsLairAI(T* obj)
{
- return GetInstanceAI<AI>(creature, GLScriptName);
+ return GetInstanceAI<AI>(obj, GLScriptName);
}
#endif // GRUULS_LAIR_H_
diff --git a/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp b/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp
index 2145ebee721..55cda953d94 100644
--- a/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp
+++ b/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp
@@ -16,8 +16,10 @@
*/
#include "ScriptMgr.h"
-#include "InstanceScript.h"
+#include "Creature.h"
#include "gruuls_lair.h"
+#include "InstanceScript.h"
+#include "Map.h"
DoorData const doorData[] =
{
@@ -52,58 +54,12 @@ class instance_gruuls_lair : public InstanceMapScript
void OnCreatureCreate(Creature* creature) override
{
- switch (creature->GetEntry())
- {
- case NPC_MAULGAR:
- MaulgarGUID = creature->GetGUID();
- // no break;
- case NPC_KROSH_FIREHAND:
- case NPC_OLM_THE_SUMMONER:
- case NPC_KIGGLER_THE_CRAZED:
- case NPC_BLINDEYE_THE_SEER:
- AddMinion(creature, true);
- break;
- default:
- break;
- }
- }
+ InstanceScript::OnCreatureCreate(creature);
- void OnCreatureRemove(Creature* creature) override
- {
switch (creature->GetEntry())
{
case NPC_MAULGAR:
- case NPC_KROSH_FIREHAND:
- case NPC_OLM_THE_SUMMONER:
- case NPC_KIGGLER_THE_CRAZED:
- case NPC_BLINDEYE_THE_SEER:
- AddMinion(creature, false);
- break;
- default:
- break;
- }
- }
-
- void OnGameObjectCreate(GameObject* go) override
- {
- switch (go->GetEntry())
- {
- case GO_MAULGAR_DOOR:
- case GO_GRUUL_DOOR:
- AddDoor(go, true);
- break;
- default:
- break;
- }
- }
-
- void OnGameObjectRemove(GameObject* go) override
- {
- switch (go->GetEntry())
- {
- case GO_MAULGAR_DOOR:
- case GO_GRUUL_DOOR:
- AddDoor(go, false);
+ MaulgarGUID = creature->GetGUID();
break;
default:
break;
diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/blood_furnace.h b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/blood_furnace.h
index 942f6fa9e6a..cf8ce2e5024 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, class T>
-AI* GetBloodFurnaceAI(T* obj)
+template <class AI, class T>
+inline AI* GetBloodFurnaceAI(T* obj)
{
return GetInstanceAI<AI>(obj, BFScriptName);
}
diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp
index ddf51c0821d..69f7a05a634 100644
--- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp
@@ -16,11 +16,14 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "blood_furnace.h"
+#include "GameObject.h"
#include "GameObjectAI.h"
-#include "SpellScript.h"
+#include "InstanceScript.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.h"
#include "SpellAuraEffects.h"
-#include "blood_furnace.h"
+#include "SpellScript.h"
enum Yells
{
@@ -166,9 +169,7 @@ class spell_broggok_poison_cloud : public SpellScriptLoader
bool Validate(SpellInfo const* spellInfo) override
{
- if (!sSpellMgr->GetSpellInfo(spellInfo->Effects[EFFECT_0].TriggerSpell))
- return false;
- return true;
+ return ValidateSpellInfo({ spellInfo->Effects[EFFECT_0].TriggerSpell });
}
void PeriodicTick(AuraEffect const* aurEff)
@@ -177,7 +178,7 @@ class spell_broggok_poison_cloud : public SpellScriptLoader
uint32 triggerSpell = GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell;
int32 mod = int32(((float(aurEff->GetTickNumber()) / aurEff->GetTotalTicks()) * 0.9f + 0.1f) * 10000 * 2 / 3);
- GetTarget()->CastCustomSpell(triggerSpell, SPELLVALUE_RADIUS_MOD, mod, (Unit*)NULL, TRIGGERED_FULL_MASK, NULL, aurEff);
+ GetTarget()->CastCustomSpell(triggerSpell, SPELLVALUE_RADIUS_MOD, mod, (Unit*)nullptr, TRIGGERED_FULL_MASK, nullptr, aurEff);
}
void Register() override
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 f3764c68434..a91669761d1 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,9 +17,11 @@
*/
#include "ScriptMgr.h"
+#include "blood_furnace.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
#include "SpellAuras.h"
-#include "blood_furnace.h"
+#include "TemporarySummon.h"
enum Kelidan
{
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..e662282b2be 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,11 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "InstanceScript.h"
#include "blood_furnace.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "Map.h"
+#include "ScriptedCreature.h"
DoorData const doorData[] =
{
@@ -79,17 +81,12 @@ class instance_blood_furnace : public InstanceMapScript
void OnGameObjectCreate(GameObject* go) override
{
+ InstanceScript::OnGameObjectCreate(go);
+
switch (go->GetEntry())
{
case GO_PRISON_DOOR_04:
PrisonDoor4GUID = go->GetGUID();
- // no break
- case GO_PRISON_DOOR_01:
- case GO_PRISON_DOOR_02:
- case GO_PRISON_DOOR_03:
- case GO_PRISON_DOOR_05:
- case GO_SUMMON_DOOR:
- AddDoor(go, true);
break;
case GO_BROGGOK_LEVER:
BroggokLeverGUID = go->GetGUID();
@@ -123,23 +120,6 @@ class instance_blood_furnace : public InstanceMapScript
}
}
- void OnGameObjectRemove(GameObject* go) override
- {
- switch (go->GetEntry())
- {
- case GO_PRISON_DOOR_01:
- case GO_PRISON_DOOR_02:
- case GO_PRISON_DOOR_03:
- case GO_PRISON_DOOR_04:
- case GO_PRISON_DOOR_05:
- case GO_SUMMON_DOOR:
- AddDoor(go, false);
- break;
- default:
- break;
- }
- }
-
ObjectGuid GetGuidData(uint32 type) const override
{
switch (type)
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 feb8b29ca98..a8914c31b96 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
{
@@ -157,7 +158,7 @@ class boss_omor_the_unscarred : public CreatureScript
else
if (OrbitalStrike_Timer <= diff)
{
- Unit* temp = NULL;
+ Unit* temp = nullptr;
if (me->IsWithinMeleeRange(me->GetVictim()))
temp = me->GetVictim();
else temp = SelectTarget(SELECT_TARGET_RANDOM, 0);
@@ -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 7a4651f3f00..ecfecf2073e 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,12 @@ Category: Hellfire Citadel, Hellfire Ramparts
EndScriptData */
#include "ScriptMgr.h"
+#include "hellfire_ramparts.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
#include "SpellInfo.h"
-#include "hellfire_ramparts.h"
+#include "TemporarySummon.h"
enum Says
{
@@ -108,7 +111,7 @@ class boss_nazan : public CreatureScript
}
}
- void SpellHitTarget(Unit* target, const SpellInfo* entry) override
+ void SpellHitTarget(Unit* target, SpellInfo const* entry) override
{
if (target && entry->Id == uint32(SPELL_FIREBALL))
me->SummonCreature(NPC_LIQUID_FIRE, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), target->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN, 30000);
@@ -196,7 +199,7 @@ class boss_nazan : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_nazanAI(creature);
+ return GetHellfireRampartsAI<boss_nazanAI>(creature);
}
};
@@ -282,7 +285,7 @@ class boss_vazruden : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new boss_vazrudenAI(creature);
+ return GetHellfireRampartsAI<boss_vazrudenAI>(creature);
}
};
@@ -454,7 +457,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 +514,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..3137398e766 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 <class AI, class T>
+inline AI* GetHellfireRampartsAI(T* obj)
+{
+ return GetInstanceAI<AI>(obj, 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 c4917afd598..bd676f73680 100644
--- a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp
@@ -16,14 +16,16 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "GameObject.h"
+#include "GameObjectAI.h"
+#include "InstanceScript.h"
#include "magtheridons_lair.h"
+#include "PassiveAI.h"
#include "Player.h"
+#include "ScriptedCreature.h"
+#include "SpellAuraEffects.h"
#include "SpellInfo.h"
#include "SpellScript.h"
-#include "SpellAuraEffects.h"
-#include "PassiveAI.h"
-#include "GameObjectAI.h"
enum Yells
{
@@ -304,7 +306,7 @@ class boss_magtheridon : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_magtheridonAI>(creature);
+ return GetMagtheridonsLairAI<boss_magtheridonAI>(creature);
}
};
@@ -422,7 +424,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);
}
};
@@ -455,7 +457,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_magtheridon_roomAI(creature);
+ return GetMagtheridonsLairAI<npc_magtheridon_roomAI>(creature);
}
};
@@ -483,7 +485,7 @@ public:
GameObjectAI* GetAI(GameObject* go) const override
{
- return new go_manticron_cubeAI(go);
+ return GetMagtheridonsLairAI<go_manticron_cubeAI>(go);
}
};
@@ -499,9 +501,7 @@ class spell_magtheridon_blaze_target : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_BLAZE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_BLAZE });
}
void HandleAura()
@@ -534,9 +534,7 @@ class spell_magtheridon_shadow_grasp : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_MIND_EXHAUSTION))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_MIND_EXHAUSTION });
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -570,10 +568,11 @@ class spell_magtheridon_shadow_grasp_visual : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SHADOW_CAGE)
- || !sSpellMgr->GetSpellInfo(SPELL_SHADOW_GRASP_VISUAL))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_SHADOW_CAGE,
+ SPELL_SHADOW_GRASP_VISUAL
+ });
}
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
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 6ad969c4ab7..087343a83f4 100644
--- a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp
@@ -16,9 +16,12 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "AreaBoundary.h"
+#include "GameObject.h"
#include "InstanceScript.h"
#include "magtheridons_lair.h"
+#include "Map.h"
+#include "ScriptedCreature.h"
BossBoundaryData const boundaries =
{
@@ -64,7 +67,7 @@ static MLDataTypes const collapseObjectDatas[] =
class instance_magtheridons_lair : public InstanceMapScript
{
public:
- instance_magtheridons_lair() : InstanceMapScript("instance_magtheridons_lair", 544) { }
+ instance_magtheridons_lair() : InstanceMapScript(MLScriptName, 544) { }
struct instance_magtheridons_lair_InstanceMapScript : public InstanceScript
{
diff --git a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/magtheridons_lair.h b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/magtheridons_lair.h
index 7ed1ab9ebaa..2b330222d6d 100644
--- a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/magtheridons_lair.h
+++ b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/magtheridons_lair.h
@@ -18,6 +18,9 @@
#ifndef DEF_MAGTHERIDONS_LAIR_H
#define DEF_MAGTHERIDONS_LAIR_H
+#include "CreatureAIImpl.h"
+
+#define MLScriptName "instance_magtheridons_lair"
#define DataHeader "ML"
uint32 const EncounterCount = 1;
@@ -71,4 +74,10 @@ enum MLGameObjectIds
GO_MAGTHERIDON_COLUMN_5 = 184637
};
+template <class AI, class T>
+inline AI* GetMagtheridonsLairAI(T* obj)
+{
+ return GetInstanceAI<AI>(obj, 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 2bf0b1870fb..b6dcb21af5c 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 08b442e033b..4d51aa67447 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,9 @@ boss_warchief_kargath_bladefist
EndContentData */
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
#include "shattered_halls.h"
@@ -331,7 +334,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 156100f1316..f4fa4ab4cde 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 "ScriptedCreature.h"
-#include "SpellScript.h"
-#include "SpellAuraEffects.h"
#include "InstanceScript.h"
+#include "Map.h"
#include "Player.h"
-#include "SpellAuras.h"
+#include "ScriptedCreature.h"
#include "shattered_halls.h"
+#include "SpellAuraEffects.h"
+#include "SpellAuras.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
{
@@ -92,35 +94,11 @@ class instance_shattered_halls : public InstanceMapScript
ex->SetDuration(executionTimer);
}
- void OnGameObjectCreate(GameObject* go) override
- {
- switch (go->GetEntry())
- {
- case GO_GRAND_WARLOCK_CHAMBER_DOOR_1:
- case GO_GRAND_WARLOCK_CHAMBER_DOOR_2:
- AddDoor(go, true);
- default:
- break;
- }
- }
-
- void OnGameObjectRemove(GameObject* go) override
- {
- switch (go->GetEntry())
- {
- case GO_GRAND_WARLOCK_CHAMBER_DOOR_1:
- case GO_GRAND_WARLOCK_CHAMBER_DOOR_2:
- AddDoor(go, false);
- default:
- break;
- }
- }
-
void OnCreatureCreate(Creature* creature) override
{
if (!_team)
{
- Map::PlayerList const &players = instance->GetPlayers();
+ Map::PlayerList const& players = instance->GetPlayers();
if (!players.isEmpty())
if (Player* player = players.begin()->GetSource())
_team = player->GetTeam();
diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/shattered_halls.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/shattered_halls.cpp
index 3dad650b782..45fc8df0d1a 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 "shattered_halls.h"
+#include "SpellScript.h"
+#include "TemporarySummon.h"
class at_nethekurse_exit : public AreaTriggerScript
{
@@ -109,7 +110,7 @@ class boss_shattered_executioner : public CreatureScript
if (instance->GetData(DATA_PRISONERS_EXECUTED) > 0)
return;
- Map::PlayerList const &players = instance->instance->GetPlayers();
+ Map::PlayerList const& players = instance->instance->GetPlayers();
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
{
Player* pl = itr->GetSource();
@@ -128,7 +129,7 @@ class boss_shattered_executioner : public CreatureScript
if (data == 1)
{
- Map::PlayerList const &players = instance->instance->GetPlayers();
+ Map::PlayerList const& players = instance->instance->GetPlayers();
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
{
Player* pl = itr->GetSource();
@@ -173,7 +174,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..50483e6f518 100644
--- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/shattered_halls.h
+++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/shattered_halls.h
@@ -19,6 +19,9 @@
#ifndef DEF_SHATTERED_H
#define DEF_SHATTERED_H
+#include "CreatureAIImpl.h"
+
+#define SHScriptName "instance_shattered_halls"
#define DataHeader "SH"
uint32 const EncounterCount = 4;
@@ -88,27 +91,32 @@ enum SHActions
ACTION_EXECUTIONER_TAUNT = 1
};
-const Position Executioner = { 152.8524f, -83.63912f, 2.021005f, 0.06981317f };
+Position const Executioner = { 152.8524f, -83.63912f, 2.021005f, 0.06981317f };
struct FactionSpawnerHelper
{
- FactionSpawnerHelper(uint32 allianceEntry, uint32 hordeEntry, const Position& pos) : _allianceNPC(allianceEntry), _hordeNPC(hordeEntry), _spawnPos(pos) { }
+ FactionSpawnerHelper(uint32 allianceEntry, uint32 hordeEntry, Position const& pos) : _allianceNPC(allianceEntry), _hordeNPC(hordeEntry), _spawnPos(pos) { }
inline uint32 operator()(uint32 teamID) const { return teamID == ALLIANCE ? _allianceNPC : _hordeNPC; }
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] =
+FactionSpawnerHelper const executionerVictims[VictimCount] =
{
{ NPC_CAPTAIN_ALINA, NPC_CAPTAIN_BONESHATTER, { 138.8807f, -84.22707f, 1.992269f, 0.06981317f } },
{ NPC_ALLIANCE_VICTIM_1, NPC_HORDE_VICTIM_1, { 151.2411f, -91.02930f, 2.019741f, 1.57079600f } },
{ NPC_ALLIANCE_VICTIM_2, NPC_HORDE_VICTIM_2, { 151.0459f, -77.51981f, 2.021008f, 4.74729500f } }
};
+template <class AI, class T>
+inline AI* GetShatteredHallsAI(T* obj)
+{
+ return GetInstanceAI<AI>(obj, 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 07d833bb234..4e891c9ba7a 100644
--- a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp
@@ -24,9 +24,13 @@ SDCategory: Tempest Keep, The Eye
EndScriptData */
#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
-#include "the_eye.h"
#include "SpellInfo.h"
+#include "TemporarySummon.h"
+#include "the_eye.h"
enum Spells
{
@@ -185,13 +189,13 @@ class boss_alar : public CreatureScript
}
}
- void SpellHit(Unit*, const SpellInfo* spell) override
+ void SpellHit(Unit*, SpellInfo const* spell) override
{
if (spell->Id == SPELL_DIVE_BOMB_VISUAL)
{
me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FIRE, true);
me->SetDisplayId(11686);
- //me->SendUpdateObjectToAllExcept(NULL);
+ //me->SendUpdateObjectToAllExcept(nullptr);
}
}
@@ -432,7 +436,7 @@ class boss_alar : public CreatureScript
}
else
{
- Unit* target = NULL;
+ Unit* target = nullptr;
target = me->SelectNearestTargetInAttackDistance(5);
if (target)
AttackStart(target);
@@ -448,7 +452,7 @@ class boss_alar : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_alarAI>(creature);
+ return GetTheEyeAI<boss_alarAI>(creature);
}
};
@@ -520,7 +524,7 @@ class npc_ember_of_alar : public CreatureScript
if (toDie)
{
- me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
+ me->DealDamage(me, me->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
//me->SetVisibility(VISIBILITY_OFF);
}
@@ -531,7 +535,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 +557,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 3ba299d2ea0..813910f5bc5 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 "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
+#include "SpellAuras.h"
#include "SpellScript.h"
-#include "SpellAuraEffects.h"
-
+#include "TemporarySummon.h"
#include "the_eye.h"
enum Yells
@@ -289,7 +292,7 @@ class boss_high_astromancer_solarian : public CreatureScript
//After these 50 seconds she portals to the middle of the room and disappears, leaving 3 light portals behind.
me->GetMotionMaster()->Clear();
me->UpdatePosition(CENTER_X, CENTER_Y, CENTER_Z, CENTER_O);
- for (uint8 i=0; i <= 2; ++i)
+ for (uint8 i = 0; i <= 2; ++i)
{
if (!i)
{
@@ -306,15 +309,15 @@ class boss_high_astromancer_solarian : public CreatureScript
}
if ((std::abs(Portals[2][0] - Portals[1][0]) < 7) && (std::abs(Portals[2][1] - Portals[1][1]) < 7))
{
- int i=1;
+ int i = 1;
if (std::abs(CENTER_X + 26.0f - Portals[2][0]) < 7)
i = -1;
- Portals[2][0] = Portals[2][0]+7*i;
+ Portals[2][0] = Portals[2][0] + 7 * i;
Portals[2][1] = Portal_Y(Portals[2][0], LARGE_PORTAL_RADIUS);
}
- for (int i=0; i <= 2; ++i)
+ for (int i = 0; i <= 2; ++i)
{
- if (Creature* Summoned = me->SummonCreature(NPC_ASTROMANCER_SOLARIAN_SPOTLIGHT, Portals[i][0], Portals[i][1], Portals[i][2], CENTER_O, TEMPSUMMON_TIMED_DESPAWN, Phase2_Timer+Phase3_Timer+AppearDelay_Timer+1700))
+ if (Creature* Summoned = me->SummonCreature(NPC_ASTROMANCER_SOLARIAN_SPOTLIGHT, Portals[i][0], Portals[i][1], Portals[i][2], CENTER_O, TEMPSUMMON_TIMED_DESPAWN, Phase2_Timer + Phase3_Timer + AppearDelay_Timer + 1700))
{
Summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
Summoned->CastSpell(Summoned, SPELL_SPOTLIGHT, false);
@@ -323,7 +326,7 @@ class boss_high_astromancer_solarian : public CreatureScript
AppearDelay = true;
}
else
- Phase1_Timer-=diff;
+ Phase1_Timer -= diff;
}
else if (Phase == 2)
{
@@ -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);
}
};
@@ -455,7 +458,7 @@ class npc_solarium_priest : public CreatureScript
if (healTimer <= diff)
{
- Unit* target = NULL;
+ Unit* target = nullptr;
switch (urand(0, 1))
{
case 0:
@@ -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 09e360a3b87..78ba67004bc 100644
--- a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp
@@ -24,8 +24,13 @@ SDCategory: Tempest Keep, The Eye
EndScriptData */
#include "ScriptMgr.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
#include "Spell.h"
+#include "SpellInfo.h"
#include "SpellScript.h"
#include "the_eye.h"
@@ -864,7 +869,7 @@ class boss_kaelthas : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return GetInstanceAI<boss_kaelthasAI>(creature);
+ return GetTheEyeAI<boss_kaelthasAI>(creature);
}
};
@@ -969,7 +974,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);
}
};
@@ -1033,7 +1038,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);
}
};
@@ -1119,7 +1124,7 @@ class boss_grand_astromancer_capernian : public CreatureScript
//Conflagration_Timer
if (Conflagration_Timer <= diff)
{
- Unit* target = NULL;
+ Unit* target = nullptr;
target = SelectTarget(SELECT_TARGET_RANDOM, 0);
if (target && me->IsWithinDistInMap(target, 30))
@@ -1136,8 +1141,8 @@ class boss_grand_astromancer_capernian : public CreatureScript
if (ArcaneExplosion_Timer <= diff)
{
bool InMeleeRange = false;
- Unit* target = NULL;
- ThreatContainer::StorageType const &threatlist = me->getThreatManager().getThreatList();
+ Unit* target = nullptr;
+ ThreatContainer::StorageType const& threatlist = me->getThreatManager().getThreatList();
for (ThreatContainer::StorageType::const_iterator i = threatlist.begin(); i!= threatlist.end(); ++i)
{
Unit* unit = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid());
@@ -1164,7 +1169,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);
}
};
@@ -1243,7 +1248,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);
}
};
@@ -1313,7 +1318,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);
}
};
@@ -1372,7 +1377,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);
}
};
@@ -1438,7 +1443,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);
}
};
@@ -1460,11 +1465,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..962228a215a 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"
@@ -110,7 +111,7 @@ class boss_void_reaver : public CreatureScript
break;
case EVENT_ARCANE_ORB:
{
- Unit* target = NULL;
+ Unit* target = nullptr;
std::list<HostileReference*> t_list = me->getThreatManager().getThreatList();
std::vector<Unit*> target_list;
for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr != t_list.end(); ++itr)
@@ -121,7 +122,7 @@ class boss_void_reaver : public CreatureScript
// exclude pets & totems, 18 yard radius minimum
if (target->GetTypeId() == TYPEID_PLAYER && target->IsAlive() && !target->IsWithinDist(me, 18, false))
target_list.push_back(target);
- target = NULL;
+ target = nullptr;
}
if (!target_list.empty())
@@ -130,7 +131,7 @@ class boss_void_reaver : public CreatureScript
target = me->GetVictim();
if (target)
- me->CastSpell(target, SPELL_ARCANE_ORB, false, NULL, NULL);
+ me->CastSpell(target, SPELL_ARCANE_ORB, false, nullptr, nullptr);
events.ScheduleEvent(EVENT_ARCANE_ORB, 3000);
break;
@@ -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..71471909f6b 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
{
@@ -106,13 +108,13 @@ class instance_the_eye : public InstanceMapScript
{
switch (identifier)
{
- case DATA_THALADREDTHEDARKENER: return ThaladredTheDarkener;
- case DATA_LORDSANGUINAR: return LordSanguinar;
- case DATA_GRANDASTROMANCERCAPERNIAN: return GrandAstromancerCapernian;
- case DATA_MASTERENGINEERTELONICUS: return MasterEngineerTelonicus;
- case DATA_KAELTHAS: return Kaelthas;
- case DATA_HIGH_ASTROMANCER_SOLARIAN: return Astromancer;
- case DATA_ALAR: return Alar;
+ case DATA_THALADREDTHEDARKENER: return ThaladredTheDarkener;
+ case DATA_LORDSANGUINAR: return LordSanguinar;
+ case DATA_GRANDASTROMANCERCAPERNIAN: return GrandAstromancerCapernian;
+ case DATA_MASTERENGINEERTELONICUS: return MasterEngineerTelonicus;
+ case DATA_KAELTHAS: return Kaelthas;
+ case DATA_HIGH_ASTROMANCER_SOLARIAN: return Astromancer;
+ case DATA_ALAR: return Alar;
}
return ObjectGuid::Empty;
}
diff --git a/src/server/scripts/Outland/TempestKeep/Eye/the_eye.cpp b/src/server/scripts/Outland/TempestKeep/Eye/the_eye.cpp
index feabaf8e701..1cbb522552c 100644
--- a/src/server/scripts/Outland/TempestKeep/Eye/the_eye.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Eye/the_eye.cpp
@@ -110,7 +110,7 @@ class npc_crystalcore_devastator : public CreatureScript
CreatureAI* GetAI(Creature* creature) const override
{
- return new npc_crystalcore_devastatorAI(creature);
+ return GetTheEyeAI<npc_crystalcore_devastatorAI>(creature);
}
};
void AddSC_the_eye()
diff --git a/src/server/scripts/Outland/TempestKeep/Eye/the_eye.h b/src/server/scripts/Outland/TempestKeep/Eye/the_eye.h
index 1111e2409f5..1ac735f750c 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 <class AI, class T>
+inline AI* GetTheEyeAI(T* obj)
+{
+ return GetInstanceAI<AI>(obj, 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 19036555787..4d804355423 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,10 +16,11 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "SpellScript.h"
#include "mechanar.h"
#include "Player.h"
+#include "ScriptedCreature.h"
+#include "SpellInfo.h"
+#include "SpellScript.h"
enum Spells
{
@@ -155,7 +156,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);
}
};
@@ -170,15 +171,13 @@ 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)
@@ -238,9 +237,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 */)
@@ -248,7 +245,7 @@ class spell_capacitus_polarity_shift : public SpellScriptLoader
Unit* target = GetHitUnit();
Unit* caster = GetCaster();
- target->CastSpell(target, roll_chance_i(50) ? SPELL_POSITIVE_POLARITY : SPELL_NEGATIVE_POLARITY, true, NULL, NULL, caster->GetGUID());
+ target->CastSpell(target, roll_chance_i(50) ? SPELL_POSITIVE_POLARITY : SPELL_NEGATIVE_POLARITY, true, nullptr, nullptr, caster->GetGUID());
}
void Register() override
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 483cf3284c3..15f70ada7a7 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,10 @@ SDCategory: Tempest Keep, The Mechanar
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "InstanceScript.h"
#include "mechanar.h"
+#include "MotionMaster.h"
+#include "ScriptedCreature.h"
enum Says
{
@@ -141,7 +143,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 +231,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 9ddca823d9e..25bbfe0392a 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..5b5c2beb7dd 100644
--- a/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp
@@ -18,20 +18,21 @@
#include "ScriptMgr.h"
#include "InstanceScript.h"
+#include "Map.h"
#include "mechanar.h"
static DoorData const doorData[] =
{
{ GO_DOOR_MOARG_1, DATA_GATEWATCHER_IRON_HAND, DOOR_TYPE_PASSAGE },
{ GO_DOOR_MOARG_2, DATA_GATEWATCHER_GYROKILL, DOOR_TYPE_PASSAGE },
- { GO_DOOR_NETHERMANCER, DATA_NETHERMANCER_SEPRETHREA, DOOR_TYPE_ROOM },
- { 0, 0, DOOR_TYPE_ROOM }
+ { GO_DOOR_NETHERMANCER, DATA_NETHERMANCER_SEPRETHREA, DOOR_TYPE_ROOM },
+ { 0, 0, DOOR_TYPE_ROOM }
};
class instance_mechanar : public InstanceMapScript
{
public:
- instance_mechanar(): InstanceMapScript("instance_mechanar", 554) { }
+ instance_mechanar(): InstanceMapScript(MechanarScriptName, 554) { }
struct instance_mechanar_InstanceMapScript : public InstanceScript
{
@@ -42,34 +43,6 @@ class instance_mechanar : public InstanceMapScript
LoadDoorData(doorData);
}
- void OnGameObjectCreate(GameObject* gameObject) override
- {
- switch (gameObject->GetEntry())
- {
- case GO_DOOR_MOARG_1:
- case GO_DOOR_MOARG_2:
- case GO_DOOR_NETHERMANCER:
- AddDoor(gameObject, true);
- break;
- default:
- break;
- }
- }
-
- void OnGameObjectRemove(GameObject* gameObject) override
- {
- switch (gameObject->GetEntry())
- {
- case GO_DOOR_MOARG_1:
- case GO_DOOR_MOARG_2:
- case GO_DOOR_NETHERMANCER:
- AddDoor(gameObject, false);
- break;
- default:
- break;
- }
- }
-
bool SetBossState(uint32 type, EncounterState state) override
{
if (!InstanceScript::SetBossState(type, state))
diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/mechanar.h b/src/server/scripts/Outland/TempestKeep/Mechanar/mechanar.h
index 35494c745f8..b4edfd9c74e 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 <class AI, class T>
+inline AI* GetMechanarAI(T* obj)
+{
+ return GetInstanceAI<AI>(obj, MechanarScriptName);
+}
+
#endif
diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp
index 6c469601efc..d571c155dbe 100644
--- a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp
+++ b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp
@@ -30,8 +30,10 @@ npc_zerekethvoidzone
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "arcatraz.h"
+#include "InstanceScript.h"
+#include "MotionMaster.h"
+#include "ScriptedCreature.h"
/*#####
# npc_millhouse_manastorm
@@ -549,7 +551,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..2ccf1684860 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,10 +64,10 @@ enum AZGameObjectIds
GO_WARDENS_SHIELD = 184802 // shield 'protecting' mellichar
};
-template<class AI>
-AI* GetArcatrazAI(Creature* creature)
+template <class AI, class T>
+inline AI* GetArcatrazAI(T* obj)
{
- return GetInstanceAI<AI>(creature, ArcatrazScriptName);
+ return GetInstanceAI<AI>(obj, ArcatrazScriptName);
}
#endif // ARCATRAZ_H
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..561dbaa8c5a 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,11 @@ SDCategory: Tempest Keep, The Arcatraz
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "arcatraz.h"
+#include "InstanceScript.h"
+#include "MotionMaster.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..bb21b999d5d 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
@@ -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..ba5b7b7e0a5 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[] =
{
@@ -64,12 +67,10 @@ class instance_arcatraz : public InstanceMapScript
void OnGameObjectCreate(GameObject* go) override
{
+ InstanceScript::OnGameObjectCreate(go);
+
switch (go->GetEntry())
{
- case GO_CONTAINMENT_CORE_SECURITY_FIELD_ALPHA:
- case GO_CONTAINMENT_CORE_SECURITY_FIELD_BETA:
- AddDoor(go, true);
- break;
case GO_STASIS_POD_ALPHA:
StasisPodGUIDs[0] = go->GetGUID();
break;
@@ -93,19 +94,6 @@ class instance_arcatraz : public InstanceMapScript
}
}
- void OnGameObjectRemove(GameObject* go) override
- {
- switch (go->GetEntry())
- {
- case GO_CONTAINMENT_CORE_SECURITY_FIELD_ALPHA:
- case GO_CONTAINMENT_CORE_SECURITY_FIELD_BETA:
- AddDoor(go, false);
- break;
- default:
- break;
- }
- }
-
void SetData(uint32 type, uint32 data) override
{
switch (type)
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..204a52609b0 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,8 @@ SDCategory: Tempest Keep, The Botanica
EndScriptData */
#include "ScriptMgr.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
#include "the_botanica.h"
@@ -210,7 +212,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 6980ca054e9..291be813dc1 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,10 @@ SDCategory: Tempest Keep, The Botanica
EndScriptData */
#include "ScriptMgr.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
+#include "TemporarySummon.h"
#include "the_botanica.h"
enum Says
@@ -94,7 +97,6 @@ class npc_warp_splinter_treant : public CreatureScript
void MoveInLineOfSight(Unit* /*who*/) override { }
-
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim() || !me->GetVictim())
@@ -107,7 +109,7 @@ class npc_warp_splinter_treant : public CreatureScript
{
int32 CurrentHP_Treant = (int32)me->GetHealth();
Warp->CastCustomSpell(Warp, SPELL_HEAL_FATHER, &CurrentHP_Treant, 0, 0, true, 0, 0, me->GetGUID());
- me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
+ me->DealDamage(me, me->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
return;
}
me->GetMotionMaster()->MoveFollow(Warp, 0, 0);
@@ -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..55a4be28e33 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 <class AI, class T>
+inline AI* GetBotanicaAI(T* obj)
+{
+ return GetInstanceAI<AI>(obj, BotanicaScriptName);
+}
+
#endif
diff --git a/src/server/scripts/Outland/boss_doomlord_kazzak.cpp b/src/server/scripts/Outland/boss_doomlord_kazzak.cpp
index 4d8ca8ff2be..93ea132a545 100644
--- a/src/server/scripts/Outland/boss_doomlord_kazzak.cpp
+++ b/src/server/scripts/Outland/boss_doomlord_kazzak.cpp
@@ -187,9 +187,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*/)
@@ -204,7 +202,7 @@ class spell_mark_of_kazzak : public SpellScriptLoader
if (target->GetPower(POWER_MANA) == 0)
{
- target->CastSpell(target, SPELL_MARK_OF_KAZZAK_DAMAGE, true, NULL, aurEff);
+ target->CastSpell(target, SPELL_MARK_OF_KAZZAK_DAMAGE, true, nullptr, aurEff);
// Remove aura
SetDuration(0);
}
@@ -234,9 +232,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 e3e39d0c27e..1bad0a75231 100644
--- a/src/server/scripts/Outland/zone_blades_edge_mountains.cpp
+++ b/src/server/scripts/Outland/zone_blades_edge_mountains.cpp
@@ -30,17 +30,19 @@ go_legion_obelisk
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "CellImpl.h"
+#include "CreatureAIImpl.h"
#include "GameObjectAI.h"
-#include "ScriptedGossip.h"
-#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
-#include "Cell.h"
-#include "CellImpl.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
+#include "ScriptedCreature.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"
/*######
## npc_nether_drake
@@ -125,7 +127,7 @@ public:
me->DespawnOrUnsummon(1);
}
- void SpellHit(Unit* caster, const SpellInfo* spell) override
+ void SpellHit(Unit* caster, SpellInfo const* spell) override
{
if (spell->Id == SPELL_T_PHASE_MODULATOR && caster->GetTypeId() == TYPEID_PLAYER)
{
@@ -842,7 +844,7 @@ class npc_simon_bunny : public CreatureScript
}
}
- void SpellHitTarget(Unit* target, const SpellInfo* spell) override
+ void SpellHitTarget(Unit* target, SpellInfo const* spell) override
{
// Cast SPELL_BAD_PRESS_DAMAGE with scaled basepoints when the visual hits the target.
// Need Fix: When SPELL_BAD_PRESS_TRIGGER hits target it triggers spell SPELL_BAD_PRESS_DAMAGE by itself
@@ -850,7 +852,7 @@ class npc_simon_bunny : public CreatureScript
if (spell->Id == SPELL_BAD_PRESS_TRIGGER)
{
int32 bp = (int32)((float)(fails)*0.33f*target->GetMaxHealth());
- target->CastCustomSpell(target, SPELL_BAD_PRESS_DAMAGE, &bp, NULL, NULL, true);
+ target->CastCustomSpell(target, SPELL_BAD_PRESS_DAMAGE, &bp, nullptr, nullptr, true);
}
}
@@ -987,7 +989,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 e5bf6b87386..7c80a20aba9 100644
--- a/src/server/scripts/Outland/zone_hellfire_peninsula.cpp
+++ b/src/server/scripts/Outland/zone_hellfire_peninsula.cpp
@@ -31,10 +31,12 @@ npc_fel_guard_hound
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
-#include "ScriptedEscortAI.h"
+#include "Log.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "ScriptedEscortAI.h"
+#include "ScriptedGossip.h"
#include "WorldSession.h"
/*######
diff --git a/src/server/scripts/Outland/zone_nagrand.cpp b/src/server/scripts/Outland/zone_nagrand.cpp
index 6908e705a8e..ce71c80e5f0 100644
--- a/src/server/scripts/Outland/zone_nagrand.cpp
+++ b/src/server/scripts/Outland/zone_nagrand.cpp
@@ -27,13 +27,16 @@ 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 "GameObjectAI.h"
+#include "MotionMaster.h"
#include "Player.h"
+#include "ScriptedEscortAI.h"
+#include "ScriptedGossip.h"
#include "SpellInfo.h"
+#include "TemporarySummon.h"
/*######
## npc_maghar_captive
@@ -141,7 +144,7 @@ public:
}
- void SpellHitTarget(Unit* /*target*/, const SpellInfo* spell) override
+ void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_CHAIN_LIGHTNING)
{
@@ -514,7 +517,7 @@ public:
summoned->AI()->AttackStart(me);
}
- void SpellHitTarget(Unit* /*target*/, const SpellInfo* spell) override
+ void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_KUR_CHAIN_LIGHTNING)
{
diff --git a/src/server/scripts/Outland/zone_netherstorm.cpp b/src/server/scripts/Outland/zone_netherstorm.cpp
index 6bb351169a3..8f8fc39a2b3 100644
--- a/src/server/scripts/Outland/zone_netherstorm.cpp
+++ b/src/server/scripts/Outland/zone_netherstorm.cpp
@@ -31,11 +31,13 @@ go_captain_tyralius_prison
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
-#include "ScriptedEscortAI.h"
+#include "GameObject.h"
#include "GameObjectAI.h"
+#include "Log.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "ScriptedEscortAI.h"
+#include "ScriptedGossip.h"
/*######
## npc_commander_dawnforge
@@ -316,7 +318,7 @@ class at_commander_dawnforge : public AreaTriggerScript
public:
at_commander_dawnforge() : AreaTriggerScript("at_commander_dawnforge") { }
- bool OnTrigger(Player* player, const AreaTriggerEntry* /*at*/) override
+ bool OnTrigger(Player* player, AreaTriggerEntry const* /*at*/) override
{
//if player lost aura or not have at all, we should not try start event.
if (!player->HasAura(SPELL_SUNFURY_DISGUISE))
@@ -407,7 +409,7 @@ public:
PlayerGUID = who->GetGUID();
}
- //void SpellHit(Unit* /*caster*/, const SpellInfo* /*spell*/) override
+ //void SpellHit(Unit* /*caster*/, SpellInfo const* /*spell*/) override
//{
// DoCast(me, SPELL_DE_MATERIALIZE);
//}
@@ -612,7 +614,7 @@ public:
// take the GO -> animation
me->HandleEmoteCommand(EMOTE_STATE_LOOT);
SetEscortPaused(true);
- bTake=true;
+ bTake = true;
}
break;
case 36: //return and quest_complete
@@ -639,7 +641,7 @@ public:
if (GameObject* go = GetClosestGameObjectWithEntry(me, GO_DRAENEI_MACHINE, INTERACTION_DISTANCE))
{
SetEscortPaused(false);
- bTake=false;
+ bTake = false;
uiTakeTimer = 3000;
go->Delete();
}
diff --git a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp
index 9ab9b9b4eb3..9e89c34fe72 100644
--- a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp
+++ b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp
@@ -37,14 +37,17 @@ npc_enraged_spirit
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
-#include "ScriptedEscortAI.h"
+#include "GameObject.h"
#include "GameObjectAI.h"
#include "Group.h"
-#include "SpellScript.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "Player.h"
-#include "WorldSession.h"
+#include "ScriptedEscortAI.h"
+#include "ScriptedGossip.h"
+#include "SpellInfo.h"
+#include "SpellScript.h"
+#include "TemporarySummon.h"
/*#####
# npc_invis_infernal_caster
@@ -75,7 +78,8 @@ public:
void Reset() override
{
- ground = me->GetMap()->GetHeight(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));
}
@@ -159,7 +163,7 @@ public:
caster->AI()->SetData(TYPE_INFERNAL, DATA_DIED);
}
- void SpellHit(Unit* /*caster*/, const SpellInfo* spell) override
+ void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_SUMMON_INFERNAL)
{
@@ -378,7 +382,7 @@ public:
me->SetDisableGravity(false);
}
- void SpellHit(Unit* caster, const SpellInfo* spell) override
+ void SpellHit(Unit* caster, SpellInfo const* spell) override
{
if (!caster)
return;
@@ -507,7 +511,7 @@ public:
Initialize();
}
- void SpellHit(Unit* caster, const SpellInfo* spell) override
+ void SpellHit(Unit* caster, SpellInfo const* spell) override
{
if (!caster)
return;
@@ -550,7 +554,7 @@ public:
player->KilledMonsterCredit(23209);
}
PoisonTimer = 0;
- me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
+ me->DealDamage(me, me->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
} else PoisonTimer -= diff;
}
if (!UpdateVictim())
@@ -1463,8 +1467,8 @@ public:
}
// Spawn Soul on Kill ALWAYS!
- Creature* Summoned = NULL;
- Unit* totemOspirits = NULL;
+ Creature* Summoned = nullptr;
+ Unit* totemOspirits = nullptr;
if (entry != 0)
Summoned = DoSpawnCreature(entry, 0, 0, 1, 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 5000);
@@ -1559,7 +1563,7 @@ public:
}
}
- void SpellHit(Unit* /*caster*/, const SpellInfo* spell) override
+ void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_WHISTLE)
{
diff --git a/src/server/scripts/Outland/zone_terokkar_forest.cpp b/src/server/scripts/Outland/zone_terokkar_forest.cpp
index e1ef8991aa8..1ccb7950fa0 100644
--- a/src/server/scripts/Outland/zone_terokkar_forest.cpp
+++ b/src/server/scripts/Outland/zone_terokkar_forest.cpp
@@ -33,12 +33,12 @@ npc_slim
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
-#include "ScriptedEscortAI.h"
+#include "GameObject.h"
#include "GameObjectAI.h"
#include "Group.h"
#include "Player.h"
+#include "ScriptedEscortAI.h"
+#include "ScriptedGossip.h"
#include "WorldSession.h"
/*######
@@ -110,7 +110,7 @@ public:
{
if (Group* group = player->GetGroup())
{
- for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
+ for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
{
Player* groupie = itr->GetSource();
if (groupie && groupie->IsInMap(player) &&
diff --git a/src/server/scripts/Outland/zone_zangarmarsh.cpp b/src/server/scripts/Outland/zone_zangarmarsh.cpp
index 52263d56879..fabf7290129 100644
--- a/src/server/scripts/Outland/zone_zangarmarsh.cpp
+++ b/src/server/scripts/Outland/zone_zangarmarsh.cpp
@@ -287,13 +287,13 @@ public:
{
ItemPosCountVec dest;
uint32 itemId = 24573;
- InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, 1, NULL);
+ InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, 1, nullptr);
if (msg == EQUIP_ERR_OK)
{
player->StoreNewItem(dest, itemId, true);
}
else
- player->SendEquipError(msg, NULL, NULL, itemId);
+ player->SendEquipError(msg, nullptr, nullptr, itemId);
}
SendGossipMenuFor(player, 9231, me->GetGUID());
break;
diff --git a/src/server/scripts/Pet/pet_dk.cpp b/src/server/scripts/Pet/pet_dk.cpp
index a17b9fd8b59..43bf59857b8 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 "GridNotifiersImpl.h"
+#include "MotionMaster.h"
+#include "ScriptedCreature.h"
enum DeathKnightSpells
{
diff --git a/src/server/scripts/Pet/pet_generic.cpp b/src/server/scripts/Pet/pet_generic.cpp
index 3f08f8273ac..f45afa95901 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 "DBCStructure.h"
+#include "Map.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "PassiveAI.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 d7acbed9ab5..b68511ea7f5 100644
--- a/src/server/scripts/Pet/pet_hunter.cpp
+++ b/src/server/scripts/Pet/pet_hunter.cpp
@@ -21,9 +21,11 @@
*/
#include "ScriptMgr.h"
+#include "CreatureAIImpl.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
#include "SpellAuraEffects.h"
+#include "TemporarySummon.h"
enum HunterSpells
{
@@ -168,10 +170,11 @@ class spell_pet_charge : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PET_SWOOP) ||
- !sSpellMgr->GetSpellInfo(SPELL_PET_CHARGE))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_PET_SWOOP,
+ SPELL_PET_CHARGE
+ });
}
void HandleDummy(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
@@ -214,9 +217,7 @@ class spell_pet_guard_dog : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PET_GUARD_DOG_HAPPINESS))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_PET_GUARD_DOG_HAPPINESS });
}
bool CheckProc(ProcEventInfo& eventInfo)
@@ -266,9 +267,7 @@ class spell_pet_silverback : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PET_GUARD_DOG_HAPPINESS))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_PET_GUARD_DOG_HAPPINESS });
}
bool CheckProc(ProcEventInfo& eventInfo)
diff --git a/src/server/scripts/Pet/pet_mage.cpp b/src/server/scripts/Pet/pet_mage.cpp
index fa2e65f7104..b782f550c3b 100644
--- a/src/server/scripts/Pet/pet_mage.cpp
+++ b/src/server/scripts/Pet/pet_mage.cpp
@@ -21,14 +21,13 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "CellImpl.h"
#include "CombatAI.h"
+#include "GridNotifiersImpl.h"
+#include "MotionMaster.h"
#include "Pet.h"
#include "PetAI.h"
-#include "Cell.h"
-#include "CellImpl.h"
-#include "GridNotifiers.h"
-#include "GridNotifiersImpl.h"
+#include "ScriptedCreature.h"
enum MageSpells
{
diff --git a/src/server/scripts/ScriptPCH.cpp b/src/server/scripts/ScriptPCH.cpp
index 41fecf3c60d..25425276d24 100644
--- a/src/server/scripts/ScriptPCH.cpp
+++ b/src/server/scripts/ScriptPCH.cpp
@@ -1,6 +1,19 @@
-/* Copyright (C) 2006 - 2009 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/>.
+ */
#include "ScriptPCH.h"
-
diff --git a/src/server/scripts/ScriptPCH.h b/src/server/scripts/ScriptPCH.h
index 1cd25309055..6754b485875 100644
--- a/src/server/scripts/ScriptPCH.h
+++ b/src/server/scripts/ScriptPCH.h
@@ -1,9 +1,20 @@
-/* Copyright (C) 2006 - 2009 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 */
-
-#ifndef SC_PRECOMPILED_H
-#define SC_PRECOMPILED_H
+/*
+ * 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/>.
+ */
#include "ScriptMgr.h"
#include "Cell.h"
@@ -24,10 +35,3 @@
#include "ObjectMgr.h"
#include "SpellScript.h"
#include "SpellAuraEffects.h"
-
-#ifdef _WIN32
-#include <windows.h>
-#endif
-
-#endif
-
diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp
index a55dbd765a0..bd2e36bc30f 100644
--- a/src/server/scripts/Spells/spell_dk.cpp
+++ b/src/server/scripts/Spells/spell_dk.cpp
@@ -21,12 +21,20 @@
* Scriptnames of files in this file should be prefixed with "spell_dk_".
*/
+#include "ScriptMgr.h"
+#include "Containers.h"
+#include "DBCStores.h"
+#include "Map.h"
+#include "ObjectAccessor.h"
+#include "ObjectMgr.h"
#include "Player.h"
#include "PlayerAI.h"
-#include "ScriptMgr.h"
-#include "SpellScript.h"
+#include "Spell.h"
#include "SpellAuraEffects.h"
-#include "Containers.h"
+#include "SpellHistory.h"
+#include "SpellMgr.h"
+#include "SpellScript.h"
+#include "TemporarySummon.h"
enum DeathKnightSpells
{
@@ -117,14 +125,15 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DK_ACCLIMATION_HOLY) ||
- !sSpellMgr->GetSpellInfo(SPELL_DK_ACCLIMATION_FIRE) ||
- !sSpellMgr->GetSpellInfo(SPELL_DK_ACCLIMATION_FROST) ||
- !sSpellMgr->GetSpellInfo(SPELL_DK_ACCLIMATION_NATURE) ||
- !sSpellMgr->GetSpellInfo(SPELL_DK_ACCLIMATION_SHADOW) ||
- !sSpellMgr->GetSpellInfo(SPELL_DK_ACCLIMATION_ARCANE))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_DK_ACCLIMATION_HOLY,
+ SPELL_DK_ACCLIMATION_FIRE,
+ SPELL_DK_ACCLIMATION_NATURE,
+ SPELL_DK_ACCLIMATION_FROST,
+ SPELL_DK_ACCLIMATION_SHADOW,
+ SPELL_DK_ACCLIMATION_ARCANE
+ });
}
bool CheckProc(ProcEventInfo& eventInfo)
@@ -206,9 +215,7 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DK_ADVANTAGE_T10_4P_MELEE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DK_ADVANTAGE_T10_4P_MELEE });
}
bool CheckProc(ProcEventInfo& eventInfo)
@@ -317,9 +324,7 @@ class spell_dk_anti_magic_shell_self : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DK_RUNIC_POWER_ENERGIZE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DK_RUNIC_POWER_ENERGIZE });
}
void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/)
@@ -337,7 +342,7 @@ class spell_dk_anti_magic_shell_self : public SpellScriptLoader
// damage absorbed by Anti-Magic Shell energizes the DK with additional runic power.
// This, if I'm not mistaken, shows that we get back ~20% of the absorbed damage as runic power.
int32 bp = CalculatePct(absorbAmount, 20);
- GetTarget()->CastCustomSpell(SPELL_DK_RUNIC_POWER_ENERGIZE, SPELLVALUE_BASE_POINT0, bp, GetTarget(), true, NULL, aurEff);
+ GetTarget()->CastCustomSpell(SPELL_DK_RUNIC_POWER_ENERGIZE, SPELLVALUE_BASE_POINT0, bp, GetTarget(), true, nullptr, aurEff);
}
void Register() override
@@ -381,9 +386,7 @@ class spell_dk_anti_magic_zone : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DK_ANTI_MAGIC_SHELL_TALENT))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DK_ANTI_MAGIC_SHELL_TALENT });
}
void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/)
@@ -463,9 +466,7 @@ class spell_dk_blood_boil : public SpellScriptLoader
private:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DK_BLOOD_BOIL_TRIGGERED))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DK_BLOOD_BOIL_TRIGGERED });
}
bool Load() override
@@ -506,18 +507,9 @@ class spell_dk_blood_gorged : public SpellScriptLoader
{
PrepareAuraScript(spell_dk_blood_gorged_AuraScript);
- public:
- spell_dk_blood_gorged_AuraScript()
- {
- _procTarget = nullptr;
- }
-
- private:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DK_BLOOD_GORGED_HEAL))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DK_BLOOD_GORGED_HEAL });
}
bool CheckProc(ProcEventInfo& /*eventInfo*/)
@@ -544,7 +536,7 @@ class spell_dk_blood_gorged : public SpellScriptLoader
}
private:
- Unit* _procTarget;
+ Unit* _procTarget = nullptr;
};
AuraScript* GetAuraScript() const override
@@ -592,9 +584,7 @@ class spell_dk_butchery : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DK_BUTCHERY_RUNIC_POWER))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DK_BUTCHERY_RUNIC_POWER });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -649,27 +639,21 @@ class spell_dk_corpse_explosion : public SpellScriptLoader
{
PrepareSpellScript(spell_dk_corpse_explosion_SpellScript);
- public:
- spell_dk_corpse_explosion_SpellScript()
- {
- _target = nullptr;
- }
-
- private:
bool Validate(SpellInfo const* spellInfo) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DK_CORPSE_EXPLOSION_TRIGGERED)
- || !sSpellMgr->GetSpellInfo(SPELL_DK_GHOUL_EXPLODE)
- || !sSpellMgr->GetSpellInfo(SPELL_DK_CORPSE_EXPLOSION_VISUAL)
- || !sSpellMgr->GetSpellInfo(spellInfo->Effects[EFFECT_1].CalcValue()))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_DK_CORPSE_EXPLOSION_TRIGGERED,
+ SPELL_DK_GHOUL_EXPLODE,
+ SPELL_DK_CORPSE_EXPLOSION_VISUAL,
+ static_cast<uint32>(spellInfo->Effects[EFFECT_1].CalcValue())
+ });
}
void CheckTarget(WorldObject*& target)
{
if (CorpseExplosionCheck(GetCaster()->GetGUID(), true)(target))
- target = NULL;
+ target = nullptr;
_target = target;
}
@@ -698,7 +682,7 @@ class spell_dk_corpse_explosion : public SpellScriptLoader
if (effIndex == EFFECT_0)
GetCaster()->CastCustomSpell(GetSpellInfo()->Effects[EFFECT_1].CalcValue(), SPELLVALUE_BASE_POINT0, GetEffectValue(), target, true);
else if (effIndex == EFFECT_1)
- GetCaster()->CastCustomSpell(GetEffectValue(), SPELLVALUE_BASE_POINT0, GetSpell()->CalculateDamage(EFFECT_0, NULL), target, true);
+ GetCaster()->CastCustomSpell(GetEffectValue(), SPELLVALUE_BASE_POINT0, GetSpell()->CalculateDamage(EFFECT_0, nullptr), target, true);
}
void HandleCorpseExplosion(SpellEffIndex effIndex)
@@ -729,8 +713,7 @@ class spell_dk_corpse_explosion : public SpellScriptLoader
OnEffectHitTarget += SpellEffectFn(spell_dk_corpse_explosion_SpellScript::HandleCorpseExplosion, EFFECT_1, SPELL_EFFECT_DUMMY);
}
- private:
- WorldObject* _target;
+ WorldObject* _target = nullptr;
};
SpellScript* GetSpellScript() const override
@@ -814,7 +797,7 @@ class spell_dk_death_and_decay : public SpellScriptLoader
void HandleDummyTick(AuraEffect const* aurEff)
{
if (Unit* caster = GetCaster())
- caster->CastCustomSpell(SPELL_DK_DEATH_AND_DECAY_DAMAGE, SPELLVALUE_BASE_POINT0, aurEff->GetAmount(), GetTarget(), true, NULL, aurEff);
+ caster->CastCustomSpell(SPELL_DK_DEATH_AND_DECAY_DAMAGE, SPELLVALUE_BASE_POINT0, aurEff->GetAmount(), GetTarget(), true, nullptr, aurEff);
}
void Register() override
@@ -841,9 +824,7 @@ class spell_dk_death_coil : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DK_DEATH_COIL_DAMAGE) || !sSpellMgr->GetSpellInfo(SPELL_DK_DEATH_COIL_HEAL))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DK_DEATH_COIL_DAMAGE, SPELL_DK_DEATH_COIL_HEAL });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -855,13 +836,13 @@ class spell_dk_death_coil : public SpellScriptLoader
if (caster->IsFriendlyTo(target))
{
int32 bp = int32(damage * 1.5f);
- caster->CastCustomSpell(target, SPELL_DK_DEATH_COIL_HEAL, &bp, NULL, NULL, true);
+ caster->CastCustomSpell(target, SPELL_DK_DEATH_COIL_HEAL, &bp, nullptr, nullptr, true);
}
else
{
if (AuraEffect const* auraEffect = caster->GetAuraEffect(SPELL_DK_ITEM_SIGIL_VENGEFUL_HEART, EFFECT_1))
damage += auraEffect->GetBaseAmount();
- caster->CastCustomSpell(target, SPELL_DK_DEATH_COIL_DAMAGE, &damage, NULL, NULL, true);
+ caster->CastCustomSpell(target, SPELL_DK_DEATH_COIL_DAMAGE, &damage, nullptr, nullptr, true);
}
}
}
@@ -998,7 +979,7 @@ class spell_dk_death_pact : public SpellScriptLoader
void FilterTargets(std::list<WorldObject*>& targetList)
{
- Unit* target = NULL;
+ Unit* target = nullptr;
for (std::list<WorldObject*>::iterator itr = targetList.begin(); itr != targetList.end(); ++itr)
{
if (Unit* unit = (*itr)->ToUnit())
@@ -1117,9 +1098,7 @@ class spell_dk_death_strike : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DK_DEATH_STRIKE_HEAL))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DK_DEATH_STRIKE_HEAL });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -1132,7 +1111,7 @@ class spell_dk_death_strike : public SpellScriptLoader
// Improved Death Strike
if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_AURA_ADD_PCT_MODIFIER, SPELLFAMILY_DEATHKNIGHT, DK_ICON_ID_IMPROVED_DEATH_STRIKE, 0))
AddPct(bp, caster->CalculateSpellDamage(caster, aurEff->GetSpellInfo(), 2));
- caster->CastCustomSpell(caster, SPELL_DK_DEATH_STRIKE_HEAL, &bp, NULL, NULL, false);
+ caster->CastCustomSpell(caster, SPELL_DK_DEATH_STRIKE_HEAL, &bp, nullptr, nullptr, false);
}
}
@@ -1161,10 +1140,8 @@ class spell_dk_ghoul_explode : public SpellScriptLoader
bool Validate(SpellInfo const* spellInfo) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DK_CORPSE_EXPLOSION_TRIGGERED)
- || spellInfo->Effects[EFFECT_2].CalcValue() <= 0)
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DK_CORPSE_EXPLOSION_TRIGGERED }) &&
+ spellInfo->Effects[EFFECT_2].CalcValue() > 0;
}
void HandleDamage(SpellEffIndex /*effIndex*/)
@@ -1209,9 +1186,7 @@ class spell_dk_glyph_of_death_grip : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DK_DEATH_GRIP_INITIAL))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DK_DEATH_GRIP_INITIAL });
}
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
@@ -1244,9 +1219,7 @@ class spell_dk_glyph_of_scourge_strike : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DK_GLYPH_OF_SCOURGE_STRIKE_SCRIPT))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DK_GLYPH_OF_SCOURGE_STRIKE_SCRIPT });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -1359,19 +1332,20 @@ class spell_dk_improved_blood_presence : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DK_BLOOD_PRESENCE)
- || !sSpellMgr->GetSpellInfo(SPELL_DK_FROST_PRESENCE)
- || !sSpellMgr->GetSpellInfo(SPELL_DK_UNHOLY_PRESENCE)
- || !sSpellMgr->GetSpellInfo(SPELL_DK_IMPROVED_BLOOD_PRESENCE_TRIGGERED))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_DK_BLOOD_PRESENCE,
+ SPELL_DK_FROST_PRESENCE,
+ SPELL_DK_UNHOLY_PRESENCE,
+ SPELL_DK_IMPROVED_BLOOD_PRESENCE_TRIGGERED
+ });
}
void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
if ((target->HasAura(SPELL_DK_FROST_PRESENCE) || target->HasAura(SPELL_DK_UNHOLY_PRESENCE)) && !target->HasAura(SPELL_DK_IMPROVED_BLOOD_PRESENCE_TRIGGERED))
- target->CastCustomSpell(SPELL_DK_IMPROVED_BLOOD_PRESENCE_TRIGGERED, SPELLVALUE_BASE_POINT1, aurEff->GetAmount(), target, true, NULL, aurEff);
+ target->CastCustomSpell(SPELL_DK_IMPROVED_BLOOD_PRESENCE_TRIGGERED, SPELLVALUE_BASE_POINT1, aurEff->GetAmount(), target, true, nullptr, aurEff);
}
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -1406,9 +1380,7 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DK_IMPROVED_BLOOD_PRESENCE_HEAL))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DK_IMPROVED_BLOOD_PRESENCE_HEAL });
}
bool CheckProc(ProcEventInfo& eventInfo)
@@ -1452,19 +1424,20 @@ class spell_dk_improved_frost_presence : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DK_BLOOD_PRESENCE)
- || !sSpellMgr->GetSpellInfo(SPELL_DK_FROST_PRESENCE)
- || !sSpellMgr->GetSpellInfo(SPELL_DK_UNHOLY_PRESENCE)
- || !sSpellMgr->GetSpellInfo(SPELL_DK_FROST_PRESENCE_TRIGGERED))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_DK_BLOOD_PRESENCE,
+ SPELL_DK_FROST_PRESENCE,
+ SPELL_DK_UNHOLY_PRESENCE,
+ SPELL_DK_FROST_PRESENCE_TRIGGERED
+ });
}
void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
if ((target->HasAura(SPELL_DK_BLOOD_PRESENCE) || target->HasAura(SPELL_DK_UNHOLY_PRESENCE)) && !target->HasAura(SPELL_DK_FROST_PRESENCE_TRIGGERED))
- target->CastCustomSpell(SPELL_DK_FROST_PRESENCE_TRIGGERED, SPELLVALUE_BASE_POINT0, aurEff->GetAmount(), target, true, NULL, aurEff);
+ target->CastCustomSpell(SPELL_DK_FROST_PRESENCE_TRIGGERED, SPELLVALUE_BASE_POINT0, aurEff->GetAmount(), target, true, nullptr, aurEff);
}
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -1499,13 +1472,14 @@ class spell_dk_improved_unholy_presence : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DK_BLOOD_PRESENCE)
- || !sSpellMgr->GetSpellInfo(SPELL_DK_FROST_PRESENCE)
- || !sSpellMgr->GetSpellInfo(SPELL_DK_UNHOLY_PRESENCE)
- || !sSpellMgr->GetSpellInfo(SPELL_DK_IMPROVED_UNHOLY_PRESENCE_TRIGGERED)
- || !sSpellMgr->GetSpellInfo(SPELL_DK_UNHOLY_PRESENCE_TRIGGERED))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_DK_BLOOD_PRESENCE,
+ SPELL_DK_FROST_PRESENCE,
+ SPELL_DK_UNHOLY_PRESENCE,
+ SPELL_DK_IMPROVED_UNHOLY_PRESENCE_TRIGGERED,
+ SPELL_DK_UNHOLY_PRESENCE_TRIGGERED
+ });
}
void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
@@ -1515,11 +1489,11 @@ class spell_dk_improved_unholy_presence : public SpellScriptLoader
{
// Not listed as any effect, only base points set in dbc
int32 basePoints = GetSpellInfo()->Effects[EFFECT_1].CalcValue();
- target->CastCustomSpell(target, SPELL_DK_IMPROVED_UNHOLY_PRESENCE_TRIGGERED, &basePoints, &basePoints, &basePoints, true, NULL, aurEff);
+ target->CastCustomSpell(target, SPELL_DK_IMPROVED_UNHOLY_PRESENCE_TRIGGERED, &basePoints, &basePoints, &basePoints, true, nullptr, aurEff);
}
if ((target->HasAura(SPELL_DK_BLOOD_PRESENCE) || target->HasAura(SPELL_DK_FROST_PRESENCE)) && !target->HasAura(SPELL_DK_UNHOLY_PRESENCE_TRIGGERED))
- target->CastCustomSpell(SPELL_DK_UNHOLY_PRESENCE_TRIGGERED, SPELLVALUE_BASE_POINT0, aurEff->GetAmount(), target, true, NULL, aurEff);
+ target->CastCustomSpell(SPELL_DK_UNHOLY_PRESENCE_TRIGGERED, SPELLVALUE_BASE_POINT0, aurEff->GetAmount(), target, true, nullptr, aurEff);
}
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -1557,9 +1531,7 @@ class spell_dk_pvp_4p_bonus : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DK_RUNIC_RETURN))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DK_RUNIC_RETURN });
}
bool CheckProc(ProcEventInfo& eventInfo)
@@ -1602,9 +1574,7 @@ class spell_dk_mark_of_blood : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DK_MARK_OF_BLOOD_HEAL))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DK_MARK_OF_BLOOD_HEAL });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -1637,9 +1607,7 @@ class spell_dk_necrosis : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DK_NECROSIS_DAMAGE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DK_NECROSIS_DAMAGE });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -1678,11 +1646,12 @@ class spell_dk_pestilence : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DK_GLYPH_OF_DISEASE)
- || !sSpellMgr->GetSpellInfo(SPELL_DK_BLOOD_PLAGUE)
- || !sSpellMgr->GetSpellInfo(SPELL_DK_FROST_FEVER))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_DK_GLYPH_OF_DISEASE,
+ SPELL_DK_BLOOD_PLAGUE,
+ SPELL_DK_FROST_FEVER
+ });
}
void OnHit(SpellEffIndex /*effIndex*/)
@@ -1765,19 +1734,19 @@ class spell_dk_presence : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DK_BLOOD_PRESENCE)
- || !sSpellMgr->GetSpellInfo(SPELL_DK_FROST_PRESENCE)
- || !sSpellMgr->GetSpellInfo(SPELL_DK_UNHOLY_PRESENCE)
- || !sSpellMgr->GetSpellInfo(SPELL_DK_IMPROVED_BLOOD_PRESENCE_R1)
- || !sSpellMgr->GetSpellInfo(SPELL_DK_IMPROVED_FROST_PRESENCE_R1)
- || !sSpellMgr->GetSpellInfo(SPELL_DK_IMPROVED_UNHOLY_PRESENCE_R1)
- || !sSpellMgr->GetSpellInfo(SPELL_DK_IMPROVED_BLOOD_PRESENCE_TRIGGERED)
- || !sSpellMgr->GetSpellInfo(SPELL_DK_IMPROVED_UNHOLY_PRESENCE_TRIGGERED)
- || !sSpellMgr->GetSpellInfo(SPELL_DK_FROST_PRESENCE_TRIGGERED)
- || !sSpellMgr->GetSpellInfo(SPELL_DK_UNHOLY_PRESENCE_TRIGGERED))
- return false;
-
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_DK_BLOOD_PRESENCE,
+ SPELL_DK_FROST_PRESENCE,
+ SPELL_DK_UNHOLY_PRESENCE,
+ SPELL_DK_IMPROVED_BLOOD_PRESENCE_R1,
+ SPELL_DK_IMPROVED_FROST_PRESENCE_R1,
+ SPELL_DK_IMPROVED_UNHOLY_PRESENCE_R1,
+ SPELL_DK_IMPROVED_BLOOD_PRESENCE_TRIGGERED,
+ SPELL_DK_IMPROVED_UNHOLY_PRESENCE_TRIGGERED,
+ SPELL_DK_FROST_PRESENCE_TRIGGERED,
+ SPELL_DK_UNHOLY_PRESENCE_TRIGGERED
+ });
}
void HandleImprovedBloodPresence(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
@@ -1788,7 +1757,7 @@ class spell_dk_presence : public SpellScriptLoader
target->CastSpell(target, SPELL_DK_IMPROVED_BLOOD_PRESENCE_TRIGGERED, true);
else if (AuraEffect const* impAurEff = target->GetAuraEffectOfRankedSpell(SPELL_DK_IMPROVED_BLOOD_PRESENCE_R1, EFFECT_0))
if (!target->HasAura(SPELL_DK_IMPROVED_BLOOD_PRESENCE_TRIGGERED))
- target->CastCustomSpell(SPELL_DK_IMPROVED_BLOOD_PRESENCE_TRIGGERED, SPELLVALUE_BASE_POINT1, impAurEff->GetAmount(), target, true, NULL, aurEff);
+ target->CastCustomSpell(SPELL_DK_IMPROVED_BLOOD_PRESENCE_TRIGGERED, SPELLVALUE_BASE_POINT1, impAurEff->GetAmount(), target, true, nullptr, aurEff);
}
void HandleImprovedFrostPresence(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
@@ -1799,7 +1768,7 @@ class spell_dk_presence : public SpellScriptLoader
target->CastSpell(target, SPELL_DK_FROST_PRESENCE_TRIGGERED, true);
else if (AuraEffect const* impAurEff = target->GetAuraEffectOfRankedSpell(SPELL_DK_IMPROVED_FROST_PRESENCE_R1, EFFECT_0))
if (!target->HasAura(SPELL_DK_FROST_PRESENCE_TRIGGERED))
- target->CastCustomSpell(SPELL_DK_FROST_PRESENCE_TRIGGERED, SPELLVALUE_BASE_POINT0, impAurEff->GetAmount(), target, true, NULL, aurEff);
+ target->CastCustomSpell(SPELL_DK_FROST_PRESENCE_TRIGGERED, SPELLVALUE_BASE_POINT0, impAurEff->GetAmount(), target, true, nullptr, aurEff);
}
void HandleImprovedUnholyPresence(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
@@ -1815,10 +1784,10 @@ class spell_dk_presence : public SpellScriptLoader
{
// Not listed as any effect, only base points set
int32 bp = impAurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue();
- target->CastCustomSpell(target, SPELL_DK_IMPROVED_UNHOLY_PRESENCE_TRIGGERED, &bp, &bp, &bp, true, NULL, aurEff);
+ target->CastCustomSpell(target, SPELL_DK_IMPROVED_UNHOLY_PRESENCE_TRIGGERED, &bp, &bp, &bp, true, nullptr, aurEff);
}
else if (!target->HasAura(SPELL_DK_UNHOLY_PRESENCE_TRIGGERED))
- target->CastCustomSpell(SPELL_DK_UNHOLY_PRESENCE_TRIGGERED, SPELLVALUE_BASE_POINT0, impAurEff->GetAmount(), target, true, NULL, aurEff);
+ target->CastCustomSpell(SPELL_DK_UNHOLY_PRESENCE_TRIGGERED, SPELLVALUE_BASE_POINT0, impAurEff->GetAmount(), target, true, nullptr, aurEff);
}
}
@@ -1879,22 +1848,15 @@ class spell_dk_raise_dead : public SpellScriptLoader
{
PrepareSpellScript(spell_dk_raise_dead_SpellScript);
- public:
- spell_dk_raise_dead_SpellScript()
- {
- _result = SPELL_CAST_OK;
- _corpse = false;
- }
-
- private:
bool Validate(SpellInfo const* spellInfo) override
{
- if (!sSpellMgr->GetSpellInfo(spellInfo->Effects[EFFECT_1].CalcValue())
- || !sSpellMgr->GetSpellInfo(spellInfo->Effects[EFFECT_2].CalcValue())
- || !sSpellMgr->GetSpellInfo(SPELL_DK_RAISE_DEAD_USE_REAGENT)
- || !sSpellMgr->GetSpellInfo(SPELL_DK_MASTER_OF_GHOULS))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ static_cast<uint32>(spellInfo->Effects[EFFECT_1].CalcValue()),
+ static_cast<uint32>(spellInfo->Effects[EFFECT_2].CalcValue()),
+ SPELL_DK_RAISE_DEAD_USE_REAGENT,
+ SPELL_DK_MASTER_OF_GHOULS
+ });
}
bool Load() override
@@ -1957,7 +1919,7 @@ class spell_dk_raise_dead : public SpellScriptLoader
{
// Don't add caster to target map, if we found a corpse to raise dead
if (_corpse)
- target = NULL;
+ target = nullptr;
}
void ConsumeReagents()
@@ -1984,7 +1946,7 @@ class spell_dk_raise_dead : public SpellScriptLoader
SpellCastTargets targets;
targets.SetDst(*GetHitUnit());
- GetCaster()->CastSpell(targets, spellInfo, NULL, TRIGGERED_FULL_MASK);
+ GetCaster()->CastSpell(targets, spellInfo, nullptr, TRIGGERED_FULL_MASK);
}
void OverrideCooldown()
@@ -2007,9 +1969,8 @@ class spell_dk_raise_dead : public SpellScriptLoader
AfterCast += SpellCastFn(spell_dk_raise_dead_SpellScript::OverrideCooldown);
}
- private:
- SpellCastResult _result;
- bool _corpse;
+ SpellCastResult _result = SPELL_CAST_OK;
+ bool _corpse = false;
};
SpellScript* GetSpellScript() const override
@@ -2094,15 +2055,13 @@ class spell_dk_scent_of_blood : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DK_SCENT_OF_BLOOD))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DK_SCENT_OF_BLOOD });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/)
{
PreventDefaultAction();
- GetTarget()->CastSpell(GetTarget(), SPELL_DK_SCENT_OF_BLOOD, true, NULL, aurEff);
+ GetTarget()->CastSpell(GetTarget(), SPELL_DK_SCENT_OF_BLOOD, true, nullptr, aurEff);
ModStackAmount(-1);
}
@@ -2170,9 +2129,7 @@ class spell_dk_scourge_strike : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DK_SCOURGE_STRIKE_TRIGGERED))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DK_SCOURGE_STRIKE_TRIGGERED });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -2197,7 +2154,7 @@ class spell_dk_scourge_strike : public SpellScriptLoader
if (AuraEffect* aurEff = caster->GetAuraEffectOfRankedSpell(SPELL_DK_BLACK_ICE_R1, EFFECT_0))
AddPct(bp, aurEff->GetAmount());
- caster->CastCustomSpell(unitTarget, SPELL_DK_SCOURGE_STRIKE_TRIGGERED, &bp, NULL, NULL, true);
+ caster->CastCustomSpell(unitTarget, SPELL_DK_SCOURGE_STRIKE_TRIGGERED, &bp, nullptr, nullptr, true);
}
}
@@ -2277,9 +2234,7 @@ class spell_dk_sudden_doom : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DK_DEATH_COIL_R1))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DK_DEATH_COIL_R1 });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -2329,14 +2284,15 @@ class spell_dk_threat_of_thassarian : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DK_OBLITERATE_OFF_HAND_R1) ||
- !sSpellMgr->GetSpellInfo(SPELL_DK_FROST_STRIKE_OFF_HAND_R1) ||
- !sSpellMgr->GetSpellInfo(SPELL_DK_PLAGUE_STRIKE_OFF_HAND_R1) ||
- !sSpellMgr->GetSpellInfo(SPELL_DK_DEATH_STRIKE_OFF_HAND_R1) ||
- !sSpellMgr->GetSpellInfo(SPELL_DK_RUNE_STRIKE_OFF_HAND_R1) ||
- !sSpellMgr->GetSpellInfo(SPELL_DK_BLOOD_STRIKE_OFF_HAND_R1))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_DK_OBLITERATE_OFF_HAND_R1,
+ SPELL_DK_FROST_STRIKE_OFF_HAND_R1,
+ SPELL_DK_PLAGUE_STRIKE_OFF_HAND_R1,
+ SPELL_DK_DEATH_STRIKE_OFF_HAND_R1,
+ SPELL_DK_RUNE_STRIKE_OFF_HAND_R1,
+ SPELL_DK_BLOOD_STRIKE_OFF_HAND_R1
+ });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -2406,10 +2362,11 @@ class spell_dk_unholy_blight : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DK_UNHOLY_BLIGHT_DAMAGE) ||
- !sSpellMgr->GetSpellInfo(SPELL_DK_GLYPH_OF_UNHOLY_BLIGHT))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_DK_UNHOLY_BLIGHT_DAMAGE,
+ SPELL_DK_GLYPH_OF_UNHOLY_BLIGHT
+ });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -2486,9 +2443,7 @@ class spell_dk_vendetta : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DK_VENDETTA_HEAL))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DK_VENDETTA_HEAL });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -2523,9 +2478,7 @@ class spell_dk_wandering_plague : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DK_WANDERING_PLAGUE_DAMAGE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DK_WANDERING_PLAGUE_DAMAGE });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -2566,13 +2519,6 @@ class spell_dk_will_of_the_necropolis : public SpellScriptLoader
{
PrepareAuraScript(spell_dk_will_of_the_necropolis_AuraScript);
- public:
- spell_dk_will_of_the_necropolis_AuraScript()
- {
- absorbPct = 0;
- }
-
- private:
bool Validate(SpellInfo const* spellInfo) override
{
SpellInfo const* firstRankSpellInfo = sSpellMgr->GetSpellInfo(SPELL_DK_WILL_OF_THE_NECROPOLIS_AURA_R1);
@@ -2590,7 +2536,7 @@ class spell_dk_will_of_the_necropolis : public SpellScriptLoader
return true;
}
- uint32 absorbPct;
+ uint32 absorbPct = 0;
bool Load() override
{
@@ -2707,9 +2653,7 @@ public:
bool Validate(SpellInfo const* spellInfo) override
{
- if (!sSpellMgr->GetSpellInfo(uint32(spellInfo->Effects[EFFECT_0].CalcValue())))
- return false;
- return true;
+ return ValidateSpellInfo({ static_cast<uint32>(spellInfo->Effects[EFFECT_0].CalcValue()) });
}
bool Load() override
@@ -2778,11 +2722,12 @@ class player_ghoulAI : public PlayerAI
};
// 46619 - Raise Ally
-#define DkRaiseAllyScriptName "spell_dk_raise_ally"
class spell_dk_raise_ally : public SpellScriptLoader
{
public:
- spell_dk_raise_ally() : SpellScriptLoader(DkRaiseAllyScriptName) { }
+ static char constexpr const ScriptName[] = "spell_dk_raise_ally";
+
+ spell_dk_raise_ally() : SpellScriptLoader(ScriptName) { }
class spell_dk_raise_ally_SpellScript : public SpellScript
{
@@ -2825,7 +2770,7 @@ public:
Default SUMMON_CATEGORY_PUPPET behaviour sets possesor as originalCaster,
in this case we need caster as possesor and originalCaster as owner
*/
- //summon->RemoveCharmedBy(NULL);
+ //summon->RemoveCharmedBy(nullptr);
summon->SetCharmedBy(caster, CHARM_TYPE_POSSESS);
@@ -2849,7 +2794,7 @@ public:
void SetGhoul(SpellEffIndex /*effIndex*/)
{
if (Aura* aura = GetHitAura())
- if (spell_dk_raise_ally_AuraScript* script = dynamic_cast<spell_dk_raise_ally_AuraScript*>(aura->GetScriptByName(DkRaiseAllyScriptName)))
+ if (spell_dk_raise_ally_AuraScript* script = aura->GetScript<spell_dk_raise_ally_AuraScript>(ScriptName))
script->SetGhoulGuid(_ghoulGuid);
}
@@ -2874,12 +2819,6 @@ public:
PrepareAuraScript(spell_dk_raise_ally_AuraScript);
public:
- spell_dk_raise_ally_AuraScript()
- {
- oldAI = nullptr;
- oldAIState = false;
- }
-
void SetGhoulGuid(ObjectGuid guid)
{
ghoulGuid = guid;
@@ -2929,8 +2868,8 @@ public:
}
ObjectGuid ghoulGuid;
- PlayerAI* oldAI;
- bool oldAIState;
+ PlayerAI* oldAI = nullptr;
+ bool oldAIState = false;
};
AuraScript* GetAuraScript() const override
@@ -2938,6 +2877,7 @@ public:
return new spell_dk_raise_ally_AuraScript();
}
};
+char constexpr const spell_dk_raise_ally::ScriptName[];
// 47480 - Thrash
class spell_dk_ghoul_thrash : public SpellScriptLoader
@@ -2951,9 +2891,7 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_GHOUL_FRENZY))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_GHOUL_FRENZY });
}
void CalcDamage()
diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp
index 11a47b025d8..d57bd1e3008 100644
--- a/src/server/scripts/Spells/spell_druid.cpp
+++ b/src/server/scripts/Spells/spell_druid.cpp
@@ -21,12 +21,14 @@
* Scriptnames of files in this file should be prefixed with "spell_dru_".
*/
-#include "Player.h"
-#include "GameTime.h"
#include "ScriptMgr.h"
-#include "SpellScript.h"
-#include "SpellAuraEffects.h"
#include "Containers.h"
+#include "GameTime.h"
+#include "Player.h"
+#include "SpellAuraEffects.h"
+#include "SpellHistory.h"
+#include "SpellMgr.h"
+#include "SpellScript.h"
enum DruidSpells
{
@@ -101,9 +103,7 @@ class spell_dru_barkskin : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DRUID_BARKSKIN_01))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DRUID_BARKSKIN_01 });
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -136,10 +136,11 @@ class spell_dru_bear_form_passive : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DRUID_ENRAGE)
- || !sSpellMgr->GetSpellInfo(SPELL_DRUID_ITEM_T10_FERAL_4P_BONUS))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_DRUID_ENRAGE,
+ SPELL_DRUID_ITEM_T10_FERAL_4P_BONUS
+ });
}
void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
@@ -215,11 +216,11 @@ class spell_dru_eclipse : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DRUID_ECLIPSE_LUNAR_PROC))
- return false;
- if (!sSpellMgr->GetSpellInfo(SPELL_DRUID_ECLIPSE_SOLAR_PROC))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_DRUID_ECLIPSE_LUNAR_PROC,
+ SPELL_DRUID_ECLIPSE_SOLAR_PROC
+ });
}
bool CheckProc(ProcEventInfo& eventInfo)
@@ -301,12 +302,13 @@ class spell_dru_enrage : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DRUID_KING_OF_THE_JUNGLE)
- || !sSpellMgr->GetSpellInfo(SPELL_DRUID_ENRAGE_MOD_DAMAGE)
- || !sSpellMgr->GetSpellInfo(SPELL_DRUID_ENRAGED_DEFENSE)
- || !sSpellMgr->GetSpellInfo(SPELL_DRUID_ITEM_T10_FERAL_4P_BONUS))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_DRUID_KING_OF_THE_JUNGLE,
+ SPELL_DRUID_ENRAGE_MOD_DAMAGE,
+ SPELL_DRUID_ENRAGED_DEFENSE,
+ SPELL_DRUID_ITEM_T10_FERAL_4P_BONUS
+ });
}
void RecalculateBaseArmor()
@@ -370,13 +372,14 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DRUID_FORMS_TRINKET_BEAR) ||
- !sSpellMgr->GetSpellInfo(SPELL_DRUID_FORMS_TRINKET_CAT) ||
- !sSpellMgr->GetSpellInfo(SPELL_DRUID_FORMS_TRINKET_MOONKIN) ||
- !sSpellMgr->GetSpellInfo(SPELL_DRUID_FORMS_TRINKET_NONE) ||
- !sSpellMgr->GetSpellInfo(SPELL_DRUID_FORMS_TRINKET_TREE))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_DRUID_FORMS_TRINKET_BEAR,
+ SPELL_DRUID_FORMS_TRINKET_CAT,
+ SPELL_DRUID_FORMS_TRINKET_MOONKIN,
+ SPELL_DRUID_FORMS_TRINKET_NONE,
+ SPELL_DRUID_FORMS_TRINKET_TREE
+ });
}
bool CheckProc(ProcEventInfo& eventInfo)
@@ -486,9 +489,7 @@ class spell_dru_glyph_of_barkskin : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DRUID_BARKSKIN_01))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DRUID_BARKSKIN_01 });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -521,9 +522,7 @@ class spell_dru_glyph_of_innervate : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DRUID_GLYPH_OF_INNERVATE_REGEN))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DRUID_GLYPH_OF_INNERVATE_REGEN });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -562,9 +561,7 @@ class spell_dru_glyph_of_rake : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DRUID_GLYPH_OF_RAKE_TRIGGERED))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DRUID_GLYPH_OF_RAKE_TRIGGERED });
}
bool CheckProc(ProcEventInfo& eventInfo)
@@ -603,9 +600,7 @@ class spell_dru_glyph_of_rejuvenation : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DRUID_GLYPH_OF_REJUVENATION_HEAL))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DRUID_GLYPH_OF_REJUVENATION_HEAL });
}
bool CheckProc(ProcEventInfo& eventInfo)
@@ -649,10 +644,11 @@ class spell_dru_glyph_of_shred : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DRUID_GLYPH_OF_RIP) ||
- !sSpellMgr->GetSpellInfo(SPELL_DRUID_RIP_DURATION_LACERATE_DMG))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_DRUID_GLYPH_OF_RIP,
+ SPELL_DRUID_RIP_DURATION_LACERATE_DMG
+ });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -708,9 +704,7 @@ class spell_dru_glyph_of_starfire : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DRUID_INCREASED_MOONFIRE_DURATION) || !sSpellMgr->GetSpellInfo(SPELL_DRUID_NATURES_SPLENDOR))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DRUID_INCREASED_MOONFIRE_DURATION, SPELL_DRUID_NATURES_SPLENDOR });
}
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
@@ -762,9 +756,7 @@ class spell_dru_glyph_of_starfire_dummy : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DRUID_GLYPH_OF_STARFIRE_SCRIPT))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DRUID_GLYPH_OF_STARFIRE_SCRIPT });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -892,11 +884,12 @@ class spell_dru_leader_of_the_pack : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DRUID_IMP_LEADER_OF_THE_PACK_R1) ||
- !sSpellMgr->GetSpellInfo(SPELL_DRUID_IMP_LEADER_OF_THE_PACK_HEAL) ||
- !sSpellMgr->GetSpellInfo(SPELL_DRUID_IMP_LEADER_OF_THE_PACK_MANA))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_DRUID_IMP_LEADER_OF_THE_PACK_R1,
+ SPELL_DRUID_IMP_LEADER_OF_THE_PACK_HEAL,
+ SPELL_DRUID_IMP_LEADER_OF_THE_PACK_MANA
+ });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -951,11 +944,11 @@ class spell_dru_lifebloom : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DRUID_LIFEBLOOM_FINAL_HEAL))
- return false;
- if (!sSpellMgr->GetSpellInfo(SPELL_DRUID_LIFEBLOOM_ENERGIZE))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_DRUID_LIFEBLOOM_FINAL_HEAL,
+ SPELL_DRUID_LIFEBLOOM_ENERGIZE
+ });
}
void AfterRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
@@ -972,15 +965,15 @@ class spell_dru_lifebloom : public SpellScriptLoader
healAmount = caster->SpellHealingBonusDone(GetTarget(), GetSpellInfo(), healAmount, HEAL, stack);
healAmount = GetTarget()->SpellHealingBonusTaken(caster, GetSpellInfo(), healAmount, HEAL, stack);
- GetTarget()->CastCustomSpell(GetTarget(), SPELL_DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, aurEff, GetCasterGUID());
+ GetTarget()->CastCustomSpell(GetTarget(), SPELL_DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, nullptr, nullptr, true, nullptr, aurEff, GetCasterGUID());
// restore mana
int32 returnMana = CalculatePct(caster->GetCreateMana(), GetSpellInfo()->ManaCostPercentage) * stack / 2;
- caster->CastCustomSpell(caster, SPELL_DRUID_LIFEBLOOM_ENERGIZE, &returnMana, NULL, NULL, true, NULL, aurEff, GetCasterGUID());
+ caster->CastCustomSpell(caster, SPELL_DRUID_LIFEBLOOM_ENERGIZE, &returnMana, nullptr, nullptr, true, nullptr, aurEff, GetCasterGUID());
return;
}
- GetTarget()->CastCustomSpell(GetTarget(), SPELL_DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, aurEff, GetCasterGUID());
+ GetTarget()->CastCustomSpell(GetTarget(), SPELL_DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, nullptr, nullptr, true, nullptr, aurEff, GetCasterGUID());
}
void HandleDispel(DispelInfo* dispelInfo)
@@ -995,15 +988,15 @@ class spell_dru_lifebloom : public SpellScriptLoader
{
healAmount = caster->SpellHealingBonusDone(target, GetSpellInfo(), healAmount, HEAL, dispelInfo->GetRemovedCharges());
healAmount = target->SpellHealingBonusTaken(caster, GetSpellInfo(), healAmount, HEAL, dispelInfo->GetRemovedCharges());
- target->CastCustomSpell(target, SPELL_DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, NULL, GetCasterGUID());
+ target->CastCustomSpell(target, SPELL_DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, nullptr, nullptr, true, nullptr, nullptr, GetCasterGUID());
// restore mana
int32 returnMana = CalculatePct(caster->GetCreateMana(), GetSpellInfo()->ManaCostPercentage) * dispelInfo->GetRemovedCharges() / 2;
- caster->CastCustomSpell(caster, SPELL_DRUID_LIFEBLOOM_ENERGIZE, &returnMana, NULL, NULL, true, NULL, NULL, GetCasterGUID());
+ caster->CastCustomSpell(caster, SPELL_DRUID_LIFEBLOOM_ENERGIZE, &returnMana, nullptr, nullptr, true, nullptr, nullptr, GetCasterGUID());
return;
}
- target->CastCustomSpell(target, SPELL_DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, NULL, GetCasterGUID());
+ target->CastCustomSpell(target, SPELL_DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, nullptr, nullptr, true, nullptr, nullptr, GetCasterGUID());
}
}
}
@@ -1033,9 +1026,7 @@ class spell_dru_living_seed : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DRUID_LIVING_SEED_PROC))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DRUID_LIVING_SEED_PROC });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -1074,15 +1065,13 @@ class spell_dru_living_seed_proc : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DRUID_LIVING_SEED_HEAL))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DRUID_LIVING_SEED_HEAL });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/)
{
PreventDefaultAction();
- GetTarget()->CastCustomSpell(SPELL_DRUID_LIVING_SEED_HEAL, SPELLVALUE_BASE_POINT0, aurEff->GetAmount(), GetTarget(), true, NULL, aurEff);
+ GetTarget()->CastCustomSpell(SPELL_DRUID_LIVING_SEED_HEAL, SPELLVALUE_BASE_POINT0, aurEff->GetAmount(), GetTarget(), true, nullptr, aurEff);
}
void Register() override
@@ -1160,10 +1149,11 @@ class spell_dru_omen_of_clarity : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DRUID_BALANCE_T10_BONUS) ||
- !sSpellMgr->GetSpellInfo(SPELL_DRUID_BALANCE_T10_BONUS_PROC))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_DRUID_BALANCE_T10_BONUS,
+ SPELL_DRUID_BALANCE_T10_BONUS_PROC
+ });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/)
@@ -1304,12 +1294,13 @@ class spell_dru_revitalize : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DRUID_REVITALIZE_ENERGIZE_MANA) ||
- !sSpellMgr->GetSpellInfo(SPELL_DRUID_REVITALIZE_ENERGIZE_RAGE) ||
- !sSpellMgr->GetSpellInfo(SPELL_DRUID_REVITALIZE_ENERGIZE_ENERGY) ||
- !sSpellMgr->GetSpellInfo(SPELL_DRUID_REVITALIZE_ENERGIZE_RP))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_DRUID_REVITALIZE_ENERGIZE_MANA,
+ SPELL_DRUID_REVITALIZE_ENERGIZE_RAGE,
+ SPELL_DRUID_REVITALIZE_ENERGIZE_ENERGY,
+ SPELL_DRUID_REVITALIZE_ENERGIZE_RP
+ });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -1414,9 +1405,7 @@ class spell_dru_savage_defense : public SpellScriptLoader
bool Validate(SpellInfo const* spellInfo) override
{
- if (!sSpellMgr->GetSpellInfo(spellInfo->Effects[EFFECT_0].TriggerSpell))
- return false;
- return true;
+ return ValidateSpellInfo({ spellInfo->Effects[EFFECT_0].TriggerSpell });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -1470,15 +1459,13 @@ class spell_dru_savage_roar : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DRUID_SAVAGE_ROAR))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DRUID_SAVAGE_ROAR });
}
void AfterApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
- target->CastSpell(target, SPELL_DRUID_SAVAGE_ROAR, true, NULL, aurEff, GetCasterGUID());
+ target->CastSpell(target, SPELL_DRUID_SAVAGE_ROAR, true, nullptr, aurEff, GetCasterGUID());
}
void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -1608,9 +1595,7 @@ class spell_dru_survival_instincts : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DRUID_SURVIVAL_INSTINCTS))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DRUID_SURVIVAL_INSTINCTS });
}
void AfterApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
@@ -1746,11 +1731,12 @@ class spell_dru_t3_2p_bonus : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DRUID_T3_PROC_ENERGIZE_MANA) ||
- !sSpellMgr->GetSpellInfo(SPELL_DRUID_T3_PROC_ENERGIZE_RAGE) ||
- !sSpellMgr->GetSpellInfo(SPELL_DRUID_T3_PROC_ENERGIZE_ENERGY))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_DRUID_T3_PROC_ENERGIZE_MANA,
+ SPELL_DRUID_T3_PROC_ENERGIZE_RAGE,
+ SPELL_DRUID_T3_PROC_ENERGIZE_ENERGY
+ });
}
bool CheckProc(ProcEventInfo& /*eventInfo*/)
@@ -1809,9 +1795,7 @@ class spell_dru_t3_6p_bonus : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DRUID_BLESSING_OF_THE_CLAW))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DRUID_BLESSING_OF_THE_CLAW });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -1844,9 +1828,7 @@ class spell_dru_t3_8p_bonus : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DRUID_EXHILARATE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DRUID_EXHILARATE });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -1886,9 +1868,7 @@ class spell_dru_t4_2p_bonus : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DRUID_INFUSION))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DRUID_INFUSION });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -1921,11 +1901,11 @@ class spell_dru_item_t6_trinket : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DRUID_BLESSING_OF_REMULOS) ||
- !sSpellMgr->GetSpellInfo(SPELL_DRUID_BLESSING_OF_ELUNE) ||
- !sSpellMgr->GetSpellInfo(SPELL_DRUID_BLESSING_OF_CENARIUS))
- return false;
- return true;
+ return ValidateSpellInfo({
+ SPELL_DRUID_BLESSING_OF_REMULOS,
+ SPELL_DRUID_BLESSING_OF_ELUNE,
+ SPELL_DRUID_BLESSING_OF_CENARIUS
+ });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -1987,10 +1967,11 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DRUID_T9_FERAL_RELIC_BEAR) ||
- !sSpellMgr->GetSpellInfo(SPELL_DRUID_T9_FERAL_RELIC_CAT))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_DRUID_T9_FERAL_RELIC_BEAR,
+ SPELL_DRUID_T9_FERAL_RELIC_CAT
+ });
}
bool CheckProc(ProcEventInfo& eventInfo)
@@ -2058,9 +2039,7 @@ class spell_dru_t10_balance_4p_bonus : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DRUID_LANGUISH))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DRUID_LANGUISH });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -2162,9 +2141,7 @@ class spell_dru_t10_restoration_4p_bonus_dummy : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DRUID_REJUVENATION_T10_PROC))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DRUID_REJUVENATION_T10_PROC });
}
bool CheckProc(ProcEventInfo& eventInfo)
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp
index 3e9184acc94..cbec8270e18 100644
--- a/src/server/scripts/Spells/spell_generic.cpp
+++ b/src/server/scripts/Spells/spell_generic.cpp
@@ -23,21 +23,23 @@
*/
#include "ScriptMgr.h"
-#include "GameTime.h"
#include "Battleground.h"
-#include "Cell.h"
#include "CellImpl.h"
-#include "GridNotifiers.h"
+#include "DBCStores.h"
+#include "GameTime.h"
#include "GridNotifiersImpl.h"
#include "Group.h"
#include "InstanceScript.h"
+#include "Item.h"
#include "LFGMgr.h"
+#include "Log.h"
#include "Pet.h"
#include "ReputationMgr.h"
#include "SkillDiscovery.h"
+#include "SpellAuraEffects.h"
#include "SpellHistory.h"
+#include "SpellMgr.h"
#include "SpellScript.h"
-#include "SpellAuraEffects.h"
#include "Vehicle.h"
class spell_gen_absorb0_hitlimit1 : public SpellScriptLoader
@@ -49,14 +51,7 @@ class spell_gen_absorb0_hitlimit1 : public SpellScriptLoader
{
PrepareAuraScript(spell_gen_absorb0_hitlimit1_AuraScript);
- public:
- spell_gen_absorb0_hitlimit1_AuraScript()
- {
- limit = 0;
- }
-
- private:
- uint32 limit;
+ uint32 limit = 0;
bool Load() override
{
@@ -103,13 +98,14 @@ class spell_gen_adaptive_warding : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_GEN_ADAPTIVE_WARDING_FIRE) ||
- !sSpellMgr->GetSpellInfo(SPELL_GEN_ADAPTIVE_WARDING_NATURE) ||
- !sSpellMgr->GetSpellInfo(SPELL_GEN_ADAPTIVE_WARDING_FROST) ||
- !sSpellMgr->GetSpellInfo(SPELL_GEN_ADAPTIVE_WARDING_SHADOW) ||
- !sSpellMgr->GetSpellInfo(SPELL_GEN_ADAPTIVE_WARDING_ARCANE))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_GEN_ADAPTIVE_WARDING_FIRE,
+ SPELL_GEN_ADAPTIVE_WARDING_NATURE,
+ SPELL_GEN_ADAPTIVE_WARDING_FROST,
+ SPELL_GEN_ADAPTIVE_WARDING_SHADOW,
+ SPELL_GEN_ADAPTIVE_WARDING_ARCANE
+ });
}
bool CheckProc(ProcEventInfo& eventInfo)
@@ -219,9 +215,7 @@ class spell_gen_animal_blood : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SPAWN_BLOOD_POOL))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SPAWN_BLOOD_POOL });
}
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -301,9 +295,7 @@ class spell_gen_aura_service_uniform : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SERVICE_UNIFORM))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SERVICE_UNIFORM });
}
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -398,9 +390,7 @@ class spell_gen_bandage : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_RECENTLY_BANDAGED))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_RECENTLY_BANDAGED });
}
SpellCastResult CheckCast()
@@ -450,9 +440,7 @@ class spell_gen_blood_reserve : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_GEN_BLOOD_RESERVE_HEAL))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_GEN_BLOOD_RESERVE_HEAL });
}
bool CheckProc(ProcEventInfo& eventInfo)
@@ -563,10 +551,8 @@ class spell_gen_bonked : public SpellScriptLoader
target->RemoveAurasDueToSpell(SPELL_BONKED);
if (Aura const* auraOnGuard = target->GetAura(SPELL_ON_GUARD))
- {
if (Item* item = target->GetItemByGuid(auraOnGuard->GetCastItemGUID()))
target->DestroyItemCount(item->GetEntry(), 1, true);
- }
}
}
@@ -618,7 +604,7 @@ enum BreakShieldSpells
class spell_gen_break_shield: public SpellScriptLoader
{
public:
- spell_gen_break_shield(const char* name) : SpellScriptLoader(name) { }
+ spell_gen_break_shield(char const* name) : SpellScriptLoader(name) { }
class spell_gen_break_shield_SpellScript : public SpellScript
{
@@ -731,9 +717,7 @@ class spell_gen_burning_depths_necrolyte_image : public SpellScriptLoader
bool Validate(SpellInfo const* spellInfo) override
{
- if (!sSpellMgr->GetSpellInfo(uint32(spellInfo->Effects[EFFECT_2].CalcValue())))
- return false;
- return true;
+ return ValidateSpellInfo({ static_cast<uint32>(spellInfo->Effects[EFFECT_2].CalcValue()) });
}
void HandleApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -776,16 +760,14 @@ class spell_gen_cannibalize : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_CANNIBALIZE_TRIGGERED))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_CANNIBALIZE_TRIGGERED });
}
SpellCastResult CheckIfCorpseNear()
{
Unit* caster = GetCaster();
float max_range = GetSpellInfo()->GetMaxRange(false);
- WorldObject* result = NULL;
+ WorldObject* result = nullptr;
// search for nearby enemy corpse in range
Trinity::AnyDeadUnitSpellTargetInRangeCheck check(caster, max_range, GetSpellInfo(), TARGET_CHECK_ENEMY);
Trinity::WorldObjectSearcher<Trinity::AnyDeadUnitSpellTargetInRangeCheck> searcher(caster, result, check);
@@ -831,16 +813,14 @@ class spell_gen_chaos_blast : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_CHAOS_BLAST))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_CHAOS_BLAST });
}
void HandleDummy(SpellEffIndex /* effIndex */)
{
int32 basepoints0 = 100;
Unit* caster = GetCaster();
if (Unit* target = GetHitUnit())
- caster->CastCustomSpell(target, SPELL_CHAOS_BLAST, &basepoints0, NULL, NULL, true);
+ caster->CastCustomSpell(target, SPELL_CHAOS_BLAST, &basepoints0, nullptr, nullptr, true);
}
void Register() override
@@ -931,23 +911,17 @@ class spell_gen_clone_weapon_aura : public SpellScriptLoader
{
PrepareAuraScript(spell_gen_clone_weapon_auraScript);
- public:
- spell_gen_clone_weapon_auraScript()
- {
- prevItem = 0;
- }
-
- private:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON_AURA) ||
- !sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON_2_AURA) ||
- !sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON_3_AURA) ||
- !sSpellMgr->GetSpellInfo(SPELL_COPY_OFFHAND_AURA) ||
- !sSpellMgr->GetSpellInfo(SPELL_COPY_OFFHAND_2_AURA) ||
- !sSpellMgr->GetSpellInfo(SPELL_COPY_RANGED_AURA))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_COPY_WEAPON_AURA,
+ SPELL_COPY_WEAPON_2_AURA,
+ SPELL_COPY_WEAPON_3_AURA,
+ SPELL_COPY_OFFHAND_AURA,
+ SPELL_COPY_OFFHAND_2_AURA,
+ SPELL_COPY_RANGED_AURA
+ });
}
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -1035,8 +1009,7 @@ class spell_gen_clone_weapon_aura : public SpellScriptLoader
OnEffectRemove += AuraEffectRemoveFn(spell_gen_clone_weapon_auraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
}
- private:
- uint32 prevItem;
+ uint32 prevItem = 0;
};
AuraScript* GetAuraScript() const override
@@ -1101,10 +1074,11 @@ class spell_gen_create_lance : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_CREATE_LANCE_ALLIANCE) ||
- !sSpellMgr->GetSpellInfo(SPELL_CREATE_LANCE_HORDE))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_CREATE_LANCE_ALLIANCE,
+ SPELL_CREATE_LANCE_HORDE
+ });
}
void HandleScript(SpellEffIndex effIndex)
@@ -1185,7 +1159,7 @@ enum DalaranDisguiseSpells
class spell_gen_dalaran_disguise : public SpellScriptLoader
{
public:
- spell_gen_dalaran_disguise(const char* name) : SpellScriptLoader(name) { }
+ spell_gen_dalaran_disguise(char const* name) : SpellScriptLoader(name) { }
class spell_gen_dalaran_disguise_SpellScript : public SpellScript
{
@@ -1196,17 +1170,22 @@ class spell_gen_dalaran_disguise : public SpellScriptLoader
switch (spellInfo->Id)
{
case SPELL_SUNREAVER_DISGUISE_TRIGGER:
- if (!sSpellMgr->GetSpellInfo(SPELL_SUNREAVER_DISGUISE_FEMALE) ||
- !sSpellMgr->GetSpellInfo(SPELL_SUNREAVER_DISGUISE_MALE))
- return false;
- break;
+ return ValidateSpellInfo(
+ {
+ SPELL_SUNREAVER_DISGUISE_FEMALE,
+ SPELL_SUNREAVER_DISGUISE_MALE
+ });
case SPELL_SILVER_COVENANT_DISGUISE_TRIGGER:
- if (!sSpellMgr->GetSpellInfo(SPELL_SILVER_COVENANT_DISGUISE_FEMALE) ||
- !sSpellMgr->GetSpellInfo(SPELL_SILVER_COVENANT_DISGUISE_MALE))
- return false;
+ return ValidateSpellInfo(
+ {
+ SPELL_SILVER_COVENANT_DISGUISE_FEMALE,
+ SPELL_SILVER_COVENANT_DISGUISE_MALE
+ });
+ default:
break;
}
- return true;
+
+ return false;
}
void HandleScript(SpellEffIndex /*effIndex*/)
@@ -1265,9 +1244,7 @@ class spell_gen_damage_reduction_aura : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DAMAGE_REDUCTION_AURA))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DAMAGE_REDUCTION_AURA });
}
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -1320,13 +1297,12 @@ class spell_gen_defend : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_VISUAL_SHIELD_1))
- return false;
- if (!sSpellMgr->GetSpellInfo(SPELL_VISUAL_SHIELD_2))
- return false;
- if (!sSpellMgr->GetSpellInfo(SPELL_VISUAL_SHIELD_3))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_VISUAL_SHIELD_1,
+ SPELL_VISUAL_SHIELD_2,
+ SPELL_VISUAL_SHIELD_3
+ });
}
void RefreshVisualShields(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
@@ -1338,7 +1314,7 @@ class spell_gen_defend : public SpellScriptLoader
for (uint8 i = 0; i < GetSpellInfo()->StackAmount; ++i)
target->RemoveAurasDueToSpell(SPELL_VISUAL_SHIELD_1 + i);
- target->CastSpell(target, SPELL_VISUAL_SHIELD_1 + GetAura()->GetStackAmount() - 1, true, NULL, aurEff);
+ target->CastSpell(target, SPELL_VISUAL_SHIELD_1 + GetAura()->GetStackAmount() - 1, true, nullptr, aurEff);
}
else
GetTarget()->RemoveAurasDueToSpell(GetId());
@@ -1442,9 +1418,7 @@ class spell_gen_divine_storm_cd_reset : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DIVINE_STORM))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DIVINE_STORM });
}
void HandleScript(SpellEffIndex /*effIndex*/)
@@ -1512,13 +1486,6 @@ class spell_gen_dungeon_credit : public SpellScriptLoader
{
PrepareSpellScript(spell_gen_dungeon_credit_SpellScript);
- public:
- spell_gen_dungeon_credit_SpellScript()
- {
- _handled = false;
- }
-
- private:
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_UNIT;
@@ -1533,7 +1500,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
@@ -1541,8 +1508,7 @@ class spell_gen_dungeon_credit : public SpellScriptLoader
AfterHit += SpellHitFn(spell_gen_dungeon_credit_SpellScript::CreditEncounter);
}
- private:
- bool _handled;
+ bool _handled = false;
};
SpellScript* GetSpellScript() const override
@@ -1575,13 +1541,14 @@ class spell_gen_elune_candle : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_ELUNE_CANDLE_OMEN_HEAD) ||
- !sSpellMgr->GetSpellInfo(SPELL_ELUNE_CANDLE_OMEN_CHEST) ||
- !sSpellMgr->GetSpellInfo(SPELL_ELUNE_CANDLE_OMEN_HAND_R) ||
- !sSpellMgr->GetSpellInfo(SPELL_ELUNE_CANDLE_OMEN_HAND_L) ||
- !sSpellMgr->GetSpellInfo(SPELL_ELUNE_CANDLE_NORMAL))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_ELUNE_CANDLE_OMEN_HEAD,
+ SPELL_ELUNE_CANDLE_OMEN_CHEST,
+ SPELL_ELUNE_CANDLE_OMEN_HAND_R,
+ SPELL_ELUNE_CANDLE_OMEN_HAND_L,
+ SPELL_ELUNE_CANDLE_NORMAL
+ });
}
void HandleScript(SpellEffIndex /*effIndex*/)
@@ -1609,7 +1576,7 @@ class spell_gen_elune_candle : public SpellScriptLoader
else
spellId = SPELL_ELUNE_CANDLE_NORMAL;
- GetCaster()->CastSpell(GetHitUnit(), spellId, true, NULL);
+ GetCaster()->CastSpell(GetHitUnit(), spellId, true, nullptr);
}
void Register() override
@@ -1642,11 +1609,12 @@ class spell_gen_gadgetzan_transporter_backfire : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_TRANSPORTER_MALFUNCTION_POLYMORPH) ||
- !sSpellMgr->GetSpellInfo(SPELL_TRANSPORTER_EVIL_TWIN) ||
- !sSpellMgr->GetSpellInfo(SPELL_TRANSPORTER_MALFUNCTION_MISS))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_TRANSPORTER_MALFUNCTION_POLYMORPH,
+ SPELL_TRANSPORTER_EVIL_TWIN,
+ SPELL_TRANSPORTER_MALFUNCTION_MISS
+ });
}
void HandleDummy(SpellEffIndex /* effIndex */)
@@ -1743,10 +1711,11 @@ class spell_gen_gnomish_transporter : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_TRANSPORTER_SUCCESS) ||
- !sSpellMgr->GetSpellInfo(SPELL_TRANSPORTER_FAILURE))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_TRANSPORTER_SUCCESS,
+ SPELL_TRANSPORTER_FAILURE
+ });
}
void HandleDummy(SpellEffIndex /* effIndex */)
@@ -1805,7 +1774,7 @@ enum GenericLifebloom
class spell_gen_lifebloom : public SpellScriptLoader
{
public:
- spell_gen_lifebloom(const char* name, uint32 spellId) : SpellScriptLoader(name), _spellId(spellId) { }
+ spell_gen_lifebloom(char const* name, uint32 spellId) : SpellScriptLoader(name), _spellId(spellId) { }
class spell_gen_lifebloom_AuraScript : public AuraScript
{
@@ -1814,11 +1783,10 @@ class spell_gen_lifebloom : public SpellScriptLoader
public:
spell_gen_lifebloom_AuraScript(uint32 spellId) : AuraScript(), _spellId(spellId) { }
+ private:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(_spellId))
- return false;
- return true;
+ return ValidateSpellInfo({ _spellId });
}
void AfterRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
@@ -1828,7 +1796,7 @@ class spell_gen_lifebloom : public SpellScriptLoader
return;
// final heal
- GetTarget()->CastSpell(GetTarget(), _spellId, true, NULL, aurEff, GetCasterGUID());
+ GetTarget()->CastSpell(GetTarget(), _spellId, true, nullptr, aurEff, GetCasterGUID());
}
void Register() override
@@ -1836,7 +1804,6 @@ class spell_gen_lifebloom : public SpellScriptLoader
AfterEffectRemove += AuraEffectRemoveFn(spell_gen_lifebloom_AuraScript::AfterRemove, EFFECT_0, SPELL_AURA_PERIODIC_HEAL, AURA_EFFECT_HANDLE_REAL);
}
- private:
uint32 _spellId;
};
@@ -1961,7 +1928,7 @@ enum Mounts
class spell_gen_mount : public SpellScriptLoader
{
public:
- spell_gen_mount(const char* name, uint32 mount0 = 0, uint32 mount60 = 0, uint32 mount100 = 0, uint32 mount150 = 0, uint32 mount280 = 0, uint32 mount310 = 0) : SpellScriptLoader(name),
+ spell_gen_mount(char const* name, uint32 mount0 = 0, uint32 mount60 = 0, uint32 mount100 = 0, uint32 mount150 = 0, uint32 mount280 = 0, uint32 mount310 = 0) : SpellScriptLoader(name),
_mount0(mount0), _mount60(mount60), _mount100(mount100), _mount150(mount150), _mount280(mount280), _mount310(mount310) { }
class spell_gen_mount_SpellScript : public SpellScript
@@ -1972,21 +1939,24 @@ class spell_gen_mount : public SpellScriptLoader
spell_gen_mount_SpellScript(uint32 mount0, uint32 mount60, uint32 mount100, uint32 mount150, uint32 mount280, uint32 mount310) : SpellScript(),
_mount0(mount0), _mount60(mount60), _mount100(mount100), _mount150(mount150), _mount280(mount280), _mount310(mount310) { }
+ private:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (_mount0 && !sSpellMgr->GetSpellInfo(_mount0))
- return false;
- if (_mount60 && !sSpellMgr->GetSpellInfo(_mount60))
- return false;
- if (_mount100 && !sSpellMgr->GetSpellInfo(_mount100))
- return false;
- if (_mount150 && !sSpellMgr->GetSpellInfo(_mount150))
- return false;
- if (_mount280 && !sSpellMgr->GetSpellInfo(_mount280))
- return false;
- if (_mount310 && !sSpellMgr->GetSpellInfo(_mount310))
- return false;
- return true;
+ bool result = true;
+ if (_mount0)
+ result &= ValidateSpellInfo({ _mount0 });
+ if (_mount60)
+ result &= ValidateSpellInfo({ _mount60 });
+ if (_mount100)
+ result &= ValidateSpellInfo({ _mount100 });
+ if (_mount150)
+ result &= ValidateSpellInfo({ _mount150 });
+ if (_mount280)
+ result &= ValidateSpellInfo({ _mount280 });
+ if (_mount310)
+ result &= ValidateSpellInfo({ _mount310 });
+
+ return result;
}
void HandleMount(SpellEffIndex effIndex)
@@ -2047,7 +2017,6 @@ class spell_gen_mount : public SpellScriptLoader
OnEffectHitTarget += SpellEffectFn(spell_gen_mount_SpellScript::HandleMount, EFFECT_2, SPELL_EFFECT_SCRIPT_EFFECT);
}
- private:
uint32 _mount0;
uint32 _mount60;
uint32 _mount100;
@@ -2249,9 +2218,7 @@ class spell_gen_moss_covered_feet : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_FALL_DOWN))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_FALL_DOWN });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -2272,7 +2239,7 @@ class spell_gen_moss_covered_feet : public SpellScriptLoader
}
};
-enum Netherbloom
+enum Netherbloom : uint32
{
SPELL_NETHERBLOOM_POLLEN_1 = 28703
};
@@ -2290,8 +2257,9 @@ class spell_gen_netherbloom : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
for (uint8 i = 0; i < 5; ++i)
- if (!sSpellMgr->GetSpellInfo(SPELL_NETHERBLOOM_POLLEN_1 + i))
+ if (!ValidateSpellInfo({ SPELL_NETHERBLOOM_POLLEN_1 + i }))
return false;
+
return true;
}
@@ -2347,9 +2315,7 @@ class spell_gen_nightmare_vine : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_NIGHTMARE_POLLEN))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_NIGHTMARE_POLLEN });
}
void HandleScript(SpellEffIndex effIndex)
@@ -2398,14 +2364,15 @@ class spell_gen_obsidian_armor : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_GEN_OBSIDIAN_ARMOR_HOLY) ||
- !sSpellMgr->GetSpellInfo(SPELL_GEN_OBSIDIAN_ARMOR_FIRE) ||
- !sSpellMgr->GetSpellInfo(SPELL_GEN_OBSIDIAN_ARMOR_NATURE) ||
- !sSpellMgr->GetSpellInfo(SPELL_GEN_OBSIDIAN_ARMOR_FROST) ||
- !sSpellMgr->GetSpellInfo(SPELL_GEN_OBSIDIAN_ARMOR_SHADOW) ||
- !sSpellMgr->GetSpellInfo(SPELL_GEN_OBSIDIAN_ARMOR_ARCANE))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_GEN_OBSIDIAN_ARMOR_HOLY,
+ SPELL_GEN_OBSIDIAN_ARMOR_FIRE,
+ SPELL_GEN_OBSIDIAN_ARMOR_NATURE,
+ SPELL_GEN_OBSIDIAN_ARMOR_FROST,
+ SPELL_GEN_OBSIDIAN_ARMOR_SHADOW,
+ SPELL_GEN_OBSIDIAN_ARMOR_ARCANE
+ });
}
bool CheckProc(ProcEventInfo& eventInfo)
@@ -2448,7 +2415,7 @@ class spell_gen_obsidian_armor : public SpellScriptLoader
default:
return;
}
- GetTarget()->CastSpell(GetTarget(), spellId, true, NULL, aurEff);
+ GetTarget()->CastSpell(GetTarget(), spellId, true, nullptr, aurEff);
}
void Register() override
@@ -2526,11 +2493,12 @@ class spell_gen_orc_disguise : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_ORC_DISGUISE_TRIGGER) ||
- !sSpellMgr->GetSpellInfo(SPELL_ORC_DISGUISE_MALE) ||
- !sSpellMgr->GetSpellInfo(SPELL_ORC_DISGUISE_FEMALE))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_ORC_DISGUISE_TRIGGER,
+ SPELL_ORC_DISGUISE_MALE,
+ SPELL_ORC_DISGUISE_FEMALE
+ });
}
void HandleScript(SpellEffIndex /*effIndex*/)
@@ -2575,9 +2543,7 @@ class spell_gen_paralytic_poison : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PARALYSIS))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_PARALYSIS });
}
void HandleStun(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
@@ -2603,7 +2569,7 @@ class spell_gen_paralytic_poison : public SpellScriptLoader
class spell_gen_proc_below_pct_damaged : public SpellScriptLoader
{
public:
- spell_gen_proc_below_pct_damaged(const char* name) : SpellScriptLoader(name) { }
+ spell_gen_proc_below_pct_damaged(char const* name) : SpellScriptLoader(name) { }
class spell_gen_proc_below_pct_damaged_AuraScript : public AuraScript
{
@@ -2679,10 +2645,11 @@ class spell_gen_parachute : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PARACHUTE) ||
- !sSpellMgr->GetSpellInfo(SPELL_PARACHUTE_BUFF))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_PARACHUTE,
+ SPELL_PARACHUTE_BUFF
+ });
}
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
@@ -2965,9 +2932,7 @@ class spell_gen_seaforium_blast : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PLANT_CHARGES_CREDIT_ACHIEVEMENT))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_PLANT_CHARGES_CREDIT_ACHIEVEMENT });
}
bool Load() override
@@ -2978,7 +2943,7 @@ class spell_gen_seaforium_blast : public SpellScriptLoader
void AchievementCredit(SpellEffIndex /*effIndex*/)
{
- // but in effect handling OriginalCaster can become NULL
+ // but in effect handling OriginalCaster can become nullptr
if (Unit* originalCaster = GetOriginalCaster())
if (GameObject* go = GetHitGObj())
if (go->GetGOInfo()->type == GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING)
@@ -3053,7 +3018,7 @@ class spell_gen_spirit_healer_res : public SpellScriptLoader
{
WorldPacket data(SMSG_SPIRIT_HEALER_CONFIRM, 8);
data << uint64(target->GetGUID());
- originalCaster->GetSession()->SendPacket(&data);
+ originalCaster->SendDirectMessage(&data);
}
}
@@ -3078,7 +3043,7 @@ enum SummonElemental
class spell_gen_summon_elemental : public SpellScriptLoader
{
public:
- spell_gen_summon_elemental(const char* name, uint32 spellId) : SpellScriptLoader(name), _spellId(spellId) { }
+ spell_gen_summon_elemental(char const* name, uint32 spellId) : SpellScriptLoader(name), _spellId(spellId) { }
class spell_gen_summon_elemental_AuraScript : public AuraScript
{
@@ -3087,11 +3052,10 @@ class spell_gen_summon_elemental : public SpellScriptLoader
public:
spell_gen_summon_elemental_AuraScript(uint32 spellId) : AuraScript(), _spellId(spellId) { }
+ private:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(_spellId))
- return false;
- return true;
+ return ValidateSpellInfo({ _spellId });
}
void AfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -3106,7 +3070,7 @@ class spell_gen_summon_elemental : public SpellScriptLoader
if (GetCaster())
if (Unit* owner = GetCaster()->GetOwner())
if (owner->GetTypeId() == TYPEID_PLAYER) /// @todo this check is maybe wrong
- owner->ToPlayer()->RemovePet(NULL, PET_SAVE_NOT_IN_SLOT, true);
+ owner->ToPlayer()->RemovePet(nullptr, PET_SAVE_NOT_IN_SLOT, true);
}
void Register() override
@@ -3115,7 +3079,6 @@ class spell_gen_summon_elemental : public SpellScriptLoader
AfterEffectRemove += AuraEffectRemoveFn(spell_gen_summon_elemental_AuraScript::AfterRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
- private:
uint32 _spellId;
};
@@ -3144,9 +3107,7 @@ class spell_gen_summon_tournament_mount : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_LANCE_EQUIPPED))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_LANCE_EQUIPPED });
}
SpellCastResult CheckIfLanceEquiped()
@@ -3220,10 +3181,11 @@ class spell_gen_tournament_duel : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_ON_TOURNAMENT_MOUNT) ||
- !sSpellMgr->GetSpellInfo(SPELL_MOUNTED_DUEL))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_ON_TOURNAMENT_MOUNT,
+ SPELL_MOUNTED_DUEL
+ });
}
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
@@ -3307,9 +3269,7 @@ class spell_pvp_trinket_wotf_shared_cd : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(Triggered))
- return false;
- return true;
+ return ValidateSpellInfo({ Triggered });
}
void HandleScript()
@@ -3371,7 +3331,7 @@ class spell_gen_turkey_marker : public SpellScriptLoader
// on stack 15 cast the achievement crediting spell
if (GetStackAmount() >= 15)
- target->CastSpell(target, SPELL_TURKEY_VENGEANCE, true, NULL, aurEff, GetCasterGUID());
+ target->CastSpell(target, SPELL_TURKEY_VENGEANCE, true, nullptr, aurEff, GetCasterGUID());
}
void OnPeriodic(AuraEffect const* /*aurEff*/)
@@ -3463,9 +3423,7 @@ class spell_gen_vampiric_touch : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_VAMPIRIC_TOUCH_HEAL))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_VAMPIRIC_TOUCH_HEAL });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -3630,15 +3588,13 @@ class spell_gen_whisper_gulch_yogg_saron_whisper : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_YOGG_SARON_WHISPER_DUMMY))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_YOGG_SARON_WHISPER_DUMMY });
}
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
{
PreventDefaultAction();
- GetTarget()->CastSpell((Unit*)NULL, SPELL_YOGG_SARON_WHISPER_DUMMY, true);
+ GetTarget()->CastSpell((Unit*)nullptr, SPELL_YOGG_SARON_WHISPER_DUMMY, true);
}
void Register() override
@@ -3733,9 +3689,7 @@ class spell_gen_gm_freeze : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_GM_FREEZE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_GM_FREEZE });
}
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -3918,18 +3872,9 @@ public:
{
PrepareAuraScript(spell_gen_mixology_bonus_AuraScript);
- public:
- spell_gen_mixology_bonus_AuraScript()
- {
- bonus = 0;
- }
-
- private:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_MIXOLOGY))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_MIXOLOGY });
}
bool Load() override
@@ -4115,7 +4060,7 @@ public:
}
}
- int32 bonus;
+ int32 bonus = 0;
void Register() override
{
diff --git a/src/server/scripts/Spells/spell_holiday.cpp b/src/server/scripts/Spells/spell_holiday.cpp
index 588bccb9596..eac0ff10c23 100644
--- a/src/server/scripts/Spells/spell_holiday.cpp
+++ b/src/server/scripts/Spells/spell_holiday.cpp
@@ -21,15 +21,15 @@
* Scriptnames in this file should be prefixed with "spell_#holidayname_".
*/
-#include "Player.h"
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "SpellScript.h"
-#include "SpellAuraEffects.h"
-#include "GridNotifiers.h"
-#include "GridNotifiersImpl.h"
#include "CellImpl.h"
+#include "CreatureAIImpl.h"
+#include "GridNotifiersImpl.h"
+#include "Player.h"
+#include "SpellAuraEffects.h"
+#include "SpellScript.h"
#include "Vehicle.h"
+#include "World.h"
// 45102 Romantic Picnic
enum SpellsPicnic
@@ -135,10 +135,7 @@ class spell_hallow_end_candy : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- for (uint32 spellId : spells)
- if (!sSpellMgr->GetSpellInfo(spellId))
- return false;
- return true;
+ return ValidateSpellInfo(spells);
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -181,10 +178,11 @@ class spell_hallow_end_candy_pirate : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_HALLOWS_END_CANDY_FEMALE_DEFIAS_PIRATE)
- || !sSpellMgr->GetSpellInfo(SPELL_HALLOWS_END_CANDY_MALE_DEFIAS_PIRATE))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_HALLOWS_END_CANDY_FEMALE_DEFIAS_PIRATE,
+ SPELL_HALLOWS_END_CANDY_MALE_DEFIAS_PIRATE
+ });
}
void HandleApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -238,11 +236,19 @@ class spell_hallow_end_trick : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PIRATE_COSTUME_MALE) || !sSpellMgr->GetSpellInfo(SPELL_PIRATE_COSTUME_FEMALE) || !sSpellMgr->GetSpellInfo(SPELL_NINJA_COSTUME_MALE)
- || !sSpellMgr->GetSpellInfo(SPELL_NINJA_COSTUME_FEMALE) || !sSpellMgr->GetSpellInfo(SPELL_LEPER_GNOME_COSTUME_MALE) || !sSpellMgr->GetSpellInfo(SPELL_LEPER_GNOME_COSTUME_FEMALE)
- || !sSpellMgr->GetSpellInfo(SPELL_SKELETON_COSTUME) || !sSpellMgr->GetSpellInfo(SPELL_GHOST_COSTUME_MALE) || !sSpellMgr->GetSpellInfo(SPELL_GHOST_COSTUME_FEMALE) || !sSpellMgr->GetSpellInfo(SPELL_TRICK_BUFF))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_PIRATE_COSTUME_MALE,
+ SPELL_PIRATE_COSTUME_FEMALE,
+ SPELL_NINJA_COSTUME_MALE,
+ SPELL_NINJA_COSTUME_FEMALE,
+ SPELL_LEPER_GNOME_COSTUME_MALE,
+ SPELL_LEPER_GNOME_COSTUME_FEMALE,
+ SPELL_SKELETON_COSTUME,
+ SPELL_GHOST_COSTUME_MALE,
+ SPELL_GHOST_COSTUME_FEMALE,
+ SPELL_TRICK_BUFF
+ });
}
void HandleScript(SpellEffIndex /*effIndex*/)
@@ -311,9 +317,7 @@ class spell_hallow_end_trick_or_treat : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_TRICK) || !sSpellMgr->GetSpellInfo(SPELL_TREAT) || !sSpellMgr->GetSpellInfo(SPELL_TRICKED_OR_TREATED))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_TRICK, SPELL_TREAT, SPELL_TRICKED_OR_TREATED });
}
void HandleScript(SpellEffIndex /*effIndex*/)
@@ -349,13 +353,12 @@ class spell_hallow_end_tricky_treat : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_TRICKY_TREAT_SPEED))
- return false;
- if (!sSpellMgr->GetSpellInfo(SPELL_TRICKY_TREAT_TRIGGER))
- return false;
- if (!sSpellMgr->GetSpellInfo(SPELL_UPSET_TUMMY))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_TRICKY_TREAT_SPEED,
+ SPELL_TRICKY_TREAT_TRIGGER,
+ SPELL_UPSET_TUMMY
+ });
}
void HandleScript(SpellEffIndex /*effIndex*/)
@@ -402,16 +405,17 @@ public:
bool Validate(SpellInfo const* /*spellEntry*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PIRATE_COSTUME_MALE) ||
- !sSpellMgr->GetSpellInfo(SPELL_PIRATE_COSTUME_FEMALE) ||
- !sSpellMgr->GetSpellInfo(SPELL_NINJA_COSTUME_MALE) ||
- !sSpellMgr->GetSpellInfo(SPELL_NINJA_COSTUME_FEMALE) ||
- !sSpellMgr->GetSpellInfo(SPELL_LEPER_GNOME_COSTUME_MALE) ||
- !sSpellMgr->GetSpellInfo(SPELL_LEPER_GNOME_COSTUME_FEMALE) ||
- !sSpellMgr->GetSpellInfo(SPELL_GHOST_COSTUME_MALE) ||
- !sSpellMgr->GetSpellInfo(SPELL_GHOST_COSTUME_FEMALE))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_PIRATE_COSTUME_MALE,
+ SPELL_PIRATE_COSTUME_FEMALE,
+ SPELL_NINJA_COSTUME_MALE,
+ SPELL_NINJA_COSTUME_FEMALE,
+ SPELL_LEPER_GNOME_COSTUME_MALE,
+ SPELL_LEPER_GNOME_COSTUME_FEMALE,
+ SPELL_GHOST_COSTUME_MALE,
+ SPELL_GHOST_COSTUME_FEMALE
+ });
}
void HandleScriptEffect()
@@ -472,7 +476,7 @@ class spell_pilgrims_bounty_buff_food : public SpellScriptLoader
private:
uint32 const _triggeredSpellId;
public:
- spell_pilgrims_bounty_buff_food(const char* name, uint32 triggeredSpellId) : SpellScriptLoader(name), _triggeredSpellId(triggeredSpellId) { }
+ spell_pilgrims_bounty_buff_food(char const* name, uint32 triggeredSpellId) : SpellScriptLoader(name), _triggeredSpellId(triggeredSpellId) { }
class spell_pilgrims_bounty_buff_food_AuraScript : public AuraScript
{
@@ -565,7 +569,7 @@ class spell_pilgrims_bounty_feast_on : public SpellScriptLoader
if (Player* player = target->ToPlayer())
{
player->CastSpell(player, SPELL_ON_PLATE_EAT_VISUAL, true);
- caster->CastSpell(player, _spellId, true, NULL, NULL, player->GetGUID());
+ caster->CastSpell(player, _spellId, true, nullptr, nullptr, player->GetGUID());
}
if (Aura* aura = caster->GetAura(GetEffectValue()))
@@ -609,9 +613,7 @@ class spell_pilgrims_bounty_turkey_tracker : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_KILL_COUNTER_VISUAL) || !sSpellMgr->GetSpellInfo(SPELL_KILL_COUNTER_VISUAL_MAX))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_KILL_COUNTER_VISUAL, SPELL_KILL_COUNTER_VISUAL_MAX });
}
void HandleScript(SpellEffIndex /*effIndex*/)
@@ -673,22 +675,21 @@ class spell_pilgrims_bounty_well_fed : public SpellScriptLoader
uint32 _triggeredSpellId;
public:
- spell_pilgrims_bounty_well_fed(const char* name, uint32 triggeredSpellId) : SpellScriptLoader(name), _triggeredSpellId(triggeredSpellId) { }
+ spell_pilgrims_bounty_well_fed(char const* name, uint32 triggeredSpellId) : SpellScriptLoader(name), _triggeredSpellId(triggeredSpellId) { }
class spell_pilgrims_bounty_well_fed_SpellScript : public SpellScript
{
PrepareSpellScript(spell_pilgrims_bounty_well_fed_SpellScript);
- private:
+
uint32 _triggeredSpellId;
public:
spell_pilgrims_bounty_well_fed_SpellScript(uint32 triggeredSpellId) : SpellScript(), _triggeredSpellId(triggeredSpellId) { }
+ private:
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(_triggeredSpellId))
- return false;
- return true;
+ return ValidateSpellInfo({ _triggeredSpellId });
}
void HandleScript(SpellEffIndex effIndex)
@@ -780,13 +781,13 @@ class spell_pilgrims_bounty_on_plate : public SpellScriptLoader
uint32 _triggeredSpellId4;
public:
- spell_pilgrims_bounty_on_plate(const char* name, uint32 triggeredSpellId1, uint32 triggeredSpellId2, uint32 triggeredSpellId3, uint32 triggeredSpellId4) : SpellScriptLoader(name),
+ spell_pilgrims_bounty_on_plate(char const* name, uint32 triggeredSpellId1, uint32 triggeredSpellId2, uint32 triggeredSpellId3, uint32 triggeredSpellId4) : SpellScriptLoader(name),
_triggeredSpellId1(triggeredSpellId1), _triggeredSpellId2(triggeredSpellId2), _triggeredSpellId3(triggeredSpellId3), _triggeredSpellId4(triggeredSpellId4) { }
class spell_pilgrims_bounty_on_plate_SpellScript : public SpellScript
{
PrepareSpellScript(spell_pilgrims_bounty_on_plate_SpellScript);
- private:
+
uint32 _triggeredSpellId1;
uint32 _triggeredSpellId2;
uint32 _triggeredSpellId3;
@@ -796,14 +797,16 @@ class spell_pilgrims_bounty_on_plate : public SpellScriptLoader
spell_pilgrims_bounty_on_plate_SpellScript(uint32 triggeredSpellId1, uint32 triggeredSpellId2, uint32 triggeredSpellId3, uint32 triggeredSpellId4) : SpellScript(),
_triggeredSpellId1(triggeredSpellId1), _triggeredSpellId2(triggeredSpellId2), _triggeredSpellId3(triggeredSpellId3), _triggeredSpellId4(triggeredSpellId4) { }
+ private:
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(_triggeredSpellId1)
- || !sSpellMgr->GetSpellInfo(_triggeredSpellId2)
- || !sSpellMgr->GetSpellInfo(_triggeredSpellId3)
- || !sSpellMgr->GetSpellInfo(_triggeredSpellId4))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ _triggeredSpellId1,
+ _triggeredSpellId2,
+ _triggeredSpellId3,
+ _triggeredSpellId4
+ });
}
Vehicle* GetTable(Unit* target)
@@ -898,23 +901,21 @@ class spell_pilgrims_bounty_a_serving_of : public SpellScriptLoader
private:
uint32 _triggeredSpellId;
public:
- spell_pilgrims_bounty_a_serving_of(const char* name, uint32 triggeredSpellId) : SpellScriptLoader(name), _triggeredSpellId(triggeredSpellId) { }
+ spell_pilgrims_bounty_a_serving_of(char const* name, uint32 triggeredSpellId) : SpellScriptLoader(name), _triggeredSpellId(triggeredSpellId) { }
class spell_pilgrims_bounty_a_serving_of_AuraScript : public AuraScript
{
PrepareAuraScript(spell_pilgrims_bounty_a_serving_of_AuraScript);
- private:
uint32 _triggeredSpellId;
public:
spell_pilgrims_bounty_a_serving_of_AuraScript(uint32 triggeredSpellId) : AuraScript(), _triggeredSpellId(triggeredSpellId) { }
+ private:
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(_triggeredSpellId))
- return false;
- return true;
+ return ValidateSpellInfo({ _triggeredSpellId });
}
void OnApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
@@ -976,11 +977,12 @@ class spell_winter_veil_mistletoe : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_CREATE_MISTLETOE) ||
- !sSpellMgr->GetSpellInfo(SPELL_CREATE_HOLLY) ||
- !sSpellMgr->GetSpellInfo(SPELL_CREATE_SNOWFLAKES))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_CREATE_MISTLETOE,
+ SPELL_CREATE_HOLLY,
+ SPELL_CREATE_SNOWFLAKES
+ });
}
void HandleScript(SpellEffIndex /*effIndex*/)
@@ -1013,6 +1015,14 @@ enum PX238WinterWondervolt
SPELL_PX_238_WINTER_WONDERVOLT_TRANSFORM_4 = 26274
};
+uint32 const WonderboltTransformSpells[] =
+{
+ SPELL_PX_238_WINTER_WONDERVOLT_TRANSFORM_1,
+ SPELL_PX_238_WINTER_WONDERVOLT_TRANSFORM_2,
+ SPELL_PX_238_WINTER_WONDERVOLT_TRANSFORM_3,
+ SPELL_PX_238_WINTER_WONDERVOLT_TRANSFORM_4
+};
+
class spell_winter_veil_px_238_winter_wondervolt : public SpellScriptLoader
{
public:
@@ -1024,33 +1034,20 @@ class spell_winter_veil_px_238_winter_wondervolt : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PX_238_WINTER_WONDERVOLT_TRANSFORM_1) ||
- !sSpellMgr->GetSpellInfo(SPELL_PX_238_WINTER_WONDERVOLT_TRANSFORM_2) ||
- !sSpellMgr->GetSpellInfo(SPELL_PX_238_WINTER_WONDERVOLT_TRANSFORM_3) ||
- !sSpellMgr->GetSpellInfo(SPELL_PX_238_WINTER_WONDERVOLT_TRANSFORM_4))
- return false;
- return true;
+ return ValidateSpellInfo(WonderboltTransformSpells);
}
void HandleScript(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
- uint32 const spells[4] =
- {
- SPELL_PX_238_WINTER_WONDERVOLT_TRANSFORM_1,
- SPELL_PX_238_WINTER_WONDERVOLT_TRANSFORM_2,
- SPELL_PX_238_WINTER_WONDERVOLT_TRANSFORM_3,
- SPELL_PX_238_WINTER_WONDERVOLT_TRANSFORM_4
- };
-
if (Unit* target = GetHitUnit())
{
- for (uint8 i = 0; i < 4; ++i)
- if (target->HasAura(spells[i]))
+ for (uint32 spell : WonderboltTransformSpells)
+ if (target->HasAura(spell))
return;
- target->CastSpell(target, spells[urand(0, 3)], true);
+ target->CastSpell(target, Trinity::Containers::SelectRandomContainerElement(WonderboltTransformSpells), true);
}
}
@@ -1321,7 +1318,7 @@ class spell_brewfest_relay_race_intro_force_player_to_throw : public SpellScript
PreventHitDefaultEffect(effIndex);
// All this spells trigger a spell that requires reagents; if the
// triggered spell is cast as "triggered", reagents are not consumed
- GetHitUnit()->CastSpell((Unit*)NULL, GetSpellInfo()->Effects[effIndex].TriggerSpell, TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_IGNORE_POWER_AND_REAGENT_COST));
+ GetHitUnit()->CastSpell((Unit*)nullptr, GetSpellInfo()->Effects[effIndex].TriggerSpell, TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_IGNORE_POWER_AND_REAGENT_COST));
}
void Register() override
@@ -1507,9 +1504,7 @@ class spell_midsummer_braziers_hit : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_TORCH_TOSSING_TRAINING) || !sSpellMgr->GetSpellInfo(SPELL_TORCH_TOSSING_PRACTICE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_TORCH_TOSSING_TRAINING, SPELL_TORCH_TOSSING_PRACTICE });
}
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -1560,11 +1555,12 @@ class spell_gen_ribbon_pole_dancer_check : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_HAS_FULL_MIDSUMMER_SET)
- || !sSpellMgr->GetSpellInfo(SPELL_RIBBON_DANCE)
- || !sSpellMgr->GetSpellInfo(SPELL_BURNING_HOT_POLE_DANCE))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_HAS_FULL_MIDSUMMER_SET,
+ SPELL_RIBBON_DANCE,
+ SPELL_BURNING_HOT_POLE_DANCE
+ });
}
void PeriodicTick(AuraEffect const* /*aurEff*/)
diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp
index 79ca0a1eb6c..2b9bfac79e9 100644
--- a/src/server/scripts/Spells/spell_hunter.cpp
+++ b/src/server/scripts/Spells/spell_hunter.cpp
@@ -21,15 +21,14 @@
* Scriptnames of files in this file should be prefixed with "spell_hun_".
*/
-#include "Pet.h"
#include "ScriptMgr.h"
-#include "Cell.h"
#include "CellImpl.h"
-#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
+#include "Pet.h"
+#include "SpellAuraEffects.h"
#include "SpellHistory.h"
+#include "SpellMgr.h"
#include "SpellScript.h"
-#include "SpellAuraEffects.h"
enum HunterSpells
{
@@ -87,9 +86,7 @@ class spell_hun_aspect_of_the_beast : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_HUNTER_ASPECT_OF_THE_BEAST_PET))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_HUNTER_ASPECT_OF_THE_BEAST_PET });
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -131,12 +128,13 @@ class spell_hun_ascpect_of_the_viper : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_HUNTER_ASPECT_OF_THE_VIPER_ENERGIZE) ||
- !sSpellMgr->GetSpellInfo(SPELL_HUNTER_GLYPH_OF_ASPECT_OF_THE_VIPER) ||
- !sSpellMgr->GetSpellInfo(SPELL_HUNTER_VIPER_ATTACK_SPEED) ||
- !sSpellMgr->GetSpellInfo(SPELL_HUNTER_VICIOUS_VIPER))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_HUNTER_ASPECT_OF_THE_VIPER_ENERGIZE,
+ SPELL_HUNTER_GLYPH_OF_ASPECT_OF_THE_VIPER,
+ SPELL_HUNTER_VIPER_ATTACK_SPEED,
+ SPELL_HUNTER_VICIOUS_VIPER
+ });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/)
@@ -149,14 +147,14 @@ class spell_hun_ascpect_of_the_viper : public SpellScriptLoader
if (AuraEffect const* glyph = GetTarget()->GetAuraEffect(SPELL_HUNTER_GLYPH_OF_ASPECT_OF_THE_VIPER, EFFECT_0))
AddPct(mana, glyph->GetAmount());
- GetTarget()->CastCustomSpell(SPELL_HUNTER_ASPECT_OF_THE_VIPER_ENERGIZE, SPELLVALUE_BASE_POINT0, mana, GetTarget(), true, NULL, aurEff);
+ GetTarget()->CastCustomSpell(SPELL_HUNTER_ASPECT_OF_THE_VIPER_ENERGIZE, SPELLVALUE_BASE_POINT0, mana, GetTarget(), true, nullptr, aurEff);
}
void OnApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
// Hunter T7 4P Bonus
if (GetTarget()->HasAura(SPELL_HUNTER_VIPER_ATTACK_SPEED))
- GetTarget()->CastSpell(GetTarget(), SPELL_HUNTER_VICIOUS_VIPER, true, NULL, aurEff);
+ GetTarget()->CastSpell(GetTarget(), SPELL_HUNTER_VICIOUS_VIPER, true, nullptr, aurEff);
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -192,9 +190,7 @@ class spell_hun_chimera_shot : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_HUNTER_CHIMERA_SHOT_SERPENT) || !sSpellMgr->GetSpellInfo(SPELL_HUNTER_CHIMERA_SHOT_VIPER) || !sSpellMgr->GetSpellInfo(SPELL_HUNTER_CHIMERA_SHOT_SCORPID))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_HUNTER_CHIMERA_SHOT_SERPENT, SPELL_HUNTER_CHIMERA_SHOT_VIPER, SPELL_HUNTER_CHIMERA_SHOT_SCORPID });
}
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
@@ -225,7 +221,8 @@ class spell_hun_chimera_shot : public SpellScriptLoader
// first, calculate damage of basic tick (C&P from AuraEffect::HandlePeriodicDamageAurasTick)
basePoint = (aurEff->GetAmount() + aurEff->GetBonusAmount()) * aurEff->GetDonePct();
if (Player* modOwner = caster->GetSpellModOwner())
- modOwner->ApplySpellMod<SPELLMOD_DOT>(aurEff->GetId(), basePoint);
+ modOwner->ApplySpellMod(aurEff->GetId(), SPELLMOD_DOT, basePoint);
+
basePoint = unitTarget->SpellDamageBonusTaken(caster, aurEff->GetSpellInfo(), basePoint, DOT, aura->GetStackAmount());
// then, multiply to get damage potential
@@ -287,9 +284,7 @@ class spell_hun_cobra_strikes : public SpellScriptLoader
bool Validate(SpellInfo const* spellInfo) override
{
- if (!sSpellMgr->GetSpellInfo(spellInfo->Effects[EFFECT_0].TriggerSpell))
- return false;
- return true;
+ return ValidateSpellInfo({ spellInfo->Effects[EFFECT_0].TriggerSpell });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/)
@@ -382,9 +377,7 @@ class spell_hun_glyph_of_arcane_shot : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_HUNTER_GLYPH_OF_ARCANE_SHOT))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_HUNTER_GLYPH_OF_ARCANE_SHOT });
}
bool CheckProc(ProcEventInfo& eventInfo)
@@ -444,9 +437,7 @@ class spell_hun_glyph_of_mend_pet : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_HUNTER_GLYPH_OF_MEND_PET_HAPPINESS))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_HUNTER_GLYPH_OF_MEND_PET_HAPPINESS });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -479,9 +470,7 @@ class spell_hun_hunting_party : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_REPLENISHMENT))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_REPLENISHMENT });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -514,9 +503,7 @@ class spell_hun_improved_mend_pet : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_HUNTER_IMPROVED_MEND_PET))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_HUNTER_IMPROVED_MEND_PET });
}
bool CheckProc(ProcEventInfo& /*eventInfo*/)
@@ -527,7 +514,7 @@ class spell_hun_improved_mend_pet : public SpellScriptLoader
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/)
{
PreventDefaultAction();
- GetTarget()->CastSpell(GetTarget(), SPELL_HUNTER_IMPROVED_MEND_PET, true, NULL, aurEff);
+ GetTarget()->CastSpell(GetTarget(), SPELL_HUNTER_IMPROVED_MEND_PET, true, nullptr, aurEff);
}
void Register() override
@@ -555,9 +542,7 @@ class spell_hun_invigoration : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_HUNTER_INVIGORATION_TRIGGERED))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_HUNTER_INVIGORATION_TRIGGERED });
}
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
@@ -592,9 +577,7 @@ class spell_hun_kill_command_pet : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_HUNTER_KILL_COMMAND_HUNTER))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_HUNTER_KILL_COMMAND_HUNTER });
}
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
@@ -632,16 +615,14 @@ class spell_hun_last_stand_pet : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_HUNTER_PET_LAST_STAND_TRIGGERED))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_HUNTER_PET_LAST_STAND_TRIGGERED });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
int32 healthModSpellBasePoints0 = int32(caster->CountPctFromMaxHealth(30));
- caster->CastCustomSpell(caster, SPELL_HUNTER_PET_LAST_STAND_TRIGGERED, &healthModSpellBasePoints0, NULL, NULL, true, NULL);
+ caster->CastCustomSpell(caster, SPELL_HUNTER_PET_LAST_STAND_TRIGGERED, &healthModSpellBasePoints0, nullptr, nullptr, true, nullptr);
}
void Register() override
@@ -668,10 +649,11 @@ class spell_hun_lock_and_load : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_HUNTER_LOCK_AND_LOAD_TRIGGER) ||
- !sSpellMgr->GetSpellInfo(SPELL_HUNTER_LOCK_AND_LOAD_MARKER))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_HUNTER_LOCK_AND_LOAD_TRIGGER,
+ SPELL_HUNTER_LOCK_AND_LOAD_MARKER
+ });
}
bool CheckProc(ProcEventInfo& eventInfo)
@@ -740,9 +722,12 @@ class spell_hun_masters_call : public SpellScriptLoader
bool Validate(SpellInfo const* spellInfo) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_HUNTER_MASTERS_CALL_TRIGGERED) || !sSpellMgr->GetSpellInfo(spellInfo->Effects[EFFECT_0].CalcValue()) || !sSpellMgr->GetSpellInfo(spellInfo->Effects[EFFECT_1].CalcValue()))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_HUNTER_MASTERS_CALL_TRIGGERED,
+ static_cast<uint32>(spellInfo->Effects[EFFECT_0].CalcValue()),
+ static_cast<uint32>(spellInfo->Effects[EFFECT_1].CalcValue())
+ });
}
bool Load() override
@@ -820,9 +805,7 @@ class spell_hun_misdirection : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_HUNTER_MISDIRECTION_PROC))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_HUNTER_MISDIRECTION_PROC });
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -839,7 +822,7 @@ class spell_hun_misdirection : public SpellScriptLoader
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/)
{
PreventDefaultAction();
- GetTarget()->CastSpell(GetTarget(), SPELL_HUNTER_MISDIRECTION_PROC, true, NULL, aurEff);
+ GetTarget()->CastSpell(GetTarget(), SPELL_HUNTER_MISDIRECTION_PROC, true, nullptr, aurEff);
}
void Register() override
@@ -902,16 +885,14 @@ class spell_hun_pet_carrion_feeder : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_HUNTER_PET_CARRION_FEEDER_TRIGGERED))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_HUNTER_PET_CARRION_FEEDER_TRIGGERED });
}
SpellCastResult CheckIfCorpseNear()
{
Unit* caster = GetCaster();
float max_range = GetSpellInfo()->GetMaxRange(false);
- WorldObject* result = NULL;
+ WorldObject* result = nullptr;
// search for nearby enemy corpse in range
Trinity::AnyDeadUnitSpellTargetInRangeCheck check(caster, max_range, GetSpellInfo(), TARGET_CHECK_ENEMY);
Trinity::WorldObjectSearcher<Trinity::AnyDeadUnitSpellTargetInRangeCheck> searcher(caster, result, check);
@@ -961,9 +942,7 @@ class spell_hun_pet_heart_of_the_phoenix : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_HUNTER_PET_HEART_OF_THE_PHOENIX_TRIGGERED) || !sSpellMgr->GetSpellInfo(SPELL_HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_HUNTER_PET_HEART_OF_THE_PHOENIX_TRIGGERED, SPELL_HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF });
}
void HandleScript(SpellEffIndex /*effIndex*/)
@@ -1003,9 +982,7 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_HUNTER_PIERCING_SHOTS))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_HUNTER_PIERCING_SHOTS });
}
bool CheckProc(ProcEventInfo& eventInfo)
@@ -1060,9 +1037,7 @@ class spell_hun_rapid_recuperation : public SpellScriptLoader
bool Validate(SpellInfo const* spellInfo) override
{
- if (!sSpellMgr->GetSpellInfo(spellInfo->Effects[EFFECT_0].TriggerSpell))
- return false;
- return true;
+ return ValidateSpellInfo({ spellInfo->Effects[EFFECT_0].TriggerSpell });
}
void HandlePeriodic(AuraEffect const* aurEff)
@@ -1099,10 +1074,11 @@ class spell_hun_rapid_recuperation_trigger : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_HUNTER_RAPID_RECUPERATION_MANA_R1) ||
- !sSpellMgr->GetSpellInfo(SPELL_HUNTER_RAPID_RECUPERATION_MANA_R2))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_HUNTER_RAPID_RECUPERATION_MANA_R1,
+ SPELL_HUNTER_RAPID_RECUPERATION_MANA_R2
+ });
}
void HandleRapidFireProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
@@ -1202,9 +1178,7 @@ class spell_hun_roar_of_sacrifice : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_ROAR_OF_SACRIFICE_TRIGGERED))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_ROAR_OF_SACRIFICE_TRIGGERED });
}
bool CheckProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -1288,9 +1262,7 @@ class spell_hun_sniper_training : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_HUNTER_SNIPER_TRAINING_R1) || !sSpellMgr->GetSpellInfo(SPELL_HUNTER_SNIPER_TRAINING_BUFF_R1))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_HUNTER_SNIPER_TRAINING_R1, SPELL_HUNTER_SNIPER_TRAINING_BUFF_R1 });
}
void HandlePeriodic(AuraEffect const* aurEff)
@@ -1431,9 +1403,7 @@ class spell_hun_thrill_of_the_hunt : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_HUNTER_THRILL_OF_THE_HUNT_MANA))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_HUNTER_THRILL_OF_THE_HUNT_MANA });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -1489,9 +1459,7 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_HUNTER_T9_4P_GREATNESS))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_HUNTER_T9_4P_GREATNESS });
}
bool CheckProc(ProcEventInfo& eventInfo)
@@ -1534,10 +1502,11 @@ class spell_hun_viper_attack_speed : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_HUNTER_ASPECT_OF_THE_VIPER) ||
- !sSpellMgr->GetSpellInfo(SPELL_HUNTER_VICIOUS_VIPER))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_HUNTER_ASPECT_OF_THE_VIPER,
+ SPELL_HUNTER_VICIOUS_VIPER
+ });
}
void OnApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp
index 01f3efb0e33..0de0c0c00b9 100644
--- a/src/server/scripts/Spells/spell_item.cpp
+++ b/src/server/scripts/Spells/spell_item.cpp
@@ -21,15 +21,20 @@
* Scriptnames of files in this file should be prefixed with "spell_item_".
*/
-#include "Player.h"
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "SpellHistory.h"
-#include "SpellScript.h"
-#include "SpellAuraEffects.h"
-#include "SkillDiscovery.h"
#include "Battleground.h"
+#include "Containers.h"
+#include "Creature.h"
+#include "CreatureAIImpl.h"
#include "DBCStores.h"
+#include "Map.h"
+#include "ObjectMgr.h"
+#include "Player.h"
+#include "SkillDiscovery.h"
+#include "SpellAuraEffects.h"
+#include "SpellHistory.h"
+#include "SpellMgr.h"
+#include "SpellScript.h"
// Generic script for handling item dummy effects which trigger another spell.
class spell_item_trigger_spell : public SpellScriptLoader
@@ -38,22 +43,21 @@ class spell_item_trigger_spell : public SpellScriptLoader
uint32 _triggeredSpellId;
public:
- spell_item_trigger_spell(const char* name, uint32 triggeredSpellId) : SpellScriptLoader(name), _triggeredSpellId(triggeredSpellId) { }
+ spell_item_trigger_spell(char const* name, uint32 triggeredSpellId) : SpellScriptLoader(name), _triggeredSpellId(triggeredSpellId) { }
class spell_item_trigger_spell_SpellScript : public SpellScript
{
PrepareSpellScript(spell_item_trigger_spell_SpellScript);
- private:
+
uint32 _triggeredSpellId;
public:
spell_item_trigger_spell_SpellScript(uint32 triggeredSpellId) : SpellScript(), _triggeredSpellId(triggeredSpellId) { }
+ private:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(_triggeredSpellId))
- return false;
- return true;
+ return ValidateSpellInfo({ _triggeredSpellId });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -92,15 +96,13 @@ class spell_item_aegis_of_preservation : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_AEGIS_HEAL))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_AEGIS_HEAL });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/)
{
PreventDefaultAction();
- GetTarget()->CastSpell(GetTarget(), SPELL_AEGIS_HEAL, true, NULL, aurEff);
+ GetTarget()->CastSpell(GetTarget(), SPELL_AEGIS_HEAL, true, nullptr, aurEff);
}
void Register() override
@@ -142,10 +144,11 @@ class spell_item_alchemists_stone : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_ALCHEMISTS_STONE_EXTRA_HEAL) ||
- !sSpellMgr->GetSpellInfo(SPELL_ALCHEMISTS_STONE_EXTRA_MANA))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_ALCHEMISTS_STONE_EXTRA_HEAL,
+ SPELL_ALCHEMISTS_STONE_EXTRA_MANA
+ });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -213,11 +216,12 @@ class spell_item_anger_capacitor : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_MOTE_OF_ANGER) ||
- !sSpellMgr->GetSpellInfo(SPELL_MANIFEST_ANGER_MAIN_HAND) ||
- !sSpellMgr->GetSpellInfo(SPELL_MANIFEST_ANGER_OFF_HAND))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_MOTE_OF_ANGER,
+ SPELL_MANIFEST_ANGER_MAIN_HAND,
+ SPELL_MANIFEST_ANGER_OFF_HAND
+ });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -234,7 +238,7 @@ class spell_item_anger_capacitor : public SpellScriptLoader
caster->RemoveAurasDueToSpell(SPELL_MOTE_OF_ANGER);
uint32 spellId = SPELL_MANIFEST_ANGER_MAIN_HAND;
if (Player* player = caster->ToPlayer())
- if (player->GetWeaponForAttack(OFF_ATTACK, true) && urand(0, 1))
+ if (player->GetWeaponForAttack(OFF_ATTACK, true) && roll_chance_i(50))
spellId = SPELL_MANIFEST_ANGER_OFF_HAND;
caster->CastSpell(target, spellId, true, nullptr, aurEff);
@@ -312,18 +316,18 @@ class spell_item_aura_of_madness : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SOCIOPATH) ||
- !sSpellMgr->GetSpellInfo(SPELL_DELUSIONAL) ||
- !sSpellMgr->GetSpellInfo(SPELL_KLEPTOMANIA) ||
- !sSpellMgr->GetSpellInfo(SPELL_MEGALOMANIA) ||
- !sSpellMgr->GetSpellInfo(SPELL_PARANOIA) ||
- !sSpellMgr->GetSpellInfo(SPELL_MANIC) ||
- !sSpellMgr->GetSpellInfo(SPELL_NARCISSISM) ||
- !sSpellMgr->GetSpellInfo(SPELL_MARTYR_COMPLEX) ||
- !sSpellMgr->GetSpellInfo(SPELL_DEMENTIA) ||
- !sObjectMgr->GetBroadcastText(SAY_MADNESS))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_SOCIOPATH,
+ SPELL_DELUSIONAL,
+ SPELL_KLEPTOMANIA,
+ SPELL_MEGALOMANIA,
+ SPELL_PARANOIA,
+ SPELL_MANIC,
+ SPELL_NARCISSISM,
+ SPELL_MARTYR_COMPLEX,
+ SPELL_DEMENTIA
+ }) && sObjectMgr->GetBroadcastText(SAY_MADNESS);
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -389,10 +393,11 @@ class spell_item_dementia : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DEMENTIA_POS) ||
- !sSpellMgr->GetSpellInfo(SPELL_DEMENTIA_NEG))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_DEMENTIA_POS,
+ SPELL_DEMENTIA_NEG
+ });
}
void HandlePeriodicDummy(AuraEffect const* aurEff)
@@ -430,9 +435,7 @@ class spell_item_blessing_of_ancient_kings : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PROTECTION_OF_ANCIENT_KINGS))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_PROTECTION_OF_ANCIENT_KINGS });
}
bool CheckProc(ProcEventInfo& eventInfo)
@@ -519,9 +522,7 @@ class spell_item_deadly_precision_dummy : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DEADLY_PRECISION))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DEADLY_PRECISION });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -575,13 +576,14 @@ class spell_item_deathbringers_will : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(Strength) ||
- !sSpellMgr->GetSpellInfo(Agility) ||
- !sSpellMgr->GetSpellInfo(AttackPower) ||
- !sSpellMgr->GetSpellInfo(Critical) ||
- !sSpellMgr->GetSpellInfo(Haste))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ Strength,
+ Agility,
+ AttackPower,
+ Critical,
+ Haste
+ });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -706,11 +708,10 @@ class spell_item_defibrillate : public SpellScriptLoader
public:
spell_item_defibrillate_SpellScript(uint8 chance, uint32 failSpell) : SpellScript(), _chance(chance), _failSpell(failSpell) { }
+ private:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (_failSpell && !sSpellMgr->GetSpellInfo(_failSpell))
- return false;
- return true;
+ return !_failSpell || ValidateSpellInfo({ _failSpell });
}
void HandleScript(SpellEffIndex effIndex)
@@ -728,7 +729,6 @@ class spell_item_defibrillate : public SpellScriptLoader
OnEffectHitTarget += SpellEffectFn(spell_item_defibrillate_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_RESURRECT);
}
- private:
uint8 _chance;
uint32 _failSpell;
};
@@ -760,15 +760,13 @@ class spell_item_desperate_defense : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DESPERATE_RAGE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DESPERATE_RAGE });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/)
{
PreventDefaultAction();
- GetTarget()->CastSpell(GetTarget(), SPELL_DESPERATE_RAGE, true, NULL, aurEff);
+ GetTarget()->CastSpell(GetTarget(), SPELL_DESPERATE_RAGE, true, nullptr, aurEff);
}
void Register() override
@@ -810,17 +808,14 @@ class spell_item_deviate_fish : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- for (uint32 spellId = SPELL_SLEEPY; spellId <= SPELL_HEALTHY_SPIRIT; ++spellId)
- if (!sSpellMgr->GetSpellInfo(spellId))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SLEEPY, SPELL_INVIGORATE, SPELL_SHRINK, SPELL_PARTY_TIME, SPELL_HEALTHY_SPIRIT });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
uint32 spellId = urand(SPELL_SLEEPY, SPELL_HEALTHY_SPIRIT);
- caster->CastSpell(caster, spellId, true, NULL);
+ caster->CastSpell(caster, spellId, true, nullptr);
}
void Register() override
@@ -852,9 +847,7 @@ class spell_item_discerning_eye_beast_dummy : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DISCERNING_EYE_BEAST))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_DISCERNING_EYE_BEAST });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -926,9 +919,7 @@ class spell_item_fate_rune_of_unsurpassed_vigor : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_UNSURPASSED_VIGOR))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_UNSURPASSED_VIGOR });
}
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& /*eventInfo*/)
@@ -969,9 +960,7 @@ class spell_item_flask_of_the_north : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_FLASK_OF_THE_NORTH_SP) || !sSpellMgr->GetSpellInfo(SPELL_FLASK_OF_THE_NORTH_AP) || !sSpellMgr->GetSpellInfo(SPELL_FLASK_OF_THE_NORTH_STR))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_FLASK_OF_THE_NORTH_SP, SPELL_FLASK_OF_THE_NORTH_AP, SPELL_FLASK_OF_THE_NORTH_STR });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -1004,7 +993,7 @@ class spell_item_flask_of_the_north : public SpellScriptLoader
break;
}
- caster->CastSpell(caster, possibleSpells[urand(0, (possibleSpells.size() - 1))], true, NULL);
+ caster->CastSpell(caster, possibleSpells[urand(0, (possibleSpells.size() - 1))], true, nullptr);
}
void Register() override
@@ -1037,9 +1026,7 @@ class spell_item_frozen_shadoweave : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SHADOWMEND))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SHADOWMEND });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -1085,9 +1072,7 @@ class spell_item_gnomish_death_ray : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_GNOMISH_DEATH_RAY_SELF) || !sSpellMgr->GetSpellInfo(SPELL_GNOMISH_DEATH_RAY_TARGET))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_GNOMISH_DEATH_RAY_SELF, SPELL_GNOMISH_DEATH_RAY_TARGET });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -1132,9 +1117,7 @@ class spell_item_harm_prevention_belt : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_FORCEFIELD_COLLAPSE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_FORCEFIELD_COLLAPSE });
}
void HandleProc(ProcEventInfo& /*eventInfo*/)
@@ -1172,9 +1155,7 @@ class spell_item_healing_touch_refund : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_HEALING_TOUCH_MANA))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_HEALING_TOUCH_MANA });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -1226,12 +1207,13 @@ class spell_item_heartpierce : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(Energy) ||
- !sSpellMgr->GetSpellInfo(Mana) ||
- !sSpellMgr->GetSpellInfo(Rage) ||
- !sSpellMgr->GetSpellInfo(RunicPower))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ Energy,
+ Mana,
+ Rage,
+ RunicPower
+ });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -1334,9 +1316,14 @@ class spell_item_make_a_wish : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_MR_PINCHYS_BLESSING) || !sSpellMgr->GetSpellInfo(SPELL_SUMMON_MIGHTY_MR_PINCHY) || !sSpellMgr->GetSpellInfo(SPELL_SUMMON_FURIOUS_MR_PINCHY) || !sSpellMgr->GetSpellInfo(SPELL_TINY_MAGICAL_CRAWDAD) || !sSpellMgr->GetSpellInfo(SPELL_MR_PINCHYS_GIFT))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_MR_PINCHYS_BLESSING,
+ SPELL_SUMMON_MIGHTY_MR_PINCHY,
+ SPELL_SUMMON_FURIOUS_MR_PINCHY,
+ SPELL_TINY_MAGICAL_CRAWDAD,
+ SPELL_MR_PINCHYS_GIFT
+ });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -1350,7 +1337,7 @@ class spell_item_make_a_wish : public SpellScriptLoader
case 3: spellId = SPELL_SUMMON_FURIOUS_MR_PINCHY; break;
case 4: spellId = SPELL_TINY_MAGICAL_CRAWDAD; break;
}
- caster->CastSpell(caster, spellId, true, NULL);
+ caster->CastSpell(caster, spellId, true, nullptr);
}
void Register() override
@@ -1384,9 +1371,7 @@ class spell_item_mark_of_conquest : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_MARK_OF_CONQUEST_ENERGIZE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_MARK_OF_CONQUEST_ENERGIZE });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -1485,9 +1470,7 @@ class spell_item_necrotic_touch : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_ITEM_NECROTIC_TOUCH_PROC))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_ITEM_NECROTIC_TOUCH_PROC });
}
bool CheckProc(ProcEventInfo& eventInfo)
@@ -1539,9 +1522,12 @@ class spell_item_net_o_matic : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_NET_O_MATIC_TRIGGERED1) || !sSpellMgr->GetSpellInfo(SPELL_NET_O_MATIC_TRIGGERED2) || !sSpellMgr->GetSpellInfo(SPELL_NET_O_MATIC_TRIGGERED3))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_NET_O_MATIC_TRIGGERED1,
+ SPELL_NET_O_MATIC_TRIGGERED2,
+ SPELL_NET_O_MATIC_TRIGGERED3
+ });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -1596,9 +1582,12 @@ class spell_item_noggenfogger_elixir : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_NOGGENFOGGER_ELIXIR_TRIGGERED1) || !sSpellMgr->GetSpellInfo(SPELL_NOGGENFOGGER_ELIXIR_TRIGGERED2) || !sSpellMgr->GetSpellInfo(SPELL_NOGGENFOGGER_ELIXIR_TRIGGERED3))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_NOGGENFOGGER_ELIXIR_TRIGGERED1,
+ SPELL_NOGGENFOGGER_ELIXIR_TRIGGERED2,
+ SPELL_NOGGENFOGGER_ELIXIR_TRIGGERED3
+ });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -1673,9 +1662,7 @@ class spell_item_persistent_shield : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PERSISTENT_SHIELD_TRIGGERED))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_PERSISTENT_SHIELD_TRIGGERED });
}
bool CheckProc(ProcEventInfo& eventInfo)
@@ -1729,9 +1716,7 @@ class spell_item_pet_healing : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_HEALTH_LINK))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_HEALTH_LINK });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -1813,10 +1798,13 @@ class spell_item_savory_deviate_delight : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- for (uint32 spellId = SPELL_FLIP_OUT_MALE; spellId <= SPELL_YAAARRRR_FEMALE; ++spellId)
- if (!sSpellMgr->GetSpellInfo(spellId))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_FLIP_OUT_MALE,
+ SPELL_FLIP_OUT_FEMALE,
+ SPELL_YAAARRRR_MALE,
+ SPELL_YAAARRRR_FEMALE
+ });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -1830,7 +1818,7 @@ class spell_item_savory_deviate_delight : public SpellScriptLoader
// Yaaarrrr - pirate
case 2: spellId = (caster->getGender() == GENDER_MALE ? SPELL_YAAARRRR_MALE : SPELL_YAAARRRR_FEMALE); break;
}
- caster->CastSpell(caster, spellId, true, NULL);
+ caster->CastSpell(caster, spellId, true, nullptr);
}
void Register() override
@@ -2013,13 +2001,12 @@ class spell_item_shadowmourne : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SHADOWMOURNE_CHAOS_BANE_DAMAGE))
- return false;
- if (!sSpellMgr->GetSpellInfo(SPELL_SHADOWMOURNE_SOUL_FRAGMENT))
- return false;
- if (!sSpellMgr->GetSpellInfo(SPELL_SHADOWMOURNE_CHAOS_BANE_BUFF))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_SHADOWMOURNE_CHAOS_BANE_DAMAGE,
+ SPELL_SHADOWMOURNE_SOUL_FRAGMENT,
+ SPELL_SHADOWMOURNE_CHAOS_BANE_BUFF
+ });
}
bool CheckProc(ProcEventInfo& eventInfo)
@@ -2032,14 +2019,14 @@ class spell_item_shadowmourne : public SpellScriptLoader
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
- GetTarget()->CastSpell(GetTarget(), SPELL_SHADOWMOURNE_SOUL_FRAGMENT, true, NULL, aurEff);
+ GetTarget()->CastSpell(GetTarget(), SPELL_SHADOWMOURNE_SOUL_FRAGMENT, true, nullptr, aurEff);
// this can't be handled in AuraScript of SoulFragments because we need to know victim
if (Aura* soulFragments = GetTarget()->GetAura(SPELL_SHADOWMOURNE_SOUL_FRAGMENT))
{
if (soulFragments->GetStackAmount() >= 10)
{
- GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_SHADOWMOURNE_CHAOS_BANE_DAMAGE, true, NULL, aurEff);
+ GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_SHADOWMOURNE_CHAOS_BANE_DAMAGE, true, nullptr, aurEff);
soulFragments->Remove();
}
}
@@ -2070,9 +2057,12 @@ class spell_item_shadowmourne_soul_fragment : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SHADOWMOURNE_VISUAL_LOW) || !sSpellMgr->GetSpellInfo(SPELL_SHADOWMOURNE_VISUAL_HIGH) || !sSpellMgr->GetSpellInfo(SPELL_SHADOWMOURNE_CHAOS_BANE_BUFF))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_SHADOWMOURNE_VISUAL_LOW,
+ SPELL_SHADOWMOURNE_VISUAL_HIGH,
+ SPELL_SHADOWMOURNE_CHAOS_BANE_BUFF
+ });
}
void OnStackChange(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -2139,9 +2129,15 @@ class spell_item_six_demon_bag : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_FROSTBOLT) || !sSpellMgr->GetSpellInfo(SPELL_POLYMORPH) || !sSpellMgr->GetSpellInfo(SPELL_SUMMON_FELHOUND_MINION) || !sSpellMgr->GetSpellInfo(SPELL_FIREBALL) || !sSpellMgr->GetSpellInfo(SPELL_CHAIN_LIGHTNING) || !sSpellMgr->GetSpellInfo(SPELL_ENVELOPING_WINDS))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_FROSTBOLT,
+ SPELL_POLYMORPH,
+ SPELL_SUMMON_FELHOUND_MINION,
+ SPELL_FIREBALL,
+ SPELL_CHAIN_LIGHTNING,
+ SPELL_ENVELOPING_WINDS
+ });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -2204,9 +2200,7 @@ class spell_item_swift_hand_justice_dummy : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SWIFT_HAND_OF_JUSTICE_HEAL))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SWIFT_HAND_OF_JUSTICE_HEAL });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -2248,9 +2242,7 @@ class spell_item_totem_of_flowing_water : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_LESSER_HEALING_WAVE_MANA))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_LESSER_HEALING_WAVE_MANA });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -2325,9 +2317,12 @@ class spell_item_underbelly_elixir : public SpellScriptLoader
}
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_UNDERBELLY_ELIXIR_TRIGGERED1) || !sSpellMgr->GetSpellInfo(SPELL_UNDERBELLY_ELIXIR_TRIGGERED2) || !sSpellMgr->GetSpellInfo(SPELL_UNDERBELLY_ELIXIR_TRIGGERED3))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_UNDERBELLY_ELIXIR_TRIGGERED1,
+ SPELL_UNDERBELLY_ELIXIR_TRIGGERED2,
+ SPELL_UNDERBELLY_ELIXIR_TRIGGERED3
+ });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -2339,7 +2334,7 @@ class spell_item_underbelly_elixir : public SpellScriptLoader
case 1: spellId = SPELL_UNDERBELLY_ELIXIR_TRIGGERED1; break;
case 2: spellId = SPELL_UNDERBELLY_ELIXIR_TRIGGERED2; break;
}
- caster->CastSpell(caster, spellId, true, NULL);
+ caster->CastSpell(caster, spellId, true, nullptr);
}
void Register() override
@@ -2423,9 +2418,12 @@ class spell_item_red_rider_air_rifle : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_AIR_RIFLE_HOLD_VISUAL) || !sSpellMgr->GetSpellInfo(SPELL_AIR_RIFLE_SHOOT) || !sSpellMgr->GetSpellInfo(SPELL_AIR_RIFLE_SHOOT_SELF))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_AIR_RIFLE_HOLD_VISUAL,
+ SPELL_AIR_RIFLE_SHOOT,
+ SPELL_AIR_RIFLE_SHOOT_SELF
+ });
}
void HandleScript(SpellEffIndex effIndex)
@@ -2654,9 +2652,12 @@ class spell_item_vanquished_clutches : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_CRUSHER) || !sSpellMgr->GetSpellInfo(SPELL_CONSTRICTOR) || !sSpellMgr->GetSpellInfo(SPELL_CORRUPTOR))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_CRUSHER,
+ SPELL_CONSTRICTOR,
+ SPELL_CORRUPTOR
+ });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -2840,15 +2841,17 @@ class spell_item_purify_helboar_meat : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_PURIFIED_HELBOAR_MEAT) || !sSpellMgr->GetSpellInfo(SPELL_SUMMON_TOXIC_HELBOAR_MEAT))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_SUMMON_PURIFIED_HELBOAR_MEAT,
+ SPELL_SUMMON_TOXIC_HELBOAR_MEAT
+ });
}
void HandleDummy(SpellEffIndex /* effIndex */)
{
Unit* caster = GetCaster();
- caster->CastSpell(caster, roll_chance_i(50) ? SPELL_SUMMON_PURIFIED_HELBOAR_MEAT : SPELL_SUMMON_TOXIC_HELBOAR_MEAT, true, NULL);
+ caster->CastSpell(caster, roll_chance_i(50) ? SPELL_SUMMON_PURIFIED_HELBOAR_MEAT : SPELL_SUMMON_TOXIC_HELBOAR_MEAT, true, nullptr);
}
void Register() override
@@ -2889,7 +2892,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(nullptr)));
target->DespawnOrUnsummon();
}
}
@@ -2926,11 +2929,14 @@ class spell_item_reindeer_transformation : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_FLYING_REINDEER_310) || !sSpellMgr->GetSpellInfo(SPELL_FLYING_REINDEER_280)
- || !sSpellMgr->GetSpellInfo(SPELL_FLYING_REINDEER_60) || !sSpellMgr->GetSpellInfo(SPELL_REINDEER_100)
- || !sSpellMgr->GetSpellInfo(SPELL_REINDEER_60))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_FLYING_REINDEER_310,
+ SPELL_FLYING_REINDEER_280,
+ SPELL_FLYING_REINDEER_60,
+ SPELL_REINDEER_100,
+ SPELL_REINDEER_60
+ });
}
void HandleDummy(SpellEffIndex /* effIndex */)
@@ -2991,9 +2997,7 @@ class spell_item_nigh_invulnerability : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_NIGH_INVULNERABILITY) || !sSpellMgr->GetSpellInfo(SPELL_COMPLETE_VULNERABILITY))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_NIGH_INVULNERABILITY, SPELL_COMPLETE_VULNERABILITY });
}
void HandleDummy(SpellEffIndex /* effIndex */)
@@ -3037,9 +3041,7 @@ class spell_item_poultryizer : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_POULTRYIZER_SUCCESS) || !sSpellMgr->GetSpellInfo(SPELL_POULTRYIZER_BACKFIRE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_POULTRYIZER_SUCCESS, SPELL_POULTRYIZER_BACKFIRE });
}
void HandleDummy(SpellEffIndex /* effIndex */)
@@ -3081,9 +3083,7 @@ class spell_item_socrethars_stone : public SpellScriptLoader
}
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SOCRETHAR_TO_SEAT) || !sSpellMgr->GetSpellInfo(SPELL_SOCRETHAR_FROM_SEAT))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SOCRETHAR_TO_SEAT, SPELL_SOCRETHAR_FROM_SEAT });
}
void HandleDummy(SpellEffIndex /* effIndex */)
@@ -3132,9 +3132,9 @@ class spell_item_demon_broiled_surprise : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_CREATE_DEMON_BROILED_SURPRISE) || !sObjectMgr->GetCreatureTemplate(NPC_ABYSSAL_FLAMEBRINGER) || !sObjectMgr->GetQuestTemplate(QUEST_SUPER_HOT_STEW))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_CREATE_DEMON_BROILED_SURPRISE }) &&
+ sObjectMgr->GetCreatureTemplate(NPC_ABYSSAL_FLAMEBRINGER) &&
+ sObjectMgr->GetQuestTemplate(QUEST_SUPER_HOT_STEW);
}
bool Load() override
@@ -3189,9 +3189,7 @@ class spell_item_complete_raptor_capture : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_RAPTOR_CAPTURE_CREDIT))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_RAPTOR_CAPTURE_CREDIT });
}
void HandleDummy(SpellEffIndex /* effIndex */)
@@ -3202,7 +3200,7 @@ class spell_item_complete_raptor_capture : public SpellScriptLoader
GetHitCreature()->DespawnOrUnsummon();
//cast spell Raptor Capture Credit
- caster->CastSpell(caster, SPELL_RAPTOR_CAPTURE_CREDIT, true, NULL);
+ caster->CastSpell(caster, SPELL_RAPTOR_CAPTURE_CREDIT, true, nullptr);
}
}
@@ -3283,9 +3281,13 @@ class spell_item_brewfest_mount_transformation : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_MOUNT_RAM_100) || !sSpellMgr->GetSpellInfo(SPELL_MOUNT_RAM_60) || !sSpellMgr->GetSpellInfo(SPELL_MOUNT_KODO_100) || !sSpellMgr->GetSpellInfo(SPELL_MOUNT_KODO_60))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_MOUNT_RAM_100,
+ SPELL_MOUNT_RAM_60,
+ SPELL_MOUNT_KODO_100,
+ SPELL_MOUNT_KODO_60
+ });
}
void HandleDummy(SpellEffIndex /* effIndex */)
@@ -3353,9 +3355,7 @@ class spell_item_nitro_boots : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_NITRO_BOOTS_SUCCESS) || !sSpellMgr->GetSpellInfo(SPELL_NITRO_BOOTS_BACKFIRE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_NITRO_BOOTS_SUCCESS, SPELL_NITRO_BOOTS_BACKFIRE });
}
void HandleDummy(SpellEffIndex /* effIndex */)
@@ -3399,9 +3399,7 @@ class spell_item_teach_language : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_LEARN_GNOMISH_BINARY) || !sSpellMgr->GetSpellInfo(SPELL_LEARN_GOBLIN_BINARY))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_LEARN_GNOMISH_BINARY, SPELL_LEARN_GOBLIN_BINARY });
}
void HandleDummy(SpellEffIndex /* effIndex */)
@@ -3445,9 +3443,7 @@ class spell_item_rocket_boots : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_ROCKET_BOOTS_PROC))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_ROCKET_BOOTS_PROC });
}
void HandleDummy(SpellEffIndex /* effIndex */)
@@ -3457,7 +3453,7 @@ class spell_item_rocket_boots : public SpellScriptLoader
bg->EventPlayerDroppedFlag(caster);
caster->GetSpellHistory()->ResetCooldown(SPELL_ROCKET_BOOTS_PROC);
- caster->CastSpell(caster, SPELL_ROCKET_BOOTS_PROC, true, NULL);
+ caster->CastSpell(caster, SPELL_ROCKET_BOOTS_PROC, true, nullptr);
}
SpellCastResult CheckCast()
@@ -3497,9 +3493,7 @@ class spell_item_pygmy_oil : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PYGMY_OIL_PYGMY_AURA) || !sSpellMgr->GetSpellInfo(SPELL_PYGMY_OIL_SMALLER_AURA))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_PYGMY_OIL_PYGMY_AURA, SPELL_PYGMY_OIL_SMALLER_AURA });
}
void HandleDummy(SpellEffIndex /* effIndex */)
@@ -3583,9 +3577,9 @@ class spell_item_chicken_cover : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_CHICKEN_NET) || !sSpellMgr->GetSpellInfo(SPELL_CAPTURE_CHICKEN_ESCAPE) || !sObjectMgr->GetQuestTemplate(QUEST_CHICKEN_PARTY) || !sObjectMgr->GetQuestTemplate(QUEST_FLOWN_THE_COOP))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_CHICKEN_NET, SPELL_CAPTURE_CHICKEN_ESCAPE }) &&
+ sObjectMgr->GetQuestTemplate(QUEST_CHICKEN_PARTY) &&
+ sObjectMgr->GetQuestTemplate(QUEST_FLOWN_THE_COOP);
}
void HandleDummy(SpellEffIndex /* effIndex */)
@@ -3744,10 +3738,11 @@ class spell_item_shard_of_the_scale : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(HealProc) ||
- !sSpellMgr->GetSpellInfo(DamageProc))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ HealProc,
+ DamageProc
+ });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -3794,12 +3789,13 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SOUL_PRESERVER_DRUID) ||
- !sSpellMgr->GetSpellInfo(SPELL_SOUL_PRESERVER_PALADIN) ||
- !sSpellMgr->GetSpellInfo(SPELL_SOUL_PRESERVER_PRIEST) ||
- !sSpellMgr->GetSpellInfo(SPELL_SOUL_PRESERVER_SHAMAN))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_SOUL_PRESERVER_DRUID,
+ SPELL_SOUL_PRESERVER_PALADIN,
+ SPELL_SOUL_PRESERVER_PRIEST,
+ SPELL_SOUL_PRESERVER_SHAMAN
+ });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -3881,12 +3877,9 @@ class spell_item_sunwell_neck : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sFactionStore.LookupEntry(FACTION_ALDOR) ||
- !sFactionStore.LookupEntry(FACTION_SCRYERS) ||
- !sSpellMgr->GetSpellInfo(Aldors) ||
- !sSpellMgr->GetSpellInfo(Scryers))
- return false;
- return true;
+ return ValidateSpellInfo({ Aldors, Scryers }) &&
+ sFactionStore.LookupEntry(FACTION_ALDOR) &&
+ sFactionStore.LookupEntry(FACTION_SCRYERS);
}
bool CheckProc(ProcEventInfo& eventInfo)
@@ -3981,12 +3974,13 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DEATH_CHOICE_NORMAL_STRENGTH) ||
- !sSpellMgr->GetSpellInfo(SPELL_DEATH_CHOICE_NORMAL_AGILITY) ||
- !sSpellMgr->GetSpellInfo(SPELL_DEATH_CHOICE_HEROIC_STRENGTH) ||
- !sSpellMgr->GetSpellInfo(SPELL_DEATH_CHOICE_HEROIC_AGILITY))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_DEATH_CHOICE_NORMAL_STRENGTH,
+ SPELL_DEATH_CHOICE_NORMAL_AGILITY,
+ SPELL_DEATH_CHOICE_HEROIC_STRENGTH,
+ SPELL_DEATH_CHOICE_HEROIC_AGILITY
+ });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -4065,11 +4059,10 @@ public:
{
}
+ private:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(_stackSpell) || !sSpellMgr->GetSpellInfo(_triggerSpell))
- return false;
- return true;
+ return ValidateSpellInfo({ _stackSpell, _triggerSpell });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -4097,7 +4090,6 @@ public:
OnEffectProc += AuraEffectProcFn(spell_item_trinket_stack_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL);
}
- private:
uint32 _stackSpell;
uint32 _triggerSpell;
};
@@ -4115,7 +4107,7 @@ private:
// 57345 - Darkmoon Card: Greatness
enum DarkmoonCardSpells
{
- SPELL_DARKMOON_CARD_STRENGHT = 60229,
+ SPELL_DARKMOON_CARD_STRENGTH = 60229,
SPELL_DARKMOON_CARD_AGILITY = 60233,
SPELL_DARKMOON_CARD_INTELLECT = 60234,
SPELL_DARKMOON_CARD_SPIRIT = 60235,
@@ -4132,12 +4124,13 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_DARKMOON_CARD_STRENGHT) ||
- !sSpellMgr->GetSpellInfo(SPELL_DARKMOON_CARD_AGILITY) ||
- !sSpellMgr->GetSpellInfo(SPELL_DARKMOON_CARD_INTELLECT) ||
- !sSpellMgr->GetSpellInfo(SPELL_DARKMOON_CARD_SPIRIT))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_DARKMOON_CARD_STRENGTH,
+ SPELL_DARKMOON_CARD_AGILITY,
+ SPELL_DARKMOON_CARD_INTELLECT,
+ SPELL_DARKMOON_CARD_SPIRIT
+ });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -4151,11 +4144,11 @@ public:
float spi = caster->GetStat(STAT_SPIRIT);
float stat = 0.0f;
- uint32 spellTrigger = SPELL_DARKMOON_CARD_STRENGHT;
+ uint32 spellTrigger = SPELL_DARKMOON_CARD_STRENGTH;
if (str > stat)
{
- spellTrigger = SPELL_DARKMOON_CARD_STRENGHT;
+ spellTrigger = SPELL_DARKMOON_CARD_STRENGTH;
stat = str;
}
@@ -4209,9 +4202,7 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_CHARM_WITCH_DOCTOR_PROC))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_CHARM_WITCH_DOCTOR_PROC });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -4258,10 +4249,11 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_MANA_DRAIN_ENERGIZE)
- || !sSpellMgr->GetSpellInfo(SPELL_MANA_DRAIN_LEECH))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_MANA_DRAIN_ENERGIZE,
+ SPELL_MANA_DRAIN_LEECH
+ });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -4309,11 +4301,8 @@ class spell_item_taunt_flag_targeting : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_TAUNT_FLAG))
- return false;
- if (!sObjectMgr->GetBroadcastText(EMOTE_PLANTS_FLAG))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_TAUNT_FLAG }) &&
+ sObjectMgr->GetBroadcastText(EMOTE_PLANTS_FLAG);
}
void FilterTargets(std::list<WorldObject*>& targets)
@@ -4381,9 +4370,7 @@ class spell_item_mind_control_cap : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_GNOMISH_MIND_CONTROL_CAP) || !sSpellMgr->GetSpellInfo(SPELL_DULLARD))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_GNOMISH_MIND_CONTROL_CAP, SPELL_DULLARD });
}
void HandleDummy(SpellEffIndex /* effIndex */)
@@ -4436,9 +4423,7 @@ class spell_item_universal_remote : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_CONTROL_MACHINE) || !sSpellMgr->GetSpellInfo(SPELL_MOBILITY_MALFUNCTION) || !sSpellMgr->GetSpellInfo(SPELL_TARGET_LOCK))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_CONTROL_MACHINE, SPELL_MOBILITY_MALFUNCTION, SPELL_TARGET_LOCK });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -4492,9 +4477,7 @@ class spell_item_zandalarian_charm : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(_spellId))
- return false;
- return true;
+ return ValidateSpellInfo({ _spellId });
}
bool CheckProc(ProcEventInfo& eventInfo)
diff --git a/src/server/scripts/Spells/spell_mage.cpp b/src/server/scripts/Spells/spell_mage.cpp
index 72b4a323710..c40e164a130 100644
--- a/src/server/scripts/Spells/spell_mage.cpp
+++ b/src/server/scripts/Spells/spell_mage.cpp
@@ -21,11 +21,14 @@
* Scriptnames of files in this file should be prefixed with "spell_mage_".
*/
-#include "Player.h"
#include "ScriptMgr.h"
+#include "Creature.h"
+#include "Player.h"
+#include "Random.h"
+#include "SpellAuraEffects.h"
#include "SpellHistory.h"
+#include "SpellMgr.h"
#include "SpellScript.h"
-#include "SpellAuraEffects.h"
enum MageSpells
{
@@ -79,11 +82,11 @@ class spell_mage_incanters_absorbtion_base_AuraScript : public AuraScript
public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_MAGE_INCANTERS_ABSORBTION_TRIGGERED))
- return false;
- if (!sSpellMgr->GetSpellInfo(SPELL_MAGE_INCANTERS_ABSORBTION_R1))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_MAGE_INCANTERS_ABSORBTION_TRIGGERED,
+ SPELL_MAGE_INCANTERS_ABSORBTION_R1
+ });
}
void Trigger(AuraEffect* aurEff, DamageInfo& /*dmgInfo*/, uint32& absorbAmount)
@@ -93,7 +96,7 @@ class spell_mage_incanters_absorbtion_base_AuraScript : public AuraScript
if (AuraEffect* talentAurEff = target->GetAuraEffectOfRankedSpell(SPELL_MAGE_INCANTERS_ABSORBTION_R1, EFFECT_0))
{
int32 bp = CalculatePct(absorbAmount, talentAurEff->GetAmount());
- target->CastCustomSpell(target, SPELL_MAGE_INCANTERS_ABSORBTION_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff);
+ target->CastCustomSpell(target, SPELL_MAGE_INCANTERS_ABSORBTION_TRIGGERED, &bp, nullptr, nullptr, true, nullptr, aurEff);
}
}
};
@@ -110,10 +113,11 @@ class spell_mage_arcane_potency : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_MAGE_ARCANE_POTENCY_RANK_1) ||
- !sSpellMgr->GetSpellInfo(SPELL_MAGE_ARCANE_POTENCY_RANK_2))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_MAGE_ARCANE_POTENCY_RANK_1,
+ SPELL_MAGE_ARCANE_POTENCY_RANK_2
+ });
}
bool CheckProc(ProcEventInfo& eventInfo)
@@ -161,9 +165,7 @@ class spell_mage_blast_wave : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_MAGE_GLYPH_OF_BLAST_WAVE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_MAGE_GLYPH_OF_BLAST_WAVE });
}
void HandleKnockBack(SpellEffIndex effIndex)
@@ -196,9 +198,7 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_MAGE_BLAZING_SPEED))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_MAGE_BLAZING_SPEED });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -264,9 +264,7 @@ class spell_mage_burnout : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_MAGE_BURNOUT))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_MAGE_BURNOUT });
}
bool CheckProc(ProcEventInfo& eventInfo)
@@ -350,9 +348,7 @@ class spell_mage_combustion : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_MAGE_COMBUSTION_PROC))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_MAGE_COMBUSTION_PROC });
}
bool CheckProc(ProcEventInfo& eventInfo)
@@ -391,9 +387,7 @@ class spell_mage_imp_blizzard : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_MAGE_CHILLED))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_MAGE_CHILLED });
}
void HandleChill(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -428,9 +422,7 @@ class spell_mage_imp_mana_gems : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_MAGE_MANA_SURGE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_MAGE_MANA_SURGE });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -463,9 +455,7 @@ class spell_mage_empowered_fire : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_MAGE_EMPOWERED_FIRE_PROC))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_MAGE_EMPOWERED_FIRE_PROC });
}
bool CheckProc(ProcEventInfo& eventInfo)
@@ -511,9 +501,7 @@ class spell_mage_fingers_of_frost : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_MAGE_FINGERS_OF_FROST_AURASTATE_AURA))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_MAGE_FINGERS_OF_FROST_AURASTATE_AURA });
}
void HandleDummy(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
@@ -553,11 +541,11 @@ class spell_mage_fire_frost_ward : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_MAGE_FROST_WARDING_TRIGGERED))
- return false;
- if (!sSpellMgr->GetSpellInfo(SPELL_MAGE_FROST_WARDING_R1))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_MAGE_FROST_WARDING_TRIGGERED,
+ SPELL_MAGE_FROST_WARDING_R1
+ });
}
void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& canBeRecalculated)
@@ -586,7 +574,7 @@ class spell_mage_fire_frost_ward : public SpellScriptLoader
{
int32 bp = dmgInfo.GetDamage();
dmgInfo.AbsorbDamage(bp);
- target->CastCustomSpell(target, SPELL_MAGE_FROST_WARDING_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff);
+ target->CastCustomSpell(target, SPELL_MAGE_FROST_WARDING_TRIGGERED, &bp, nullptr, nullptr, true, nullptr, aurEff);
absorbAmount = 0;
PreventDefaultAction();
}
@@ -617,18 +605,9 @@ class spell_mage_focus_magic : public SpellScriptLoader
{
PrepareAuraScript(spell_mage_focus_magic_AuraScript);
- public:
- spell_mage_focus_magic_AuraScript()
- {
- _procTarget = nullptr;
- }
-
- private:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_MAGE_FOCUS_MAGIC_PROC))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_MAGE_FOCUS_MAGIC_PROC });
}
bool CheckProc(ProcEventInfo& /*eventInfo*/)
@@ -640,7 +619,7 @@ class spell_mage_focus_magic : public SpellScriptLoader
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/)
{
PreventDefaultAction();
- GetTarget()->CastSpell(_procTarget, SPELL_MAGE_FOCUS_MAGIC_PROC, true, NULL, aurEff);
+ GetTarget()->CastSpell(_procTarget, SPELL_MAGE_FOCUS_MAGIC_PROC, true, nullptr, aurEff);
}
void Register() override
@@ -649,8 +628,7 @@ class spell_mage_focus_magic : public SpellScriptLoader
OnEffectProc += AuraEffectProcFn(spell_mage_focus_magic_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_MOD_SPELL_CRIT_CHANCE);
}
- private:
- Unit* _procTarget;
+ Unit* _procTarget = nullptr;
};
AuraScript* GetAuraScript() const override
@@ -673,11 +651,12 @@ class spell_mage_gen_extra_effects : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_MAGE_T10_2P_BONUS) ||
- !sSpellMgr->GetSpellInfo(SPELL_MAGE_T10_2P_BONUS_EFFECT) ||
- !sSpellMgr->GetSpellInfo(SPELL_MAGE_T8_4P_BONUS))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_MAGE_T10_2P_BONUS,
+ SPELL_MAGE_T10_2P_BONUS_EFFECT,
+ SPELL_MAGE_T8_4P_BONUS
+ });
}
bool CheckProc(ProcEventInfo& eventInfo)
@@ -825,9 +804,7 @@ class spell_mage_hot_streak : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_MAGE_HOT_STREAK_PROC))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_MAGE_HOT_STREAK_PROC });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -880,9 +857,7 @@ class spell_mage_ice_barrier : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_MAGE_SHATTERED_BARRIER))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_MAGE_SHATTERED_BARRIER });
}
void CalculateAmount(AuraEffect const* aurEff, int32& amount, bool& canBeRecalculated)
@@ -942,9 +917,7 @@ class spell_mage_ignite : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_MAGE_IGNITE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_MAGE_IGNITE });
}
bool CheckProc(ProcEventInfo& eventInfo)
@@ -989,9 +962,7 @@ class spell_mage_living_bomb : public SpellScriptLoader
bool Validate(SpellInfo const* spell) override
{
- if (!sSpellMgr->GetSpellInfo(uint32(spell->Effects[EFFECT_1].CalcValue())))
- return false;
- return true;
+ return ValidateSpellInfo({ static_cast<uint32>(spell->Effects[EFFECT_1].CalcValue()) });
}
void AfterRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
@@ -1001,7 +972,7 @@ class spell_mage_living_bomb : public SpellScriptLoader
return;
if (Unit* caster = GetCaster())
- caster->CastSpell(GetTarget(), uint32(aurEff->GetAmount()), true, NULL, aurEff);
+ caster->CastSpell(GetTarget(), uint32(aurEff->GetAmount()), true, nullptr, aurEff);
}
void Register() override
@@ -1028,9 +999,7 @@ class spell_mage_magic_absorption : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_MAGE_MAGIC_ABSORPTION_MANA))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_MAGE_MAGIC_ABSORPTION_MANA });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -1065,10 +1034,8 @@ class spell_mage_mana_shield : public SpellScriptLoader
bool Validate(SpellInfo const* spellInfo) override
{
- if (!spell_mage_incanters_absorbtion_base_AuraScript::Validate(spellInfo) ||
- !sSpellMgr->GetSpellInfo(SPELL_MAGE_ARCANE_SURGE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_MAGE_ARCANE_SURGE }) &&
+ spell_mage_incanters_absorbtion_base_AuraScript::Validate(spellInfo);
}
void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& canBeRecalculated)
@@ -1119,9 +1086,7 @@ class spell_mage_master_of_elements : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_MAGE_MASTER_OF_ELEMENTS_ENERGIZE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_MAGE_MASTER_OF_ELEMENTS_ENERGIZE });
}
bool CheckProc(ProcEventInfo& eventInfo)
@@ -1209,22 +1174,18 @@ class spell_mage_polymorph_cast_visual : public SpellScriptLoader
{
PrepareSpellScript(spell_mage_polymorph_cast_visual_SpellScript);
- static const uint32 PolymorhForms[6];
+ static const uint32 PolymorphForms[6];
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- // check if spell ids exist in dbc
- for (uint32 i = 0; i < 6; ++i)
- if (!sSpellMgr->GetSpellInfo(PolymorhForms[i]))
- return false;
- return true;
+ return ValidateSpellInfo(PolymorphForms);
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
if (Unit* target = GetCaster()->FindNearestCreature(NPC_AUROSALIA, 30.0f))
if (target->GetTypeId() == TYPEID_UNIT)
- target->CastSpell(target, PolymorhForms[urand(0, 5)], true);
+ target->CastSpell(target, PolymorphForms[urand(0, 5)], true);
}
void Register() override
@@ -1239,7 +1200,7 @@ class spell_mage_polymorph_cast_visual : public SpellScriptLoader
}
};
-const uint32 spell_mage_polymorph_cast_visual::spell_mage_polymorph_cast_visual_SpellScript::PolymorhForms[6] =
+const uint32 spell_mage_polymorph_cast_visual::spell_mage_polymorph_cast_visual_SpellScript::PolymorphForms[6] =
{
SPELL_MAGE_SQUIRREL_FORM,
SPELL_MAGE_GIRAFFE_FORM,
@@ -1261,9 +1222,12 @@ class spell_mage_summon_water_elemental : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_MAGE_GLYPH_OF_ETERNAL_WATER) || !sSpellMgr->GetSpellInfo(SPELL_MAGE_SUMMON_WATER_ELEMENTAL_TEMPORARY) || !sSpellMgr->GetSpellInfo(SPELL_MAGE_SUMMON_WATER_ELEMENTAL_PERMANENT))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_MAGE_GLYPH_OF_ETERNAL_WATER,
+ SPELL_MAGE_SUMMON_WATER_ELEMENTAL_TEMPORARY,
+ SPELL_MAGE_SUMMON_WATER_ELEMENTAL_PERMANENT
+ });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp
index b259db332a9..08ea6472a8d 100644
--- a/src/server/scripts/Spells/spell_paladin.cpp
+++ b/src/server/scripts/Spells/spell_paladin.cpp
@@ -21,13 +21,15 @@
* Scriptnames of files in this file should be prefixed with "spell_pal_".
*/
-#include "Player.h"
-#include "GameTime.h"
#include "ScriptMgr.h"
-#include "SpellScript.h"
+#include "GameTime.h"
+#include "Group.h"
+#include "Player.h"
+#include "Random.h"
#include "SpellAuraEffects.h"
#include "SpellHistory.h"
-#include "Group.h"
+#include "SpellMgr.h"
+#include "SpellScript.h"
enum PaladinSpells
{
@@ -146,15 +148,8 @@ class spell_pal_ardent_defender : public SpellScriptLoader
{
PrepareAuraScript(spell_pal_ardent_defender_AuraScript);
- public:
- spell_pal_ardent_defender_AuraScript()
- {
- absorbPct = 0;
- healPct = 0;
- }
-
- private:
- uint32 absorbPct, healPct;
+ uint32 _absorbPct = 0;
+ uint32 _healPct = 0;
enum Spell
{
@@ -163,15 +158,13 @@ class spell_pal_ardent_defender : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(PAL_SPELL_ARDENT_DEFENDER_HEAL))
- return false;
- return true;
+ return ValidateSpellInfo({ PAL_SPELL_ARDENT_DEFENDER_HEAL });
}
bool Load() override
{
- healPct = GetSpellInfo()->Effects[EFFECT_1].CalcValue();
- absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue();
+ _absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue();
+ _healPct = GetSpellInfo()->Effects[EFFECT_1].CalcValue();
return GetUnitOwner()->GetTypeId() == TYPEID_PLAYER;
}
@@ -181,7 +174,7 @@ class spell_pal_ardent_defender : public SpellScriptLoader
amount = -1;
}
- void Absorb(AuraEffect* aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount)
+ void Absorb(AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount)
{
Unit* victim = GetTarget();
int32 remainingHealth = victim->GetHealth() - dmgInfo.GetDamage();
@@ -192,15 +185,13 @@ class spell_pal_ardent_defender : public SpellScriptLoader
// Cast healing spell, completely avoid damage
absorbAmount = dmgInfo.GetDamage();
- uint32 defenseSkillValue = victim->GetDefenseSkillValue();
+ float defenseSkillValue = victim->GetDefenseSkillValue();
// Max heal when defense skill denies critical hits from raid bosses
// Formula: max defense at level + 140 (raiting from gear)
- uint32 reqDefForMaxHeal = victim->getLevel() * 5 + 140;
- float pctFromDefense = (defenseSkillValue >= reqDefForMaxHeal)
- ? 1.0f
- : float(defenseSkillValue) / float(reqDefForMaxHeal);
+ float reqDefForMaxHeal = victim->GetMaxSkillValueForLevel() + 140.0f;
+ float defenseFactor = std::min(1.0f, defenseSkillValue / reqDefForMaxHeal);
- int32 healAmount = int32(victim->CountPctFromMaxHealth(uint32(healPct * pctFromDefense)));
+ int32 healAmount = int32(victim->CountPctFromMaxHealth(static_cast<uint32>(lroundf(_healPct * defenseFactor))));
victim->CastCustomSpell(PAL_SPELL_ARDENT_DEFENDER_HEAL, SPELLVALUE_BASE_POINT0, healAmount, victim, true, nullptr, aurEff);
victim->GetSpellHistory()->AddCooldown(PAL_SPELL_ARDENT_DEFENDER_HEAL, 0, std::chrono::minutes(2));
}
@@ -210,7 +201,7 @@ class spell_pal_ardent_defender : public SpellScriptLoader
uint32 damageToReduce = (victim->GetHealth() < allowedHealth)
? dmgInfo.GetDamage()
: allowedHealth - remainingHealth;
- absorbAmount = CalculatePct(damageToReduce, absorbPct);
+ absorbAmount = CalculatePct(damageToReduce, _absorbPct);
}
}
@@ -239,9 +230,7 @@ class spell_pal_aura_mastery : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PALADIN_AURA_MASTERY_IMMUNE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_PALADIN_AURA_MASTERY_IMMUNE });
}
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -279,9 +268,7 @@ class spell_pal_aura_mastery_immune : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PALADIN_CONCENTRACTION_AURA))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_PALADIN_CONCENTRACTION_AURA });
}
bool CheckAreaTarget(Unit* target)
@@ -313,10 +300,11 @@ class spell_pal_avenging_wrath : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PALADIN_SANCTIFIED_WRATH)
- || !sSpellMgr->GetSpellInfo(SPELL_PALADIN_SANCTIFIED_WRATH_TALENT_R1))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_PALADIN_SANCTIFIED_WRATH,
+ SPELL_PALADIN_SANCTIFIED_WRATH_TALENT_R1
+ });
}
void HandleApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -325,7 +313,7 @@ class spell_pal_avenging_wrath : public SpellScriptLoader
if (AuraEffect const* aurEff = target->GetAuraEffectOfRankedSpell(SPELL_PALADIN_SANCTIFIED_WRATH_TALENT_R1, EFFECT_2))
{
int32 basepoints = aurEff->GetAmount();
- target->CastCustomSpell(target, SPELL_PALADIN_SANCTIFIED_WRATH, &basepoints, &basepoints, NULL, true, NULL, aurEff);
+ target->CastCustomSpell(target, SPELL_PALADIN_SANCTIFIED_WRATH, &basepoints, &basepoints, nullptr, true, nullptr, aurEff);
}
}
@@ -359,9 +347,13 @@ class spell_pal_blessing_of_faith : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PALADIN_BLESSING_OF_LOWER_CITY_DRUID) || !sSpellMgr->GetSpellInfo(SPELL_PALADIN_BLESSING_OF_LOWER_CITY_PALADIN) || !sSpellMgr->GetSpellInfo(SPELL_PALADIN_BLESSING_OF_LOWER_CITY_PRIEST) || !sSpellMgr->GetSpellInfo(SPELL_PALADIN_BLESSING_OF_LOWER_CITY_SHAMAN))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_PALADIN_BLESSING_OF_LOWER_CITY_DRUID,
+ SPELL_PALADIN_BLESSING_OF_LOWER_CITY_PALADIN,
+ SPELL_PALADIN_BLESSING_OF_LOWER_CITY_PRIEST,
+ SPELL_PALADIN_BLESSING_OF_LOWER_CITY_SHAMAN
+ });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -416,11 +408,11 @@ class spell_pal_blessing_of_sanctuary : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PALADIN_BLESSING_OF_SANCTUARY_BUFF))
- return false;
- if (!sSpellMgr->GetSpellInfo(SPELL_PALADIN_BLESSING_OF_SANCTUARY_ENERGIZE))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_PALADIN_BLESSING_OF_SANCTUARY_BUFF,
+ SPELL_PALADIN_BLESSING_OF_SANCTUARY_ENERGIZE
+ });
}
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -444,7 +436,7 @@ class spell_pal_blessing_of_sanctuary : public SpellScriptLoader
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/)
{
PreventDefaultAction();
- GetTarget()->CastSpell(GetTarget(), SPELL_PALADIN_BLESSING_OF_SANCTUARY_ENERGIZE, true, NULL, aurEff);
+ GetTarget()->CastSpell(GetTarget(), SPELL_PALADIN_BLESSING_OF_SANCTUARY_ENERGIZE, true, nullptr, aurEff);
}
void Register() override
@@ -558,32 +550,23 @@ class spell_pal_divine_storm : public SpellScriptLoader
{
PrepareSpellScript(spell_pal_divine_storm_SpellScript);
- public:
- spell_pal_divine_storm_SpellScript()
- {
- healPct = 0;
- }
-
- private:
- uint32 healPct;
+ uint32 _healPct = 0;
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PALADIN_DIVINE_STORM_DUMMY))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_PALADIN_DIVINE_STORM_DUMMY });
}
bool Load() override
{
- healPct = GetSpellInfo()->Effects[EFFECT_1].CalcValue(GetCaster());
+ _healPct = GetSpellInfo()->Effects[EFFECT_1].CalcValue(GetCaster());
return true;
}
void TriggerHeal()
{
Unit* caster = GetCaster();
- caster->CastCustomSpell(SPELL_PALADIN_DIVINE_STORM_DUMMY, SPELLVALUE_BASE_POINT0, (GetHitDamage() * healPct) / 100, caster, true);
+ caster->CastCustomSpell(SPELL_PALADIN_DIVINE_STORM_DUMMY, SPELLVALUE_BASE_POINT0, (GetHitDamage() * _healPct) / 100, caster, true);
}
void Register() override
@@ -608,18 +591,10 @@ class spell_pal_divine_storm_dummy : public SpellScriptLoader
{
PrepareSpellScript(spell_pal_divine_storm_dummy_SpellScript);
- public:
- spell_pal_divine_storm_dummy_SpellScript()
- {
- _targetCount = 0;
- }
- private:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PALADIN_DIVINE_STORM_HEAL))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_PALADIN_DIVINE_STORM_HEAL });
}
void CountTargets(std::list<WorldObject*>& targetList)
@@ -633,10 +608,10 @@ class spell_pal_divine_storm_dummy : public SpellScriptLoader
return;
int32 heal = GetEffectValue() / _targetCount;
- GetCaster()->CastCustomSpell(GetHitUnit(), SPELL_PALADIN_DIVINE_STORM_HEAL, &heal, NULL, NULL, true);
+ GetCaster()->CastCustomSpell(GetHitUnit(), SPELL_PALADIN_DIVINE_STORM_HEAL, &heal, nullptr, nullptr, true);
}
- private:
- uint32 _targetCount;
+
+ uint32 _targetCount = 0;
void Register() override
{
@@ -699,9 +674,7 @@ class spell_pal_eye_for_an_eye : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PALADIN_EYE_FOR_AN_EYE_DAMAGE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_PALADIN_EYE_FOR_AN_EYE_DAMAGE });
}
void OnProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -740,9 +713,7 @@ class spell_pal_glyph_of_divinity : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PALADIN_GLYPH_OF_DIVINITY_PROC))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_PALADIN_GLYPH_OF_DIVINITY_PROC });
}
void OnProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -817,9 +788,7 @@ class spell_pal_glyph_of_holy_light_dummy : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PALADIN_GLYPH_OF_HOLY_LIGHT_HEAL))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_PALADIN_GLYPH_OF_HOLY_LIGHT_HEAL });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -860,9 +829,7 @@ class spell_pal_guarded_by_the_light : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PALADIN_DIVINE_PLEA))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_PALADIN_DIVINE_PLEA });
}
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
@@ -980,9 +947,7 @@ class spell_pal_heart_of_the_crusader : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PALADIN_HEART_OF_THE_CRUSADER_EFF_R1))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_PALADIN_HEART_OF_THE_CRUSADER_EFF_R1 });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -1089,11 +1054,12 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PALADIN_HOLY_SHOCK_R1_HEALING) ||
- !sSpellMgr->GetSpellInfo(SPELL_PALADIN_ILLUMINATION_ENERGIZE) ||
- !sSpellMgr->GetSpellInfo(SPELL_PALADIN_HOLY_SHOCK_R1))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_PALADIN_HOLY_SHOCK_R1_HEALING,
+ SPELL_PALADIN_ILLUMINATION_ENERGIZE,
+ SPELL_PALADIN_HOLY_SHOCK_R1
+ });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -1153,11 +1119,12 @@ class spell_pal_improved_aura : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(_spellId)
- || !sSpellMgr->GetSpellInfo(SPELL_PALADIN_SANCTIFIED_RETRIBUTION_R1)
- || !sSpellMgr->GetSpellInfo(SPELL_PALADIN_SWIFT_RETRIBUTION_R1))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ _spellId,
+ SPELL_PALADIN_SANCTIFIED_RETRIBUTION_R1,
+ SPELL_PALADIN_SWIFT_RETRIBUTION_R1
+ });
}
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -1251,9 +1218,7 @@ class spell_pal_improved_lay_of_hands : public SpellScriptLoader
bool Validate(SpellInfo const* spellInfo) override
{
- if (!sSpellMgr->GetSpellInfo(spellInfo->Effects[EFFECT_0].TriggerSpell))
- return false;
- return true;
+ return ValidateSpellInfo({ spellInfo->Effects[EFFECT_0].TriggerSpell });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -1286,11 +1251,12 @@ class spell_pal_infusion_of_light : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PALADIN_SACRED_SHIELD) ||
- !sSpellMgr->GetSpellInfo(SPELL_PALADIN_T9_HOLY_4P_BONUS) ||
- !sSpellMgr->GetSpellInfo(SPELL_PALADIN_FLASH_OF_LIGHT_PROC))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_PALADIN_SACRED_SHIELD,
+ SPELL_PALADIN_T9_HOLY_4P_BONUS,
+ SPELL_PALADIN_FLASH_OF_LIGHT_PROC
+ });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -1353,15 +1319,13 @@ class spell_pal_item_healing_discount : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PALADIN_ITEM_HEALING_TRANCE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_PALADIN_ITEM_HEALING_TRANCE });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/)
{
PreventDefaultAction();
- GetTarget()->CastSpell(GetTarget(), SPELL_PALADIN_ITEM_HEALING_TRANCE, true, NULL, aurEff);
+ GetTarget()->CastSpell(GetTarget(), SPELL_PALADIN_ITEM_HEALING_TRANCE, true, nullptr, aurEff);
}
void Register() override
@@ -1388,10 +1352,11 @@ class spell_pal_item_t6_trinket : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PALADIN_ENDURING_LIGHT) ||
- !sSpellMgr->GetSpellInfo(SPELL_PALADIN_ENDURING_JUDGEMENT))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_PALADIN_ENDURING_LIGHT,
+ SPELL_PALADIN_ENDURING_JUDGEMENT
+ });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -1450,12 +1415,14 @@ class spell_pal_judgement : public SpellScriptLoader
public:
spell_pal_judgement_SpellScript(uint32 spellId) : SpellScript(), _spellId(spellId) { }
+ private:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PALADIN_JUDGEMENT_DAMAGE)
- || !sSpellMgr->GetSpellInfo(_spellId))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_PALADIN_JUDGEMENT_DAMAGE,
+ _spellId
+ });
}
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
@@ -1485,7 +1452,6 @@ class spell_pal_judgement : public SpellScriptLoader
OnEffectHitTarget += SpellEffectFn(spell_pal_judgement_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
- private:
uint32 const _spellId;
};
@@ -1512,7 +1478,7 @@ class spell_pal_judgement_of_command : public SpellScriptLoader
{
if (Unit* unitTarget = GetHitUnit())
if (SpellInfo const* spell_proto = sSpellMgr->GetSpellInfo(GetEffectValue()))
- GetCaster()->CastSpell(unitTarget, spell_proto, true, NULL);
+ GetCaster()->CastSpell(unitTarget, spell_proto, true, nullptr);
}
void Register() override
@@ -1539,9 +1505,7 @@ class spell_pal_judgement_of_light_heal : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PALADIN_JUDGEMENT_OF_LIGHT_HEAL))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_PALADIN_JUDGEMENT_OF_LIGHT_HEAL });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -1578,9 +1542,7 @@ class spell_pal_judgement_of_wisdom_mana : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PALADIN_JUDGEMENT_OF_WISDOM_MANA))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_PALADIN_JUDGEMENT_OF_WISDOM_MANA });
}
bool CheckProc(ProcEventInfo& eventInfo)
@@ -1624,9 +1586,7 @@ class spell_pal_judgements_of_the_just : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PALADIN_JUDGEMENTS_OF_THE_JUST_PROC))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_PALADIN_JUDGEMENTS_OF_THE_JUST_PROC });
}
void OnProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -1659,10 +1619,11 @@ class spell_pal_judgements_of_the_wise : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_REPLENISHMENT) ||
- !sSpellMgr->GetSpellInfo(SPELL_PALADIN_JUDGEMENTS_OF_THE_WISE_MANA))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_REPLENISHMENT,
+ SPELL_PALADIN_JUDGEMENTS_OF_THE_WISE_MANA
+ });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -1698,13 +1659,12 @@ class spell_pal_lay_on_hands : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PALADIN_FORBEARANCE))
- return false;
- if (!sSpellMgr->GetSpellInfo(SPELL_PALADIN_AVENGING_WRATH_MARKER))
- return false;
- if (!sSpellMgr->GetSpellInfo(SPELL_PALADIN_IMMUNE_SHIELD_MARKER))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_PALADIN_FORBEARANCE,
+ SPELL_PALADIN_AVENGING_WRATH_MARKER,
+ SPELL_PALADIN_IMMUNE_SHIELD_MARKER
+ });
}
SpellCastResult CheckCast()
@@ -1754,13 +1714,14 @@ class spell_pal_light_s_beacon : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PALADIN_BEACON_OF_LIGHT)
- || !sSpellMgr->GetSpellInfo(SPELL_PALADIN_BEACON_OF_LIGHT_HEAL_1)
- || !sSpellMgr->GetSpellInfo(SPELL_PALADIN_BEACON_OF_LIGHT_HEAL_2)
- || !sSpellMgr->GetSpellInfo(SPELL_PALADIN_BEACON_OF_LIGHT_HEAL_3)
- || !sSpellMgr->GetSpellInfo(SPELL_PALADIN_HOLY_LIGHT))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_PALADIN_BEACON_OF_LIGHT,
+ SPELL_PALADIN_BEACON_OF_LIGHT_HEAL_1,
+ SPELL_PALADIN_BEACON_OF_LIGHT_HEAL_2,
+ SPELL_PALADIN_BEACON_OF_LIGHT_HEAL_3,
+ SPELL_PALADIN_HOLY_LIGHT
+ });
}
bool CheckProc(ProcEventInfo& eventInfo)
@@ -1820,9 +1781,7 @@ class spell_pal_righteous_defense : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PALADIN_RIGHTEOUS_DEFENSE_TAUNT))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_PALADIN_RIGHTEOUS_DEFENSE_TAUNT });
}
SpellCastResult CheckCast()
@@ -1884,9 +1843,7 @@ class spell_pal_righteous_vengeance : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PALADIN_RIGHTEOUS_VENGEANCE_DAMAGE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_PALADIN_RIGHTEOUS_VENGEANCE_DAMAGE });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -1977,10 +1934,11 @@ class spell_pal_sacred_shield_dummy : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PALADIN_SACRED_SHIELD_TRIGGER) ||
- !sSpellMgr->GetSpellInfo(SPELL_PALADIN_T8_HOLY_4P_BONUS))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_PALADIN_SACRED_SHIELD_TRIGGER,
+ SPELL_PALADIN_T8_HOLY_4P_BONUS
+ });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -2030,9 +1988,7 @@ class spell_pal_seal_of_righteousness : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PALADIN_SEAL_OF_RIGHTEOUSNESS))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_PALADIN_SEAL_OF_RIGHTEOUSNESS });
}
bool CheckProc(ProcEventInfo& eventInfo)
@@ -2048,7 +2004,7 @@ class spell_pal_seal_of_righteousness : public SpellScriptLoader
int32 holy = GetTarget()->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_HOLY);
holy += eventInfo.GetProcTarget()->SpellBaseDamageBonusTaken(SPELL_SCHOOL_MASK_HOLY);
int32 bp = int32((ap * 0.022f + 0.044f * holy) * GetTarget()->GetAttackTime(BASE_ATTACK) / 1000);
- GetTarget()->CastCustomSpell(SPELL_PALADIN_SEAL_OF_RIGHTEOUSNESS, SPELLVALUE_BASE_POINT0, bp, eventInfo.GetProcTarget(), true, NULL, aurEff);
+ GetTarget()->CastCustomSpell(SPELL_PALADIN_SEAL_OF_RIGHTEOUSNESS, SPELLVALUE_BASE_POINT0, bp, eventInfo.GetProcTarget(), true, nullptr, aurEff);
}
void Register() override
@@ -2079,10 +2035,11 @@ class spell_pal_seal_of_vengeance : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(DoTSpell) ||
- !sSpellMgr->GetSpellInfo(DamageSpell))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ DoTSpell,
+ DamageSpell
+ });
}
/*
@@ -2205,9 +2162,7 @@ class spell_pal_spiritual_attunement : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PALADIN_SPIRITUAL_ATTUNEMENT_MANA))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_PALADIN_SPIRITUAL_ATTUNEMENT_MANA });
}
bool CheckProc(ProcEventInfo& eventInfo)
@@ -2253,9 +2208,7 @@ class spell_pal_sheath_of_light : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PALADIN_SHEATH_OF_LIGHT_HEAL))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_PALADIN_SHEATH_OF_LIGHT_HEAL });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -2302,12 +2255,13 @@ class spell_pal_t3_6p_bonus : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PALADIN_HOLY_POWER_ARMOR) ||
- !sSpellMgr->GetSpellInfo(SPELL_PALADIN_HOLY_POWER_ATTACK_POWER) ||
- !sSpellMgr->GetSpellInfo(SPELL_PALADIN_HOLY_POWER_SPELL_POWER) ||
- !sSpellMgr->GetSpellInfo(SPELL_PALADIN_HOLY_POWER_MP5))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_PALADIN_HOLY_POWER_ARMOR,
+ SPELL_PALADIN_HOLY_POWER_ATTACK_POWER,
+ SPELL_PALADIN_HOLY_POWER_SPELL_POWER,
+ SPELL_PALADIN_HOLY_POWER_MP5
+ });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -2368,9 +2322,7 @@ class spell_pal_t8_2p_bonus : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PALADIN_HOLY_MENDING))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_PALADIN_HOLY_MENDING });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
diff --git a/src/server/scripts/Spells/spell_pet.cpp b/src/server/scripts/Spells/spell_pet.cpp
index abe40cc2c7d..1386a212322 100644
--- a/src/server/scripts/Spells/spell_pet.cpp
+++ b/src/server/scripts/Spells/spell_pet.cpp
@@ -22,11 +22,13 @@
*/
#include "ScriptMgr.h"
-#include "SpellScript.h"
+#include "ObjectMgr.h"
+#include "Pet.h"
+#include "Player.h"
#include "SpellAuraEffects.h"
+#include "SpellMgr.h"
+#include "SpellScript.h"
#include "Unit.h"
-#include "Player.h"
-#include "Pet.h"
enum HunterPetCalculate
{
@@ -1497,13 +1499,6 @@ public:
{
PrepareAuraScript(spell_dk_pet_scaling_01_AuraScript);
- public:
- spell_dk_pet_scaling_01_AuraScript()
- {
- _tempHealth = 0;
- }
-
- private:
bool Load() override
{
if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
@@ -1563,7 +1558,7 @@ public:
float mod = 0.7f;
// Ravenous Dead
- AuraEffect const* aurEff = NULL;
+ AuraEffect const* aurEff = nullptr;
// Check just if owner has Ravenous Dead since it's effect is not an aura
aurEff = owner->GetAuraEffect(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, SPELLFAMILY_DEATHKNIGHT, 3010, 0);
if (aurEff)
@@ -1587,8 +1582,7 @@ public:
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_pet_scaling_01_AuraScript::CalculateStrengthAmount, EFFECT_1, SPELL_AURA_MOD_STAT);
}
- private:
- uint32 _tempHealth;
+ uint32 _tempHealth = 0;
};
AuraScript* GetAuraScript() const override
diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp
index cd8aa4138a0..4ba231b021c 100644
--- a/src/server/scripts/Spells/spell_priest.cpp
+++ b/src/server/scripts/Spells/spell_priest.cpp
@@ -21,11 +21,12 @@
* Scriptnames of files in this file should be prefixed with "spell_pri_".
*/
-#include "Player.h"
#include "ScriptMgr.h"
-#include "SpellScript.h"
-#include "SpellAuraEffects.h"
#include "GridNotifiers.h"
+#include "Player.h"
+#include "SpellAuraEffects.h"
+#include "SpellMgr.h"
+#include "SpellScript.h"
enum PriestSpells
{
@@ -115,9 +116,7 @@ class spell_pri_aq_3p_bonus : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PRIEST_ORACULAR_HEAL))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_PRIEST_ORACULAR_HEAL });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -159,9 +158,7 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PRIEST_BLESSED_RECOVERY_R1))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_PRIEST_BLESSED_RECOVERY_R1 });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -205,10 +202,11 @@ class spell_pri_body_and_soul : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PRIEST_BODY_AND_SOUL_POISON_TRIGGER) ||
- !sSpellMgr->GetSpellInfo(SPELL_PRIEST_ABOLISH_DISEASE))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_PRIEST_BODY_AND_SOUL_POISON_TRIGGER,
+ SPELL_PRIEST_ABOLISH_DISEASE
+ });
}
void HandleProcTriggerSpell(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
@@ -264,9 +262,7 @@ class spell_pri_circle_of_healing : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PRIEST_GLYPH_OF_CIRCLE_OF_HEALING))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_PRIEST_GLYPH_OF_CIRCLE_OF_HEALING });
}
void FilterTargets(std::list<WorldObject*>& targets)
@@ -306,9 +302,7 @@ class spell_pri_divine_aegis : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PRIEST_DIVINE_AEGIS))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_PRIEST_DIVINE_AEGIS });
}
bool CheckProc(ProcEventInfo& eventInfo)
@@ -395,9 +389,7 @@ class spell_pri_glyph_of_dispel_magic : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PRIEST_GLYPH_OF_DISPEL_MAGIC_HEAL))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_PRIEST_GLYPH_OF_DISPEL_MAGIC_HEAL });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -439,9 +431,7 @@ class spell_pri_glyph_of_prayer_of_healing : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PRIEST_GLYPH_OF_PRAYER_OF_HEALING_HEAL))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_PRIEST_GLYPH_OF_PRAYER_OF_HEALING_HEAL });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -479,20 +469,11 @@ class spell_pri_guardian_spirit : public SpellScriptLoader
{
PrepareAuraScript(spell_pri_guardian_spirit_AuraScript);
- public:
- spell_pri_guardian_spirit_AuraScript()
- {
- healPct = 0;
- }
-
- private:
- uint32 healPct;
+ uint32 healPct = 0;
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PRIEST_GUARDIAN_SPIRIT_HEAL))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_PRIEST_GUARDIAN_SPIRIT_HEAL });
}
bool Load() override
@@ -516,7 +497,7 @@ class spell_pri_guardian_spirit : public SpellScriptLoader
int32 healAmount = int32(target->CountPctFromMaxHealth(healPct));
// remove the aura now, we don't want 40% healing bonus
Remove(AURA_REMOVE_BY_ENEMY_SPELL);
- target->CastCustomSpell(target, SPELL_PRIEST_GUARDIAN_SPIRIT_HEAL, &healAmount, NULL, NULL, true);
+ target->CastCustomSpell(target, SPELL_PRIEST_GUARDIAN_SPIRIT_HEAL, &healAmount, nullptr, nullptr, true);
absorbAmount = dmgInfo.GetDamage();
}
@@ -610,10 +591,11 @@ class spell_pri_improved_spirit_tap : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PRIEST_SHADOW_WORD_DEATH_R1) ||
- !sSpellMgr->GetSpellInfo(SPELL_PRIEST_MIND_BLAST_R1))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_PRIEST_SHADOW_WORD_DEATH_R1,
+ SPELL_PRIEST_MIND_BLAST_R1
+ });
}
bool CheckProc(ProcEventInfo& eventInfo)
@@ -654,10 +636,11 @@ class spell_pri_item_t6_trinket : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PRIEST_DIVINE_BLESSING) ||
- !sSpellMgr->GetSpellInfo(SPELL_PRIEST_DIVINE_WRATH))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_PRIEST_DIVINE_BLESSING,
+ SPELL_PRIEST_DIVINE_WRATH
+ });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -780,18 +763,9 @@ class spell_pri_mana_leech : public SpellScriptLoader
{
PrepareAuraScript(spell_pri_mana_leech_AuraScript);
- public:
- spell_pri_mana_leech_AuraScript()
- {
- _procTarget = nullptr;
- }
-
- private:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PRIEST_MANA_LEECH_PROC))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_PRIEST_MANA_LEECH_PROC });
}
bool CheckProc(ProcEventInfo& /*eventInfo*/)
@@ -803,7 +777,7 @@ class spell_pri_mana_leech : public SpellScriptLoader
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/)
{
PreventDefaultAction();
- GetTarget()->CastSpell(_procTarget, SPELL_PRIEST_MANA_LEECH_PROC, true, NULL, aurEff);
+ GetTarget()->CastSpell(_procTarget, SPELL_PRIEST_MANA_LEECH_PROC, true, nullptr, aurEff);
}
void Register() override
@@ -812,8 +786,7 @@ class spell_pri_mana_leech : public SpellScriptLoader
OnEffectProc += AuraEffectProcFn(spell_pri_mana_leech_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
}
- private:
- Unit* _procTarget;
+ Unit* _procTarget = nullptr;
};
AuraScript* GetAuraScript() const override
@@ -1003,11 +976,11 @@ class spell_pri_power_word_shield : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PRIEST_REFLECTIVE_SHIELD_TRIGGERED))
- return false;
- if (!sSpellMgr->GetSpellInfo(SPELL_PRIEST_REFLECTIVE_SHIELD_R1))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_PRIEST_REFLECTIVE_SHIELD_TRIGGERED,
+ SPELL_PRIEST_REFLECTIVE_SHIELD_R1
+ });
}
void CalculateAmount(AuraEffect const* aurEff, int32& amount, bool& canBeRecalculated)
@@ -1049,7 +1022,7 @@ class spell_pri_power_word_shield : public SpellScriptLoader
if (AuraEffect* talentAurEff = target->GetAuraEffectOfRankedSpell(SPELL_PRIEST_REFLECTIVE_SHIELD_R1, EFFECT_0))
{
int32 bp = CalculatePct(absorbAmount, talentAurEff->GetAmount());
- target->CastCustomSpell(dmgInfo.GetAttacker(), SPELL_PRIEST_REFLECTIVE_SHIELD_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff);
+ target->CastCustomSpell(dmgInfo.GetAttacker(), SPELL_PRIEST_REFLECTIVE_SHIELD_TRIGGERED, &bp, nullptr, nullptr, true, nullptr, aurEff);
}
}
@@ -1127,7 +1100,8 @@ class spell_pri_renew : public SpellScriptLoader
{
int32 heal = (aurEff->GetAmount() + aurEff->GetBonusAmount()) * aurEff->GetDonePct();
if (Player* modOwner = caster->GetSpellModOwner())
- modOwner->ApplySpellMod<SPELLMOD_DOT>(GetId(), heal);
+ modOwner->ApplySpellMod(GetId(), SPELLMOD_DOT, heal);
+
heal = GetTarget()->SpellHealingBonusTaken(caster, GetSpellInfo(), heal, DOT);
heal *= GetSpellInfo()->GetMaxTicks();
@@ -1161,9 +1135,7 @@ class spell_pri_shadowfiend_death : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PRIEST_GLYPH_OF_SHADOWFIEND_MANA))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_PRIEST_GLYPH_OF_SHADOWFIEND_MANA });
}
bool CheckProc(ProcEventInfo& eventInfo)
@@ -1244,9 +1216,7 @@ class spell_pri_vampiric_embrace : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PRIEST_VAMPIRIC_EMBRACE_HEAL))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_PRIEST_VAMPIRIC_EMBRACE_HEAL });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -1286,10 +1256,11 @@ class spell_pri_vampiric_touch : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PRIEST_VAMPIRIC_TOUCH_DISPEL) ||
- !sSpellMgr->GetSpellInfo(SPELL_REPLENISHMENT))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_PRIEST_VAMPIRIC_TOUCH_DISPEL,
+ SPELL_REPLENISHMENT
+ });
}
bool CheckDummy(AuraEffect const* /*aurEff*/, ProcEventInfo& /*eventInfo*/)
@@ -1346,9 +1317,7 @@ class spell_pri_t3_4p_bonus : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PRIEST_ARMOR_OF_FAITH))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_PRIEST_ARMOR_OF_FAITH });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -1381,9 +1350,7 @@ class spell_pri_t5_heal_2p_bonus : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PRIEST_ITEM_EFFICIENCY))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_PRIEST_ITEM_EFFICIENCY });
}
bool CheckProc(ProcEventInfo& eventInfo)
@@ -1428,9 +1395,7 @@ class spell_pri_t10_heal_2p_bonus : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PRIEST_BLESSED_HEALING))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_PRIEST_BLESSED_HEALING });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp
index 4b3074888cb..72e29df22f8 100644
--- a/src/server/scripts/Spells/spell_quest.cpp
+++ b/src/server/scripts/Spells/spell_quest.cpp
@@ -21,15 +21,15 @@
* Scriptnames of files in this file should be prefixed with "spell_q#questID_".
*/
+#include "ScriptMgr.h"
#include "CellImpl.h"
+#include "CreatureAIImpl.h"
#include "CreatureTextMgr.h"
-#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "Player.h"
-#include "ScriptMgr.h"
#include "ScriptedCreature.h"
-#include "SpellScript.h"
#include "SpellAuraEffects.h"
+#include "SpellScript.h"
#include "Vehicle.h"
class spell_generic_quest_update_entry_SpellScript : public SpellScript
@@ -104,9 +104,7 @@ class spell_q2203_thaumaturgy_channel : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_THAUMATURGY_CHANNEL))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_THAUMATURGY_CHANNEL });
}
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
@@ -152,16 +150,14 @@ class spell_q5206_test_fetid_skull : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellEntry*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_CREATE_RESONATING_SKULL) || !sSpellMgr->GetSpellInfo(SPELL_CREATE_BONE_DUST))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_CREATE_RESONATING_SKULL, SPELL_CREATE_BONE_DUST });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
uint32 spellId = roll_chance_i(50) ? SPELL_CREATE_RESONATING_SKULL : SPELL_CREATE_BONE_DUST;
- caster->CastSpell(caster, spellId, true, NULL);
+ caster->CastSpell(caster, spellId, true, nullptr);
}
void Register() override
@@ -316,9 +312,7 @@ class spell_q11396_11399_scourging_crystal_controller : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellEntry*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_FORCE_SHIELD_ARCANE_PURPLE_X3) || !sSpellMgr->GetSpellInfo(SPELL_SCOURGING_CRYSTAL_CONTROLLER))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_FORCE_SHIELD_ARCANE_PURPLE_X3, SPELL_SCOURGING_CRYSTAL_CONTROLLER });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -354,9 +348,7 @@ class spell_q11396_11399_scourging_crystal_controller_dummy : public SpellScript
bool Validate(SpellInfo const* /*spellEntry*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_FORCE_SHIELD_ARCANE_PURPLE_X3))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_FORCE_SHIELD_ARCANE_PURPLE_X3 });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -417,9 +409,7 @@ class spell_q11587_arcane_prisoner_rescue : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellEntry*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_ARCANE_PRISONER_MALE) || !sSpellMgr->GetSpellInfo(SPELL_SUMMON_ARCANE_PRISONER_FEMALE) || !sSpellMgr->GetSpellInfo(SPELL_ARCANE_PRISONER_KILL_CREDIT))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SUMMON_ARCANE_PRISONER_MALE, SPELL_SUMMON_ARCANE_PRISONER_FEMALE, SPELL_ARCANE_PRISONER_KILL_CREDIT });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -480,9 +470,15 @@ class spell_q11730_ultrasonic_screwdriver : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellEntry*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_SCAVENGEBOT_004A8) || !sSpellMgr->GetSpellInfo(SPELL_SUMMON_SENTRYBOT_57K) || !sSpellMgr->GetSpellInfo(SPELL_SUMMON_DEFENDOTANK_66D) || !sSpellMgr->GetSpellInfo(SPELL_SUMMON_SCAVENGEBOT_005B6) || !sSpellMgr->GetSpellInfo(SPELL_SUMMON_55D_COLLECTATRON) || !sSpellMgr->GetSpellInfo(SPELL_ROBOT_KILL_CREDIT))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_SUMMON_SCAVENGEBOT_004A8,
+ SPELL_SUMMON_SENTRYBOT_57K,
+ SPELL_SUMMON_DEFENDOTANK_66D,
+ SPELL_SUMMON_SCAVENGEBOT_005B6,
+ SPELL_SUMMON_55D_COLLECTATRON,
+ SPELL_ROBOT_KILL_CREDIT
+ });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -592,9 +588,13 @@ class spell_q12634_despawn_fruit_tosser : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellEntry*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_BANANAS_FALL_TO_GROUND) || !sSpellMgr->GetSpellInfo(SPELL_ORANGE_FALLS_TO_GROUND) || !sSpellMgr->GetSpellInfo(SPELL_PAPAYA_FALLS_TO_GROUND) || !sSpellMgr->GetSpellInfo(SPELL_SUMMON_ADVENTUROUS_DWARF))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_BANANAS_FALL_TO_GROUND,
+ SPELL_ORANGE_FALLS_TO_GROUND,
+ SPELL_PAPAYA_FALLS_TO_GROUND,
+ SPELL_SUMMON_ADVENTUROUS_DWARF
+ });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -608,7 +608,7 @@ class spell_q12634_despawn_fruit_tosser : public SpellScriptLoader
// sometimes, if you're lucky, you get a dwarf
if (roll_chance_i(5))
spellId = SPELL_SUMMON_ADVENTUROUS_DWARF;
- GetCaster()->CastSpell(GetCaster(), spellId, true, NULL);
+ GetCaster()->CastSpell(GetCaster(), spellId, true, nullptr);
}
void Register() override
@@ -642,7 +642,7 @@ class spell_q12683_take_sputum_sample : public SpellScriptLoader
if (caster->HasAuraEffect(reqAuraId, 0))
{
uint32 spellId = GetSpellInfo()->Effects[EFFECT_0].CalcValue();
- caster->CastSpell(caster, spellId, true, NULL);
+ caster->CastSpell(caster, spellId, true, nullptr);
}
}
@@ -744,9 +744,7 @@ class spell_q12937_relief_for_the_fallen : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellEntry*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_TRIGGER_AID_OF_THE_EARTHEN))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_TRIGGER_AID_OF_THE_EARTHEN });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -754,7 +752,7 @@ class spell_q12937_relief_for_the_fallen : public SpellScriptLoader
Player* caster = GetCaster()->ToPlayer();
if (Creature* target = GetHitCreature())
{
- caster->CastSpell(caster, SPELL_TRIGGER_AID_OF_THE_EARTHEN, true, NULL);
+ caster->CastSpell(caster, SPELL_TRIGGER_AID_OF_THE_EARTHEN, true, nullptr);
caster->KilledMonsterCredit(NPC_FALLEN_EARTHEN_DEFENDER);
target->DespawnOrUnsummon();
}
@@ -790,9 +788,7 @@ class spell_q10041_q10040_who_are_they : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellEntry*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_MALE_DISGUISE) || !sSpellMgr->GetSpellInfo(SPELL_FEMALE_DISGUISE) || !sSpellMgr->GetSpellInfo(SPELL_GENERIC_DISGUISE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_MALE_DISGUISE, SPELL_FEMALE_DISGUISE, SPELL_GENERIC_DISGUISE });
}
void HandleScript(SpellEffIndex effIndex)
@@ -1051,9 +1047,7 @@ class spell_q14112_14145_chum_the_water: public SpellScriptLoader
bool Validate(SpellInfo const* /*spellEntry*/) override
{
- if (!sSpellMgr->GetSpellInfo(SUMMON_ANGRY_KVALDIR) || !sSpellMgr->GetSpellInfo(SUMMON_NORTH_SEA_MAKO) || !sSpellMgr->GetSpellInfo(SUMMON_NORTH_SEA_THRESHER) || !sSpellMgr->GetSpellInfo(SUMMON_NORTH_SEA_BLUE_SHARK))
- return false;
- return true;
+ return ValidateSpellInfo({ SUMMON_ANGRY_KVALDIR, SUMMON_NORTH_SEA_MAKO, SUMMON_NORTH_SEA_THRESHER, SUMMON_NORTH_SEA_BLUE_SHARK });
}
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
@@ -1662,16 +1656,14 @@ class spell_q12527_zuldrak_rat : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_GORGED_LURKING_BASILISK))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SUMMON_GORGED_LURKING_BASILISK });
}
void HandleScriptEffect(SpellEffIndex /* effIndex */)
{
if (GetHitAura() && GetHitAura()->GetStackAmount() >= GetSpellInfo()->StackAmount)
{
- GetHitUnit()->CastSpell((Unit*) NULL, SPELL_SUMMON_GORGED_LURKING_BASILISK, true);
+ GetHitUnit()->CastSpell((Unit*) nullptr, SPELL_SUMMON_GORGED_LURKING_BASILISK, true);
if (Creature* basilisk = GetHitUnit()->ToCreature())
basilisk->DespawnOrUnsummon();
}
@@ -1734,9 +1726,7 @@ class spell_q12730_quenching_mist : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_FLICKERING_FLAMES))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_FLICKERING_FLAMES });
}
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
@@ -1777,10 +1767,7 @@ class spell_q13291_q13292_q13239_q13261_frostbrood_skytalon_grab_decoy : public
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_RIDE))
- return false;
-
- return true;
+ return ValidateSpellInfo({ SPELL_RIDE });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -1864,9 +1851,8 @@ class spell_q12847_summon_soul_moveto_bunny : public SpellScriptLoader
enum BearFlankMaster
{
- SPELL_BEAR_FLANK_MASTER = 56565,
SPELL_CREATE_BEAR_FLANK = 56566,
- SPELL_BEAR_FLANK_FAIL = 56569
+ SPELL_BEAR_FLANK_FAIL = 56569
};
class spell_q13011_bear_flank_master : public SpellScriptLoader
@@ -1880,10 +1866,11 @@ class spell_q13011_bear_flank_master : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_BEAR_FLANK_MASTER) ||
- !sSpellMgr->GetSpellInfo(SPELL_CREATE_BEAR_FLANK))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_CREATE_BEAR_FLANK,
+ SPELL_BEAR_FLANK_FAIL
+ });
}
bool Load() override
@@ -1929,9 +1916,7 @@ class spell_q13086_cannons_target : public SpellScriptLoader
bool Validate(SpellInfo const* spellInfo) override
{
- if (!sSpellMgr->GetSpellInfo(spellInfo->Effects[EFFECT_0].CalcValue()))
- return false;
- return true;
+ return ValidateSpellInfo({ static_cast<uint32>(spellInfo->Effects[EFFECT_0].CalcValue()) });
}
void HandleEffectDummy(SpellEffIndex /*effIndex*/)
@@ -1980,14 +1965,15 @@ class spell_q12690_burst_at_the_seams : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_BURST_AT_THE_SEAMS)
- || !sSpellMgr->GetSpellInfo(SPELL_BURST_AT_THE_SEAMS_DMG)
- || !sSpellMgr->GetSpellInfo(SPELL_BURST_AT_THE_SEAMS_DMG_2)
- || !sSpellMgr->GetSpellInfo(SPELL_BURST_AT_THE_SEAMS_BONE)
- || !sSpellMgr->GetSpellInfo(SPELL_BURST_AT_THE_SEAMS_MEAT)
- || !sSpellMgr->GetSpellInfo(SPELL_BURST_AT_THE_SEAMS_BMEAT))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_BURST_AT_THE_SEAMS,
+ SPELL_BURST_AT_THE_SEAMS_DMG,
+ SPELL_BURST_AT_THE_SEAMS_DMG_2,
+ SPELL_BURST_AT_THE_SEAMS_BONE,
+ SPELL_BURST_AT_THE_SEAMS_MEAT,
+ SPELL_BURST_AT_THE_SEAMS_BMEAT
+ });
}
bool Load() override
@@ -2056,9 +2042,7 @@ class spell_q12308_escape_from_silverbrook : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_WORGEN))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SUMMON_WORGEN });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -2134,12 +2118,13 @@ class spell_q12641_death_comes_from_on_high : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_FORGE_CREDIT) ||
- !sSpellMgr->GetSpellInfo(SPELL_TOWN_HALL_CREDIT) ||
- !sSpellMgr->GetSpellInfo(SPELL_SCARLET_HOLD_CREDIT) ||
- !sSpellMgr->GetSpellInfo(SPELL_CHAPEL_CREDIT))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_FORGE_CREDIT,
+ SPELL_TOWN_HALL_CREDIT,
+ SPELL_SCARLET_HOLD_CREDIT,
+ SPELL_CHAPEL_CREDIT
+ });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -2164,7 +2149,7 @@ class spell_q12641_death_comes_from_on_high : public SpellScriptLoader
return;
}
- GetCaster()->CastSpell((Unit*)NULL, spellId, true);
+ GetCaster()->CastSpell((Unit*)nullptr, spellId, true);
}
void Register() override
@@ -2230,7 +2215,7 @@ class spell_q12619_emblazon_runeblade : public SpellScriptLoader
{
PreventDefaultAction();
if (Unit* caster = GetCaster())
- caster->CastSpell(caster, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true, NULL, aurEff);
+ caster->CastSpell(caster, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true, nullptr, aurEff);
}
void Register() override
@@ -2289,9 +2274,7 @@ class spell_q12919_gymers_grab : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_RIDE_GYMER))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_RIDE_GYMER });
}
void HandleScript(SpellEffIndex /*effIndex*/)
@@ -2368,9 +2351,7 @@ class spell_q13400_illidan_kill_master : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_ILLIDAN_KILL_CREDIT))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_ILLIDAN_KILL_CREDIT });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -2410,9 +2391,7 @@ class spell_q14100_q14111_make_player_destroy_totems : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_TOTEM_OF_THE_EARTHEN_RING))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_TOTEM_OF_THE_EARTHEN_RING });
}
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
@@ -2451,11 +2430,7 @@ class spell_q10929_fumping : SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_SAND_GNOME))
- return false;
- if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_BONE_SLICER))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SUMMON_SAND_GNOME, SPELL_SUMMON_BONE_SLICER });
}
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp
index 4d9f32de2db..750b5073a7c 100644
--- a/src/server/scripts/Spells/spell_rogue.cpp
+++ b/src/server/scripts/Spells/spell_rogue.cpp
@@ -21,12 +21,17 @@
* Scriptnames of files in this file should be prefixed with "spell_rog_".
*/
-#include "Player.h"
#include "ScriptMgr.h"
-#include "SpellScript.h"
+#include "Containers.h"
+#include "DBCStores.h"
+#include "Item.h"
+#include "Log.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
#include "SpellAuraEffects.h"
#include "SpellHistory.h"
-#include "Containers.h"
+#include "SpellMgr.h"
+#include "SpellScript.h"
enum RogueSpells
{
@@ -60,18 +65,9 @@ class spell_rog_blade_flurry : public SpellScriptLoader
{
PrepareAuraScript(spell_rog_blade_flurry_AuraScript);
- public:
- spell_rog_blade_flurry_AuraScript()
- {
- _procTarget = nullptr;
- }
-
- private:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_ROGUE_BLADE_FLURRY_EXTRA_ATTACK))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_ROGUE_BLADE_FLURRY_EXTRA_ATTACK });
}
bool CheckProc(ProcEventInfo& eventInfo)
@@ -96,8 +92,7 @@ class spell_rog_blade_flurry : public SpellScriptLoader
OnEffectProc += AuraEffectProcFn(spell_rog_blade_flurry_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_MOD_MELEE_HASTE);
}
- private:
- Unit* _procTarget;
+ Unit* _procTarget = nullptr;
};
AuraScript* GetAuraScript() const override
@@ -116,20 +111,11 @@ class spell_rog_cheat_death : public SpellScriptLoader
{
PrepareAuraScript(spell_rog_cheat_death_AuraScript);
- public:
- spell_rog_cheat_death_AuraScript()
- {
- absorbChance = 0;
- }
-
- private:
- uint32 absorbChance;
+ uint32 absorbChance = 0;
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_ROGUE_CHEAT_DEATH_COOLDOWN))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_ROGUE_CHEAT_DEATH_COOLDOWN });
}
bool Load() override
@@ -227,9 +213,7 @@ class spell_rog_deadly_brew : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_ROGUE_CRIPPLING_POISON))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_ROGUE_CRIPPLING_POISON });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -260,13 +244,6 @@ class spell_rog_deadly_poison : public SpellScriptLoader
{
PrepareSpellScript(spell_rog_deadly_poison_SpellScript);
- public:
- spell_rog_deadly_poison_SpellScript()
- {
- _stackAmount = 0;
- }
-
- private:
bool Load() override
{
// at this point CastItem must already be initialized
@@ -341,7 +318,7 @@ class spell_rog_deadly_poison : public SpellScriptLoader
AfterHit += SpellHitFn(spell_rog_deadly_poison_SpellScript::HandleAfterHit);
}
- uint8 _stackAmount;
+ uint8 _stackAmount = 0;
};
SpellScript* GetSpellScript() const override
@@ -351,11 +328,12 @@ class spell_rog_deadly_poison : public SpellScriptLoader
};
// 51690 - Killing Spree
-#define KillingSpreeScriptName "spell_rog_killing_spree"
class spell_rog_killing_spree : public SpellScriptLoader
{
public:
- spell_rog_killing_spree() : SpellScriptLoader(KillingSpreeScriptName) { }
+ static char constexpr const ScriptName[] = "spell_rog_killing_spree";
+
+ spell_rog_killing_spree() : SpellScriptLoader(ScriptName) { }
class spell_rog_killing_spree_SpellScript : public SpellScript
{
@@ -370,10 +348,8 @@ class spell_rog_killing_spree : public SpellScriptLoader
void HandleDummy(SpellEffIndex /*effIndex*/)
{
if (Aura* aura = GetCaster()->GetAura(SPELL_ROGUE_KILLING_SPREE))
- {
- if (spell_rog_killing_spree_AuraScript* script = dynamic_cast<spell_rog_killing_spree_AuraScript*>(aura->GetScriptByName(KillingSpreeScriptName)))
+ if (spell_rog_killing_spree_AuraScript* script = aura->GetScript<spell_rog_killing_spree_AuraScript>(ScriptName))
script->AddTarget(GetHitUnit());
- }
}
void Register() override
@@ -394,11 +370,12 @@ class spell_rog_killing_spree : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_ROGUE_KILLING_SPREE_TELEPORT)
- || !sSpellMgr->GetSpellInfo(SPELL_ROGUE_KILLING_SPREE_WEAPON_DMG)
- || !sSpellMgr->GetSpellInfo(SPELL_ROGUE_KILLING_SPREE_DMG_BUFF))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_ROGUE_KILLING_SPREE_TELEPORT,
+ SPELL_ROGUE_KILLING_SPREE_WEAPON_DMG,
+ SPELL_ROGUE_KILLING_SPREE_DMG_BUFF
+ });
}
void HandleApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -449,6 +426,7 @@ class spell_rog_killing_spree : public SpellScriptLoader
return new spell_rog_killing_spree_AuraScript();
}
};
+char constexpr const spell_rog_killing_spree::ScriptName[];
// -31130 - Nerves of Steel
class spell_rog_nerves_of_steel : public SpellScriptLoader
@@ -518,9 +496,7 @@ class spell_rog_preparation : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_ROGUE_GLYPH_OF_PREPARATION))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_ROGUE_GLYPH_OF_PREPARATION });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -566,9 +542,7 @@ class spell_rog_prey_on_the_weak : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_ROGUE_PREY_ON_THE_WEAK))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_ROGUE_PREY_ON_THE_WEAK });
}
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
@@ -611,9 +585,7 @@ class spell_rog_quick_recovery : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_ROGUE_QUICK_RECOVERY_ENERGY))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_ROGUE_QUICK_RECOVERY_ENERGY });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -641,11 +613,12 @@ class spell_rog_quick_recovery : public SpellScriptLoader
};
// -1943 - Rupture
-static char const* const RuptureScriptName = "spell_rog_rupture";
class spell_rog_rupture : public SpellScriptLoader
{
public:
- spell_rog_rupture() : SpellScriptLoader(RuptureScriptName) { }
+ static char constexpr const ScriptName[] = "spell_rog_rupture";
+
+ spell_rog_rupture() : SpellScriptLoader(ScriptName) { }
class spell_rog_rupture_AuraScript : public AuraScript
{
@@ -703,6 +676,7 @@ class spell_rog_rupture : public SpellScriptLoader
return new spell_rog_rupture_AuraScript();
}
};
+char constexpr const spell_rog_rupture::ScriptName[];
// 56800 - Glyph of Backstab (dummy)
class spell_rog_glyph_of_backstab : public SpellScriptLoader
@@ -716,9 +690,7 @@ class spell_rog_glyph_of_backstab : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_ROGUE_GLYPH_OF_BACKSTAB_TRIGGER))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_ROGUE_GLYPH_OF_BACKSTAB_TRIGGER });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -759,7 +731,7 @@ class spell_rog_glyph_of_backstab_triggered : public SpellScriptLoader
// search our Rupture aura on target
if (AuraEffect* aurEff = GetHitUnit()->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_ROGUE, 0x00100000, 0, 0, caster->GetGUID()))
{
- RuptureAuraScript* ruptureAuraScript = dynamic_cast<RuptureAuraScript*>(aurEff->GetBase()->GetScriptByName(RuptureScriptName));
+ RuptureAuraScript* ruptureAuraScript = aurEff->GetBase()->GetScript<RuptureAuraScript>(spell_rog_rupture::ScriptName);
if (!ruptureAuraScript)
return;
@@ -843,9 +815,7 @@ class spell_rog_shiv : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_ROGUE_SHIV_TRIGGERED))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_ROGUE_SHIV_TRIGGERED });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -877,20 +847,13 @@ class spell_rog_tricks_of_the_trade : public SpellScriptLoader
{
PrepareAuraScript(spell_rog_tricks_of_the_trade_AuraScript);
- public:
- spell_rog_tricks_of_the_trade_AuraScript()
- {
- _redirectTarget = nullptr;
- }
-
- private:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_ROGUE_TRICKS_OF_THE_TRADE_DMG_BOOST))
- return false;
- if (!sSpellMgr->GetSpellInfo(SPELL_ROGUE_TRICKS_OF_THE_TRADE_PROC))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_ROGUE_TRICKS_OF_THE_TRADE_DMG_BOOST,
+ SPELL_ROGUE_TRICKS_OF_THE_TRADE_PROC
+ });
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -922,8 +885,7 @@ class spell_rog_tricks_of_the_trade : public SpellScriptLoader
OnEffectProc += AuraEffectProcFn(spell_rog_tricks_of_the_trade_AuraScript::HandleProc, EFFECT_1, SPELL_AURA_DUMMY);
}
- private:
- Unit* _redirectTarget;
+ Unit* _redirectTarget = nullptr;
};
AuraScript* GetAuraScript() const override
@@ -971,10 +933,11 @@ public:
bool Validate(SpellInfo const* spellInfo) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_ROGUE_HONOR_AMONG_THIEVES_2) ||
- !sSpellMgr->GetSpellInfo(spellInfo->Effects[EFFECT_0].TriggerSpell))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_ROGUE_HONOR_AMONG_THIEVES_2,
+ spellInfo->Effects[EFFECT_0].TriggerSpell
+ });
}
bool CheckProc(ProcEventInfo& /*eventInfo*/)
@@ -1023,10 +986,7 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_ROGUE_HONOR_AMONG_THIEVES_PROC))
- return false;
-
- return true;
+ return ValidateSpellInfo({ SPELL_ROGUE_HONOR_AMONG_THIEVES_PROC });
}
void FilterTargets(std::list<WorldObject*>& targets)
@@ -1089,9 +1049,7 @@ class spell_rog_turn_the_tables : public SpellScriptLoader
bool Validate(SpellInfo const* spellInfo) override
{
- if (!sSpellMgr->GetSpellInfo(spellInfo->Effects[EFFECT_0].TriggerSpell))
- return false;
- return true;
+ return ValidateSpellInfo({ spellInfo->Effects[EFFECT_0].TriggerSpell });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/)
diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp
index 0b93927ecd0..5b89beaee2c 100644
--- a/src/server/scripts/Spells/spell_shaman.cpp
+++ b/src/server/scripts/Spells/spell_shaman.cpp
@@ -21,13 +21,17 @@
* Scriptnames of files in this file should be prefixed with "spell_sha_".
*/
-#include "Player.h"
#include "ScriptMgr.h"
#include "GridNotifiers.h"
-#include "Unit.h"
+#include "Item.h"
+#include "ObjectAccessor.h"
+#include "Map.h"
+#include "Player.h"
+#include "SpellAuraEffects.h"
#include "SpellHistory.h"
+#include "SpellMgr.h"
#include "SpellScript.h"
-#include "SpellAuraEffects.h"
+#include "Unit.h"
enum ShamanSpells
{
@@ -106,9 +110,7 @@ class spell_sha_ancestral_awakening : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_ANCESTRAL_AWAKENING_DUMMY))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SHAMAN_ANCESTRAL_AWAKENING_DUMMY });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -146,9 +148,7 @@ class spell_sha_ancestral_awakening_proc : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_ANCESTRAL_AWAKENING_PROC))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SHAMAN_ANCESTRAL_AWAKENING_PROC });
}
void FilterTargets(std::list<WorldObject*>& targets)
@@ -167,7 +167,7 @@ class spell_sha_ancestral_awakening_proc : public SpellScriptLoader
{
int32 damage = GetEffectValue();
if (GetHitUnit())
- GetCaster()->CastCustomSpell(GetHitUnit(), SPELL_SHAMAN_ANCESTRAL_AWAKENING_PROC, &damage, NULL, NULL, true);
+ GetCaster()->CastCustomSpell(GetHitUnit(), SPELL_SHAMAN_ANCESTRAL_AWAKENING_PROC, &damage, nullptr, nullptr, true);
}
void Register() override
@@ -277,9 +277,7 @@ class spell_sha_bloodlust : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_SATED))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SHAMAN_SATED });
}
void RemoveInvalidTargets(std::list<WorldObject*>& targets)
@@ -371,16 +369,14 @@ class spell_sha_cleansing_totem_pulse : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_CLEANSING_TOTEM_EFFECT))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SHAMAN_CLEANSING_TOTEM_EFFECT });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
int32 bp = 1;
if (GetCaster() && GetHitUnit() && GetOriginalCaster())
- GetCaster()->CastCustomSpell(GetHitUnit(), SPELL_SHAMAN_CLEANSING_TOTEM_EFFECT, NULL, &bp, NULL, true, NULL, NULL, GetOriginalCaster()->GetGUID());
+ GetCaster()->CastCustomSpell(GetHitUnit(), SPELL_SHAMAN_CLEANSING_TOTEM_EFFECT, nullptr, &bp, nullptr, true, nullptr, nullptr, GetOriginalCaster()->GetGUID());
}
void Register() override
@@ -407,9 +403,7 @@ class spell_sha_earth_shield : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_EARTH_SHIELD_HEAL))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SHAMAN_EARTH_SHIELD_HEAL });
}
void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
@@ -451,9 +445,7 @@ class spell_sha_earthbind_totem : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_TOTEM_EARTHBIND_TOTEM) || !sSpellMgr->GetSpellInfo(SPELL_SHAMAN_TOTEM_EARTHEN_POWER))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SHAMAN_TOTEM_EARTHBIND_TOTEM, SPELL_SHAMAN_TOTEM_EARTHEN_POWER });
}
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
@@ -463,7 +455,7 @@ class spell_sha_earthbind_totem : public SpellScriptLoader
if (Player* owner = GetCaster()->GetCharmerOrOwnerPlayerOrPlayerItself())
if (AuraEffect* aur = owner->GetDummyAuraEffect(SPELLFAMILY_SHAMAN, 2289, 0))
if (roll_chance_i(aur->GetBaseAmount()))
- GetTarget()->CastSpell((Unit*)NULL, SPELL_SHAMAN_TOTEM_EARTHEN_POWER, true);
+ GetTarget()->CastSpell((Unit*)nullptr, SPELL_SHAMAN_TOTEM_EARTHEN_POWER, true);
}
void Apply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -550,9 +542,7 @@ class spell_sha_earthliving_weapon : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_BLESSING_OF_THE_ETERNALS_R1))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SHAMAN_BLESSING_OF_THE_ETERNALS_R1 });
}
bool CheckProc(ProcEventInfo& eventInfo)
@@ -648,11 +638,7 @@ class spell_sha_flame_shock : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_LAVA_FLOWS_R1))
- return false;
- if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_LAVA_FLOWS_TRIGGERED_R1))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SHAMAN_LAVA_FLOWS_R1, SPELL_SHAMAN_LAVA_FLOWS_TRIGGERED_R1 });
}
void HandleDispel(DispelInfo* /*dispelInfo*/)
@@ -694,9 +680,7 @@ class spell_sha_flametongue_weapon : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_FLAMETONGUE_ATTACK))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SHAMAN_FLAMETONGUE_ATTACK });
}
bool CheckProc(ProcEventInfo& eventInfo)
@@ -778,9 +762,7 @@ class spell_sha_frozen_power : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_FREEZE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SHAMAN_FREEZE });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -864,9 +846,7 @@ class spell_sha_glyph_of_healing_wave : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_GLYPH_OF_HEALING_WAVE_HEAL))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SHAMAN_GLYPH_OF_HEALING_WAVE_HEAL });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -908,9 +888,7 @@ class spell_sha_glyph_of_totem_of_wrath : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_TOTEM_OF_WRATH_SPELL_POWER))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SHAMAN_TOTEM_OF_WRATH_SPELL_POWER });
}
bool CheckProc(ProcEventInfo& eventInfo)
@@ -969,9 +947,7 @@ class spell_sha_healing_stream_totem : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_GLYPH_OF_HEALING_STREAM_TOTEM) || !sSpellMgr->GetSpellInfo(SPELL_SHAMAN_TOTEM_HEALING_STREAM_HEAL))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SHAMAN_GLYPH_OF_HEALING_STREAM_TOTEM, SPELL_SHAMAN_TOTEM_HEALING_STREAM_HEAL });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -1027,9 +1003,7 @@ class spell_sha_heroism : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_EXHAUSTION))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SHAMAN_EXHAUSTION });
}
void RemoveInvalidTargets(std::list<WorldObject*>& targets)
@@ -1129,10 +1103,11 @@ class spell_sha_lightning_overload : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_LIGHTNING_BOLT_OVERLOAD_R1) ||
- !sSpellMgr->GetSpellInfo(SPELL_SHAMAN_CHAIN_LIGHTNING_OVERLOAD_R1))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_SHAMAN_LIGHTNING_BOLT_OVERLOAD_R1,
+ SPELL_SHAMAN_CHAIN_LIGHTNING_OVERLOAD_R1
+ });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -1188,9 +1163,7 @@ class spell_sha_item_lightning_shield : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_ITEM_LIGHTNING_SHIELD))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SHAMAN_ITEM_LIGHTNING_SHIELD });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -1223,9 +1196,7 @@ class spell_sha_item_lightning_shield_trigger : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_ITEM_LIGHTNING_SHIELD_DAMAGE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SHAMAN_ITEM_LIGHTNING_SHIELD_DAMAGE });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/)
@@ -1258,9 +1229,7 @@ class spell_sha_item_mana_surge : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_ITEM_MANA_SURGE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SHAMAN_ITEM_MANA_SURGE });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -1300,10 +1269,11 @@ class spell_sha_item_t6_trinket : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_ENERGY_SURGE) ||
- !sSpellMgr->GetSpellInfo(SPELL_SHAMAN_POWER_SURGE))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_SHAMAN_ENERGY_SURGE,
+ SPELL_SHAMAN_POWER_SURGE
+ });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -1365,9 +1335,7 @@ class spell_sha_item_t10_elemental_2p_bonus : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_ELEMENTAL_MASTERY))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SHAMAN_ELEMENTAL_MASTERY });
}
void HandleEffectProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/)
@@ -1446,9 +1414,7 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_LIGHTNING_SHIELD_R1))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SHAMAN_LIGHTNING_SHIELD_R1 });
}
bool CheckProc(ProcEventInfo& eventInfo)
@@ -1491,10 +1457,11 @@ class spell_sha_maelstrom_weapon : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_MAELSTROM_POWER) ||
- !sSpellMgr->GetSpellInfo(SPELL_SHAMAN_T10_ENHANCEMENT_4P_BONUS))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_SHAMAN_MAELSTROM_POWER,
+ SPELL_SHAMAN_T10_ENHANCEMENT_4P_BONUS
+ });
}
void HandleBonus(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -1534,9 +1501,7 @@ class spell_sha_mana_spring_totem : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_MANA_SPRING_TOTEM_ENERGIZE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SHAMAN_MANA_SPRING_TOTEM_ENERGIZE });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -1573,9 +1538,7 @@ class spell_sha_mana_tide_totem : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_GLYPH_OF_MANA_TIDE) || !sSpellMgr->GetSpellInfo(SPELL_SHAMAN_MANA_TIDE_TOTEM))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SHAMAN_GLYPH_OF_MANA_TIDE, SPELL_SHAMAN_MANA_TIDE_TOTEM });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -1623,9 +1586,7 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_NATURE_GUARDIAN))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SHAMAN_NATURE_GUARDIAN });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -1676,9 +1637,7 @@ class spell_sha_sentry_totem : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_BIND_SIGHT))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SHAMAN_BIND_SIGHT });
}
void AfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -1721,9 +1680,7 @@ class spell_sha_shamanistic_rage : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_SHAMANISTIC_RAGE_PROC))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SHAMAN_SHAMANISTIC_RAGE_PROC });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/)
@@ -1759,9 +1716,7 @@ class spell_sha_spirit_hunt : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_SPIRIT_HUNT_HEAL))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SHAMAN_SPIRIT_HUNT_HEAL });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -1805,9 +1760,7 @@ class spell_sha_static_shock : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_LIGHTNING_SHIELD_DAMAGE_R1))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SHAMAN_LIGHTNING_SHIELD_DAMAGE_R1 });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -1850,9 +1803,7 @@ class spell_sha_tidal_force_dummy : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_TIDAL_FORCE_CRIT))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SHAMAN_TIDAL_FORCE_CRIT });
}
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
@@ -1914,9 +1865,7 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_TOTEMIC_MASTERY))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SHAMAN_TOTEMIC_MASTERY });
}
void HandleDummy(AuraEffect const* aurEff)
@@ -1954,12 +1903,13 @@ class spell_sha_t3_6p_bonus : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_TOTEMIC_POWER_ARMOR) ||
- !sSpellMgr->GetSpellInfo(SPELL_SHAMAN_TOTEMIC_POWER_ATTACK_POWER) ||
- !sSpellMgr->GetSpellInfo(SPELL_SHAMAN_TOTEMIC_POWER_SPELL_POWER) ||
- !sSpellMgr->GetSpellInfo(SPELL_SHAMAN_TOTEMIC_POWER_MP5))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_SHAMAN_TOTEMIC_POWER_ARMOR,
+ SPELL_SHAMAN_TOTEMIC_POWER_ATTACK_POWER,
+ SPELL_SHAMAN_TOTEMIC_POWER_SPELL_POWER,
+ SPELL_SHAMAN_TOTEMIC_POWER_MP5
+ });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -2020,9 +1970,7 @@ class spell_sha_t8_elemental_4p_bonus : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_ELECTRIFIED))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SHAMAN_ELECTRIFIED });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -2069,9 +2017,7 @@ class spell_sha_t9_elemental_4p_bonus : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_LAVA_BURST_BONUS_DAMAGE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SHAMAN_LAVA_BURST_BONUS_DAMAGE });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -2163,9 +2109,7 @@ class spell_sha_t10_restoration_4p_bonus : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_CHAINED_HEAL))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_SHAMAN_CHAINED_HEAL });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -2212,11 +2156,12 @@ class spell_sha_windfury_weapon : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_WINDFURY_WEAPON_R1) ||
- !sSpellMgr->GetSpellInfo(SPELL_SHAMAN_WINDFURY_ATTACK_MH) ||
- !sSpellMgr->GetSpellInfo(SPELL_SHAMAN_WINDFURY_ATTACK_OH))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_SHAMAN_WINDFURY_WEAPON_R1,
+ SPELL_SHAMAN_WINDFURY_ATTACK_MH,
+ SPELL_SHAMAN_WINDFURY_ATTACK_OH
+ });
}
bool CheckProc(ProcEventInfo& eventInfo)
diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp
index 1f8954d0da7..1b602210889 100644
--- a/src/server/scripts/Spells/spell_warlock.cpp
+++ b/src/server/scripts/Spells/spell_warlock.cpp
@@ -21,10 +21,16 @@
* Scriptnames of files in this file should be prefixed with "spell_warl_".
*/
-#include "Player.h"
#include "ScriptMgr.h"
-#include "SpellScript.h"
+#include "Creature.h"
+#include "GameObject.h"
+#include "Log.h"
+#include "ObjectMgr.h"
+#include "Player.h"
+#include "Random.h"
#include "SpellAuraEffects.h"
+#include "SpellMgr.h"
+#include "SpellScript.h"
enum WarlockSpells
{
@@ -152,9 +158,7 @@ class spell_warl_create_healthstone : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_IMPROVED_HEALTHSTONE_R1) || !sSpellMgr->GetSpellInfo(SPELL_WARLOCK_IMPROVED_HEALTHSTONE_R2))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_WARLOCK_IMPROVED_HEALTHSTONE_R1, SPELL_WARLOCK_IMPROVED_HEALTHSTONE_R2 });
}
SpellCastResult CheckCast()
@@ -163,7 +167,7 @@ class spell_warl_create_healthstone : public SpellScriptLoader
{
uint8 spellRank = GetSpellInfo()->GetRank();
ItemPosCountVec dest;
- InventoryResult msg = caster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, iTypes[spellRank - 1][0], 1, NULL);
+ InventoryResult msg = caster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, iTypes[spellRank - 1][0], 1, nullptr);
if (msg != EQUIP_ERR_OK)
return SPELL_FAILED_TOO_MANY_OF_ITEM;
}
@@ -233,9 +237,7 @@ class spell_warl_curse_of_doom : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_CURSE_OF_DOOM_EFFECT))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_WARLOCK_CURSE_OF_DOOM_EFFECT });
}
bool Load() override
@@ -253,7 +255,7 @@ class spell_warl_curse_of_doom : public SpellScriptLoader
return;
if (GetCaster()->ToPlayer()->isHonorOrXPTarget(GetTarget()))
- GetCaster()->CastSpell(GetTarget(), SPELL_WARLOCK_CURSE_OF_DOOM_EFFECT, true, NULL, aurEff);
+ GetCaster()->CastSpell(GetTarget(), SPELL_WARLOCK_CURSE_OF_DOOM_EFFECT, true, nullptr, aurEff);
}
void Register() override
@@ -396,9 +398,14 @@ class spell_warl_demonic_empowerment : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_DEMONIC_EMPOWERMENT_SUCCUBUS) || !sSpellMgr->GetSpellInfo(SPELL_WARLOCK_DEMONIC_EMPOWERMENT_VOIDWALKER) || !sSpellMgr->GetSpellInfo(SPELL_WARLOCK_DEMONIC_EMPOWERMENT_FELGUARD) || !sSpellMgr->GetSpellInfo(SPELL_WARLOCK_DEMONIC_EMPOWERMENT_FELHUNTER) || !sSpellMgr->GetSpellInfo(SPELL_WARLOCK_DEMONIC_EMPOWERMENT_IMP))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_WARLOCK_DEMONIC_EMPOWERMENT_SUCCUBUS,
+ SPELL_WARLOCK_DEMONIC_EMPOWERMENT_VOIDWALKER,
+ SPELL_WARLOCK_DEMONIC_EMPOWERMENT_FELGUARD,
+ SPELL_WARLOCK_DEMONIC_EMPOWERMENT_FELHUNTER,
+ SPELL_WARLOCK_DEMONIC_EMPOWERMENT_IMP
+ });
}
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
@@ -418,7 +425,7 @@ class spell_warl_demonic_empowerment : public SpellScriptLoader
{
SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(SPELL_WARLOCK_DEMONIC_EMPOWERMENT_VOIDWALKER);
int32 hp = int32(targetCreature->CountPctFromMaxHealth(GetCaster()->CalculateSpellDamage(targetCreature, spellInfo, 0)));
- targetCreature->CastCustomSpell(targetCreature, SPELL_WARLOCK_DEMONIC_EMPOWERMENT_VOIDWALKER, &hp, NULL, NULL, true);
+ targetCreature->CastCustomSpell(targetCreature, SPELL_WARLOCK_DEMONIC_EMPOWERMENT_VOIDWALKER, &hp, nullptr, nullptr, true);
//unitTarget->CastSpell(unitTarget, 54441, true);
break;
}
@@ -462,10 +469,11 @@ class spell_warl_drain_soul : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_IMPROVED_DRAIN_SOUL_R1) ||
- !sSpellMgr->GetSpellInfo(SPELL_WARLOCK_IMPROVED_DRAIN_SOUL_PROC))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_WARLOCK_IMPROVED_DRAIN_SOUL_R1,
+ SPELL_WARLOCK_IMPROVED_DRAIN_SOUL_PROC
+ });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -543,9 +551,7 @@ class spell_warl_fel_synergy : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_FEL_SYNERGY_HEAL))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_WARLOCK_FEL_SYNERGY_HEAL });
}
bool CheckProc(ProcEventInfo& eventInfo)
@@ -591,9 +597,7 @@ class spell_warl_glyph_of_corruption_nightfall : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_SHADOW_TRANCE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_WARLOCK_SHADOW_TRANCE });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -627,9 +631,7 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_GLYPH_OF_LIFE_TAP_TRIGGERED))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_WARLOCK_GLYPH_OF_LIFE_TAP_TRIGGERED });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -663,15 +665,13 @@ class spell_warl_glyph_of_shadowflame : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_GLYPH_OF_SHADOWFLAME))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_WARLOCK_GLYPH_OF_SHADOWFLAME });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
- GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_WARLOCK_GLYPH_OF_SHADOWFLAME, true, NULL, aurEff);
+ GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_WARLOCK_GLYPH_OF_SHADOWFLAME, true, nullptr, aurEff);
}
void Register() override
@@ -715,9 +715,7 @@ class spell_warl_haunt : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_HAUNT_HEAL))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_WARLOCK_HAUNT_HEAL });
}
void HandleRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
@@ -725,7 +723,7 @@ class spell_warl_haunt : public SpellScriptLoader
if (Unit* caster = GetCaster())
{
int32 amount = aurEff->GetAmount();
- GetTarget()->CastCustomSpell(caster, SPELL_WARLOCK_HAUNT_HEAL, &amount, NULL, NULL, true, NULL, aurEff, GetCasterGUID());
+ GetTarget()->CastCustomSpell(caster, SPELL_WARLOCK_HAUNT_HEAL, &amount, nullptr, nullptr, true, nullptr, aurEff, GetCasterGUID());
}
}
@@ -806,9 +804,7 @@ class spell_warl_life_tap : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_LIFE_TAP_ENERGIZE) || !sSpellMgr->GetSpellInfo(SPELL_WARLOCK_LIFE_TAP_ENERGIZE_2))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_WARLOCK_LIFE_TAP_ENERGIZE, SPELL_WARLOCK_LIFE_TAP_ENERGIZE_2 });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -826,7 +822,7 @@ class spell_warl_life_tap : public SpellScriptLoader
if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_WARLOCK, WARLOCK_ICON_ID_IMPROVED_LIFE_TAP, 0))
AddPct(mana, aurEff->GetAmount());
- caster->CastCustomSpell(target, SPELL_WARLOCK_LIFE_TAP_ENERGIZE, &mana, NULL, NULL, false);
+ caster->CastCustomSpell(target, SPELL_WARLOCK_LIFE_TAP_ENERGIZE, &mana, nullptr, nullptr, false);
// Mana Feed
int32 manaFeedVal = 0;
@@ -836,7 +832,7 @@ class spell_warl_life_tap : public SpellScriptLoader
if (manaFeedVal > 0)
{
ApplyPct(manaFeedVal, mana);
- caster->CastCustomSpell(caster, SPELL_WARLOCK_LIFE_TAP_ENERGIZE_2, &manaFeedVal, NULL, NULL, true, NULL);
+ caster->CastCustomSpell(caster, SPELL_WARLOCK_LIFE_TAP_ENERGIZE_2, &manaFeedVal, nullptr, nullptr, true, nullptr);
}
}
}
@@ -873,14 +869,15 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_NETHER_PROTECTION_HOLY) ||
- !sSpellMgr->GetSpellInfo(SPELL_WARLOCK_NETHER_PROTECTION_FIRE) ||
- !sSpellMgr->GetSpellInfo(SPELL_WARLOCK_NETHER_PROTECTION_FROST) ||
- !sSpellMgr->GetSpellInfo(SPELL_WARLOCK_NETHER_PROTECTION_ARCANE) ||
- !sSpellMgr->GetSpellInfo(SPELL_WARLOCK_NETHER_PROTECTION_SHADOW) ||
- !sSpellMgr->GetSpellInfo(SPELL_WARLOCK_NETHER_PROTECTION_NATURE))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_WARLOCK_NETHER_PROTECTION_HOLY,
+ SPELL_WARLOCK_NETHER_PROTECTION_FIRE,
+ SPELL_WARLOCK_NETHER_PROTECTION_NATURE,
+ SPELL_WARLOCK_NETHER_PROTECTION_FROST,
+ SPELL_WARLOCK_NETHER_PROTECTION_SHADOW,
+ SPELL_WARLOCK_NETHER_PROTECTION_ARCANE
+ });
}
bool CheckProc(ProcEventInfo& eventInfo)
@@ -962,9 +959,7 @@ class spell_warl_demonic_pact : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_DEMONIC_PACT_PROC))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_WARLOCK_DEMONIC_PACT_PROC });
}
bool CheckProc(ProcEventInfo& eventInfo)
@@ -1039,9 +1034,7 @@ class spell_warl_seduction : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_GLYPH_OF_SUCCUBUS))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_WARLOCK_GLYPH_OF_SUCCUBUS });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -1108,9 +1101,7 @@ class spell_warl_seed_of_corruption_dummy : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_SEED_OF_CORRUPTION_DAMAGE_R1))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_WARLOCK_SEED_OF_CORRUPTION_DAMAGE_R1 });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -1168,9 +1159,7 @@ class spell_warl_seed_of_corruption_generic : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_SEED_OF_CORRUPTION_GENERIC))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_WARLOCK_SEED_OF_CORRUPTION_GENERIC });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -1257,11 +1246,11 @@ class spell_warl_siphon_life : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_SIPHON_LIFE_HEAL))
- return false;
- if (!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_GLYPH_OF_SIPHON_LIFE))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_WARLOCK_SIPHON_LIFE_HEAL,
+ SPELL_WARLOCK_GLYPH_OF_SIPHON_LIFE
+ });
}
bool CheckProc(ProcEventInfo& eventInfo)
@@ -1310,15 +1299,16 @@ class spell_warl_soul_leech : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_SOUL_LEECH_HEAL) ||
- !sSpellMgr->GetSpellInfo(SPELL_WARLOCK_IMP_SOUL_LEECH_R1) ||
- !sSpellMgr->GetSpellInfo(SPELL_WARLOCK_SOUL_LEECH_PET_MANA_1) ||
- !sSpellMgr->GetSpellInfo(SPELL_WARLOCK_SOUL_LEECH_PET_MANA_2) ||
- !sSpellMgr->GetSpellInfo(SPELL_WARLOCK_SOUL_LEECH_CASTER_MANA_1) ||
- !sSpellMgr->GetSpellInfo(SPELL_WARLOCK_SOUL_LEECH_CASTER_MANA_2) ||
- !sSpellMgr->GetSpellInfo(SPELL_REPLENISHMENT))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_WARLOCK_SOUL_LEECH_HEAL,
+ SPELL_WARLOCK_IMP_SOUL_LEECH_R1,
+ SPELL_WARLOCK_SOUL_LEECH_PET_MANA_1,
+ SPELL_WARLOCK_SOUL_LEECH_PET_MANA_2,
+ SPELL_WARLOCK_SOUL_LEECH_CASTER_MANA_1,
+ SPELL_WARLOCK_SOUL_LEECH_CASTER_MANA_2,
+ SPELL_REPLENISHMENT
+ });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -1375,9 +1365,7 @@ class spell_warl_soulshatter : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_SOULSHATTER))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_WARLOCK_SOULSHATTER });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -1417,9 +1405,7 @@ class spell_warl_t4_2p_bonus : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(Trigger))
- return false;
- return true;
+ return ValidateSpellInfo({ Trigger });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -1453,9 +1439,7 @@ class spell_warl_unstable_affliction : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_UNSTABLE_AFFLICTION_DISPEL))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_WARLOCK_UNSTABLE_AFFLICTION_DISPEL });
}
void HandleDispel(DispelInfo* dispelInfo)
@@ -1465,7 +1449,7 @@ class spell_warl_unstable_affliction : public SpellScriptLoader
{
int32 damage = aurEff->GetAmount() * 9;
// backfire damage and silence
- caster->CastCustomSpell(dispelInfo->GetDispeller(), SPELL_WARLOCK_UNSTABLE_AFFLICTION_DISPEL, &damage, NULL, NULL, true, NULL, aurEff);
+ caster->CastCustomSpell(dispelInfo->GetDispeller(), SPELL_WARLOCK_UNSTABLE_AFFLICTION_DISPEL, &damage, nullptr, nullptr, true, nullptr, aurEff);
}
}
diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp
index 7ee2833e30f..70a4946b424 100644
--- a/src/server/scripts/Spells/spell_warrior.cpp
+++ b/src/server/scripts/Spells/spell_warrior.cpp
@@ -21,11 +21,13 @@
* Scriptnames of files in this file should be prefixed with "spell_warr_".
*/
-#include "Player.h"
#include "ScriptMgr.h"
+#include "Player.h"
+#include "Random.h"
+#include "SpellAuraEffects.h"
#include "SpellHistory.h"
+#include "SpellMgr.h"
#include "SpellScript.h"
-#include "SpellAuraEffects.h"
enum WarriorSpells
{
@@ -109,7 +111,7 @@ class spell_warr_bloodthirst : public SpellScriptLoader
void HandleDummy(SpellEffIndex /*effIndex*/)
{
int32 damage = GetEffectValue();
- GetCaster()->CastCustomSpell(GetCaster(), SPELL_WARRIOR_BLOODTHIRST, &damage, NULL, NULL, true, NULL);
+ GetCaster()->CastCustomSpell(GetCaster(), SPELL_WARRIOR_BLOODTHIRST, &damage, nullptr, nullptr, true, nullptr);
}
void Register() override
@@ -165,16 +167,14 @@ class spell_warr_charge : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_WARRIOR_JUGGERNAUT_CRIT_BONUS_TALENT) || !sSpellMgr->GetSpellInfo(SPELL_WARRIOR_JUGGERNAUT_CRIT_BONUS_BUFF) || !sSpellMgr->GetSpellInfo(SPELL_WARRIOR_CHARGE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_WARRIOR_JUGGERNAUT_CRIT_BONUS_TALENT, SPELL_WARRIOR_JUGGERNAUT_CRIT_BONUS_BUFF, SPELL_WARRIOR_CHARGE });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
int32 chargeBasePoints0 = GetEffectValue();
Unit* caster = GetCaster();
- caster->CastCustomSpell(caster, SPELL_WARRIOR_CHARGE, &chargeBasePoints0, NULL, NULL, true);
+ caster->CastCustomSpell(caster, SPELL_WARRIOR_CHARGE, &chargeBasePoints0, nullptr, nullptr, true);
// Juggernaut crit bonus
if (caster->HasAura(SPELL_WARRIOR_JUGGERNAUT_CRIT_BONUS_TALENT))
@@ -232,9 +232,7 @@ class spell_warr_damage_shield : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_WARRIOR_DAMAGE_SHIELD_DAMAGE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_WARRIOR_DAMAGE_SHIELD_DAMAGE });
}
void OnProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -243,7 +241,7 @@ class spell_warr_damage_shield : public SpellScriptLoader
// % of amount blocked
int32 damage = CalculatePct(int32(GetTarget()->GetShieldBlockValue()), aurEff->GetAmount());
- GetTarget()->CastCustomSpell(SPELL_WARRIOR_DAMAGE_SHIELD_DAMAGE, SPELLVALUE_BASE_POINT0, damage, eventInfo.GetProcTarget(), true, NULL, aurEff);
+ GetTarget()->CastCustomSpell(SPELL_WARRIOR_DAMAGE_SHIELD_DAMAGE, SPELLVALUE_BASE_POINT0, damage, eventInfo.GetProcTarget(), true, nullptr, aurEff);
}
void Register() override
@@ -270,12 +268,13 @@ class spell_warr_deep_wounds : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_WARRIOR_DEEP_WOUNDS_RANK_1) ||
- !sSpellMgr->GetSpellInfo(SPELL_WARRIOR_DEEP_WOUNDS_RANK_2) ||
- !sSpellMgr->GetSpellInfo(SPELL_WARRIOR_DEEP_WOUNDS_RANK_3) ||
- !sSpellMgr->GetSpellInfo(SPELL_WARRIOR_DEEP_WOUNDS_PERIODIC))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_WARRIOR_DEEP_WOUNDS_RANK_1,
+ SPELL_WARRIOR_DEEP_WOUNDS_RANK_2,
+ SPELL_WARRIOR_DEEP_WOUNDS_RANK_3,
+ SPELL_WARRIOR_DEEP_WOUNDS_PERIODIC
+ });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -319,9 +318,7 @@ class spell_warr_deep_wounds_aura : public SpellScriptLoader
bool Validate(SpellInfo const* spellInfo) override
{
- if (!sSpellMgr->GetSpellInfo(spellInfo->Effects[EFFECT_0].TriggerSpell))
- return false;
- return true;
+ return ValidateSpellInfo({ spellInfo->Effects[EFFECT_0].TriggerSpell });
}
bool CheckProc(ProcEventInfo& eventInfo)
@@ -373,9 +370,7 @@ class spell_warr_execute : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_WARRIOR_EXECUTE) || !sSpellMgr->GetSpellInfo(SPELL_WARRIOR_GLYPH_OF_EXECUTION))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_WARRIOR_EXECUTE, SPELL_WARRIOR_GLYPH_OF_EXECUTION });
}
void HandleEffect(SpellEffIndex effIndex)
@@ -401,7 +396,7 @@ class spell_warr_execute : public SpellScriptLoader
int32 bp = GetEffectValue() + int32(rageUsed * spellInfo->Effects[effIndex].DamageMultiplier + caster->GetTotalAttackPowerValue(BASE_ATTACK) * 0.2f);
- caster->CastCustomSpell(target, SPELL_WARRIOR_EXECUTE, &bp, NULL, NULL, true, NULL, NULL, GetOriginalCaster()->GetGUID());
+ caster->CastCustomSpell(target, SPELL_WARRIOR_EXECUTE, &bp, nullptr, nullptr, true, nullptr, nullptr, GetOriginalCaster()->GetGUID());
}
}
@@ -430,12 +425,13 @@ class spell_warr_extra_proc : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_WARRIOR_T10_MELEE_4P_BONUS) ||
- !sSpellMgr->GetSpellInfo(SPELL_WARRIOR_EXTRA_CHARGE) ||
- !sSpellMgr->GetSpellInfo(SPELL_WARRIOR_SLAM_GCD_REDUCED) ||
- !sSpellMgr->GetSpellInfo(SPELL_WARRIOR_EXECUTE_GCD_REDUCED))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_WARRIOR_T10_MELEE_4P_BONUS,
+ SPELL_WARRIOR_EXTRA_CHARGE,
+ SPELL_WARRIOR_SLAM_GCD_REDUCED,
+ SPELL_WARRIOR_EXECUTE_GCD_REDUCED
+ });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/)
@@ -481,9 +477,7 @@ class spell_warr_glyph_of_blocking : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_WARRIOR_GLYPH_OF_BLOCKING))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_WARRIOR_GLYPH_OF_BLOCKING });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -553,9 +547,7 @@ class spell_warr_improved_spell_reflection : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_WARRIOR_IMPROVED_SPELL_REFLECTION_TRIGGER))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_WARRIOR_IMPROVED_SPELL_REFLECTION_TRIGGER });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -617,9 +609,7 @@ class spell_warr_item_t10_prot_4p_bonus : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_WARRIOR_STOICISM))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_WARRIOR_STOICISM });
}
void HandleProc(ProcEventInfo& eventInfo)
@@ -655,16 +645,14 @@ class spell_warr_last_stand : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_WARRIOR_LAST_STAND_TRIGGERED))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_WARRIOR_LAST_STAND_TRIGGERED });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
int32 healthModSpellBasePoints0 = int32(caster->CountPctFromMaxHealth(GetEffectValue()));
- caster->CastCustomSpell(caster, SPELL_WARRIOR_LAST_STAND_TRIGGERED, &healthModSpellBasePoints0, NULL, NULL, true, NULL);
+ caster->CastCustomSpell(caster, SPELL_WARRIOR_LAST_STAND_TRIGGERED, &healthModSpellBasePoints0, nullptr, nullptr, true, nullptr);
}
void Register() override
@@ -775,9 +763,7 @@ class spell_warr_retaliation : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_WARRIOR_RETALIATION_DAMAGE))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_WARRIOR_RETALIATION_DAMAGE });
}
bool CheckProc(ProcEventInfo& eventInfo)
@@ -789,7 +775,7 @@ class spell_warr_retaliation : public SpellScriptLoader
void HandleEffectProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
- GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_WARRIOR_RETALIATION_DAMAGE, true, NULL, aurEff);
+ GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_WARRIOR_RETALIATION_DAMAGE, true, nullptr, aurEff);
}
void Register() override
@@ -817,10 +803,11 @@ class spell_warr_second_wind : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_WARRIOR_SECOND_WIND_TRIGGER_1) ||
- !sSpellMgr->GetSpellInfo(SPELL_WARRIOR_SECOND_WIND_TRIGGER_2))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_WARRIOR_SECOND_WIND_TRIGGER_1,
+ SPELL_WARRIOR_SECOND_WIND_TRIGGER_2
+ });
}
bool CheckProc(ProcEventInfo& eventInfo)
@@ -898,9 +885,7 @@ class spell_warr_slam : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_WARRIOR_SLAM))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_WARRIOR_SLAM });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -931,18 +916,9 @@ class spell_warr_sweeping_strikes : public SpellScriptLoader
{
PrepareAuraScript(spell_warr_sweeping_strikes_AuraScript);
- public:
- spell_warr_sweeping_strikes_AuraScript()
- {
- _procTarget = nullptr;
- }
-
- private:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_WARRIOR_SWEEPING_STRIKES_EXTRA_ATTACK_1) || !sSpellMgr->GetSpellInfo(SPELL_WARRIOR_SWEEPING_STRIKES_EXTRA_ATTACK_2))
- return false;
- return true;
+ return ValidateSpellInfo({ SPELL_WARRIOR_SWEEPING_STRIKES_EXTRA_ATTACK_1, SPELL_WARRIOR_SWEEPING_STRIKES_EXTRA_ATTACK_2 });
}
bool CheckProc(ProcEventInfo& eventInfo)
@@ -976,8 +952,7 @@ class spell_warr_sweeping_strikes : public SpellScriptLoader
OnEffectProc += AuraEffectProcFn(spell_warr_sweeping_strikes_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
}
- private:
- Unit* _procTarget;
+ Unit* _procTarget = nullptr;
};
AuraScript* GetAuraScript() const override
@@ -1063,24 +1038,15 @@ class spell_warr_vigilance : public SpellScriptLoader
{
PrepareAuraScript(spell_warr_vigilance_AuraScript);
- public:
- spell_warr_vigilance_AuraScript()
- {
- _procTarget = nullptr;
- }
-
- private:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- if (!sSpellMgr->GetSpellInfo(SPELL_WARRIOR_GLYPH_OF_VIGILANCE))
- return false;
- if (!sSpellMgr->GetSpellInfo(SPELL_WARRIOR_VIGILANCE_PROC))
- return false;
- if (!sSpellMgr->GetSpellInfo(SPELL_WARRIOR_VIGILANCE_REDIRECT_THREAT))
- return false;
- if (!sSpellMgr->GetSpellInfo(SPELL_GEN_DAMAGE_REDUCTION_AURA))
- return false;
- return true;
+ return ValidateSpellInfo(
+ {
+ SPELL_WARRIOR_GLYPH_OF_VIGILANCE,
+ SPELL_WARRIOR_VIGILANCE_PROC,
+ SPELL_WARRIOR_VIGILANCE_REDIRECT_THREAT,
+ SPELL_GEN_DAMAGE_REDUCTION_AURA
+ });
}
void HandleApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -1126,7 +1092,7 @@ class spell_warr_vigilance : public SpellScriptLoader
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/)
{
PreventDefaultAction();
- GetTarget()->CastSpell(_procTarget, SPELL_WARRIOR_VIGILANCE_PROC, true, NULL, aurEff);
+ GetTarget()->CastSpell(_procTarget, SPELL_WARRIOR_VIGILANCE_PROC, true, nullptr, aurEff);
}
void Register() override
@@ -1138,8 +1104,7 @@ class spell_warr_vigilance : public SpellScriptLoader
OnEffectProc += AuraEffectProcFn(spell_warr_vigilance_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL);
}
- private:
- Unit* _procTarget;
+ Unit* _procTarget = nullptr;
};
AuraScript* GetAuraScript() const override
diff --git a/src/server/scripts/World/action_ip_logger.cpp b/src/server/scripts/World/action_ip_logger.cpp
index 3c515b38dfe..9dc3fba9896 100644
--- a/src/server/scripts/World/action_ip_logger.cpp
+++ b/src/server/scripts/World/action_ip_logger.cpp
@@ -16,9 +16,9 @@
*/
#include "ScriptMgr.h"
-#include "Channel.h"
-#include "Guild.h"
-#include "Group.h"
+#include "DatabaseEnv.h"
+#include "Player.h"
+#include "WorldSession.h"
enum IPLoggingTypes
{
diff --git a/src/server/scripts/World/areatrigger_scripts.cpp b/src/server/scripts/World/areatrigger_scripts.cpp
index a3fb056ba8f..a7d730f185a 100644
--- a/src/server/scripts/World/areatrigger_scripts.cpp
+++ b/src/server/scripts/World/areatrigger_scripts.cpp
@@ -35,10 +35,15 @@ at_brewfest
at_area_52_entrance
EndContentData */
-#include "GameTime.h"
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
+#include "DBCStructure.h"
+#include "GameObject.h"
+#include "GameTime.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "ScriptedCreature.h"
+#include "TemporarySummon.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..65bd57c2a16 100644
--- a/src/server/scripts/World/boss_emerald_dragons.cpp
+++ b/src/server/scripts/World/boss_emerald_dragons.cpp
@@ -17,12 +17,13 @@
*/
#include "ObjectMgr.h"
-#include "ScriptMgr.h"
+#include "MotionMaster.h"
+#include "PassiveAI.h"
#include "ScriptedCreature.h"
-#include "SpellScript.h"
+#include "ScriptMgr.h"
#include "Spell.h"
#include "SpellAuraEffects.h"
-#include "PassiveAI.h"
+#include "SpellScript.h"
//
// Emerald Dragon NPCs and IDs (kept here for reference)
@@ -397,7 +398,7 @@ class boss_lethon : public CreatureScript
switch (eventId)
{
case EVENT_SHADOW_BOLT_WHIRL:
- me->CastSpell((Unit*)NULL, SPELL_SHADOW_BOLT_WHIRL, false);
+ me->CastSpell((Unit*)nullptr, SPELL_SHADOW_BOLT_WHIRL, false);
events.ScheduleEvent(EVENT_SHADOW_BOLT_WHIRL, urand(15000, 30000));
break;
default:
@@ -437,7 +438,7 @@ class npc_spirit_shade : public CreatureScript
{
if (moveType == FOLLOW_MOTION_TYPE && data == _summonerGuid.GetCounter())
{
- me->CastSpell((Unit*)NULL, SPELL_DARK_OFFERING, false);
+ me->CastSpell((Unit*)nullptr, SPELL_DARK_OFFERING, false);
me->DespawnOrUnsummon(1000);
}
}
@@ -770,11 +771,11 @@ 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/chat_log.cpp b/src/server/scripts/World/chat_log.cpp
index 9b3465174a4..90e7d4863ca 100644
--- a/src/server/scripts/World/chat_log.cpp
+++ b/src/server/scripts/World/chat_log.cpp
@@ -17,8 +17,10 @@
#include "ScriptMgr.h"
#include "Channel.h"
-#include "Guild.h"
#include "Group.h"
+#include "Guild.h"
+#include "Log.h"
+#include "Player.h"
class ChatLogScript : public PlayerScript
{
diff --git a/src/server/scripts/World/duel_reset.cpp b/src/server/scripts/World/duel_reset.cpp
index 3d8692780b6..8a794091e60 100644
--- a/src/server/scripts/World/duel_reset.cpp
+++ b/src/server/scripts/World/duel_reset.cpp
@@ -15,11 +15,14 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "GameTime.h"
#include "ScriptMgr.h"
-#include "Player.h"
+#include "GameTime.h"
#include "Pet.h"
+#include "Player.h"
+#include "SpellHistory.h"
#include "SpellInfo.h"
+#include "SpellMgr.h"
+#include "World.h"
class DuelResetScript : public PlayerScript
{
diff --git a/src/server/scripts/World/go_scripts.cpp b/src/server/scripts/World/go_scripts.cpp
index c6a61a1d508..d9aa9358ee7 100644
--- a/src/server/scripts/World/go_scripts.cpp
+++ b/src/server/scripts/World/go_scripts.cpp
@@ -46,14 +46,22 @@ go_bells
EndContentData */
#include "ScriptMgr.h"
+#include "DBCStructure.h"
+#include "GameEventMgr.h"
+#include "GameObject.h"
+#include "GameObjectAI.h"
+#include "GameTime.h"
+#include "Log.h"
+#include "MotionMaster.h"
+#include "ObjectMgr.h"
+#include "Player.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
-#include "GameObjectAI.h"
#include "Spell.h"
-#include "Player.h"
+#include "SpellInfo.h"
+#include "SpellMgr.h"
+#include "TemporarySummon.h"
#include "WorldSession.h"
-#include "GameEventMgr.h"
-#include "GameTime.h"
/*######
## go_cat_figurine
@@ -1765,7 +1773,7 @@ public:
break;
std::vector<Player*> playersNearby;
- me->GetPlayerListInGrid(playersNearby, me->GetMap()->GetVisibilityRange());
+ me->GetPlayerListInGrid(playersNearby, me->GetVisibilityRange());
for (Player* player : playersNearby)
{
if (player->GetTeamId() == TEAM_HORDE)
diff --git a/src/server/scripts/World/guards.cpp b/src/server/scripts/World/guards.cpp
index a5d3ce8d500..638e53c45c5 100644
--- a/src/server/scripts/World/guards.cpp
+++ b/src/server/scripts/World/guards.cpp
@@ -30,8 +30,9 @@ guard_shattrath_scryer
EndContentData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "GuardAI.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "Player.h"
#include "SpellInfo.h"
@@ -120,7 +121,7 @@ public:
if (me->IsWithinMeleeRange(me->GetVictim()))
{
bool healing = false;
- SpellInfo const* info = NULL;
+ SpellInfo const* info = nullptr;
//Select a healing spell if less than 30% hp
if (me->HealthBelowPct(30))
@@ -156,7 +157,7 @@ public:
if (!me->IsNonMeleeSpellCast(false))
{
bool healing = false;
- SpellInfo const* info = NULL;
+ SpellInfo const* info = nullptr;
//Select a healing spell if less than 30% hp ONLY 33% of the time
if (me->HealthBelowPct(30) && 33 > urand(0, 99))
diff --git a/src/server/scripts/World/item_scripts.cpp b/src/server/scripts/World/item_scripts.cpp
index 64caa7ec4d1..8253aa23414 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
@@ -76,7 +80,7 @@ public:
return false;
// error
- player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, item, NULL);
+ player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, item, nullptr);
return true;
}
};
@@ -119,7 +123,7 @@ public:
targets.GetUnitTarget()->GetEntry() == 20748 && !targets.GetUnitTarget()->HasAura(32578))
return false;
- player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, item, NULL);
+ player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, item, nullptr);
return true;
}
};
@@ -139,7 +143,7 @@ public:
return false;
else
{
- player->SendEquipError(EQUIP_ERR_OUT_OF_RANGE, item, NULL);
+ player->SendEquipError(EQUIP_ERR_OUT_OF_RANGE, item, nullptr);
return true;
}
}
@@ -159,7 +163,7 @@ public:
ItemPosCountVec dest;
uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 39883, 1); // Cracked Egg
if (msg == EQUIP_ERR_OK)
- player->StoreNewItem(dest, 39883, true, Item::GenerateItemRandomPropertyId(39883));
+ player->StoreNewItem(dest, 39883, true, GenerateItemRandomPropertyId(39883));
return true;
}
@@ -179,7 +183,7 @@ public:
ItemPosCountVec dest;
uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 44718, 1); // Ripe Disgusting Jar
if (msg == EQUIP_ERR_OK)
- player->StoreNewItem(dest, 44718, true, Item::GenerateItemRandomPropertyId(44718));
+ player->StoreNewItem(dest, 44718, true, GenerateItemRandomPropertyId(44718));
return true;
}
@@ -225,7 +229,7 @@ public:
bool OnUse(Player* player, Item* /*item*/, SpellCastTargets const & /*targets*/) override
{
- GameObject* go = NULL;
+ GameObject* go = nullptr;
for (uint8 i = 0; i < CaribouTrapsNum; ++i)
{
go = player->FindNearestGameObject(CaribouTraps[i], 5.0f);
@@ -241,7 +245,7 @@ public:
float x, y, z;
go->GetClosePoint(x, y, z, go->GetCombatReach() / 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);
@@ -268,16 +272,16 @@ class item_petrov_cluster_bombs : public ItemScript
public:
item_petrov_cluster_bombs() : ItemScript("item_petrov_cluster_bombs") { }
- bool OnUse(Player* player, Item* item, const SpellCastTargets & /*targets*/) override
+ bool OnUse(Player* player, Item* item, SpellCastTargets const& /*targets*/) override
{
if (player->GetZoneId() != ZONE_ID_HOWLING)
return false;
if (!player->GetTransport() || player->GetAreaId() != AREA_ID_SHATTERED_STRAITS)
{
- player->SendEquipError(EQUIP_ERR_NONE, item, NULL);
+ player->SendEquipError(EQUIP_ERR_NONE, item, nullptr);
- if (const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(SPELL_PETROV_BOMB))
+ if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(SPELL_PETROV_BOMB))
Spell::SendCastResult(player, spellInfo, 1, SPELL_FAILED_NOT_HERE);
return true;
@@ -334,7 +338,7 @@ class item_dehta_trap_smasher : public ItemScript
public:
item_dehta_trap_smasher() : ItemScript("item_dehta_trap_smasher") { }
- bool OnUse(Player* player, Item* /*item*/, const SpellCastTargets & /*targets*/) override
+ bool OnUse(Player* player, Item* /*item*/, SpellCastTargets const& /*targets*/) override
{
if (player->GetQuestStatus(QUEST_CANNOT_HELP_THEMSELVES) != QUEST_STATUS_INCOMPLETE)
return false;
@@ -343,7 +347,7 @@ public:
if (!pMammoth)
return false;
- GameObject* pTrap = NULL;
+ GameObject* pTrap = nullptr;
for (uint8 i = 0; i < MammothTrapsNum; ++i)
{
pTrap = player->FindNearestGameObject(MammothTraps[i], 11.0f);
@@ -370,7 +374,7 @@ class item_trident_of_nazjan : public ItemScript
public:
item_trident_of_nazjan() : ItemScript("item_Trident_of_Nazjan") { }
- bool OnUse(Player* player, Item* item, const SpellCastTargets & /*targets*/) override
+ bool OnUse(Player* player, Item* item, SpellCastTargets const& /*targets*/) override
{
if (player->GetQuestStatus(QUEST_THE_EMISSARY) == QUEST_STATUS_INCOMPLETE)
{
@@ -379,9 +383,9 @@ public:
pLeviroth->AI()->AttackStart(player);
return false;
} else
- player->SendEquipError(EQUIP_ERR_OUT_OF_RANGE, item, NULL);
+ player->SendEquipError(EQUIP_ERR_OUT_OF_RANGE, item, nullptr);
} else
- player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, item, NULL);
+ player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, item, nullptr);
return true;
}
};
@@ -404,10 +408,10 @@ public:
if (player->FindNearestCreature(NPC_VANIRAS_SENTRY_TOTEM, 10.0f))
return false;
else
- player->SendEquipError(EQUIP_ERR_OUT_OF_RANGE, item, NULL);
+ player->SendEquipError(EQUIP_ERR_OUT_OF_RANGE, item, nullptr);
}
else
- player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, item, NULL);
+ player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, item, nullptr);
return true;
}
};
diff --git a/src/server/scripts/World/mob_generic_creature.cpp b/src/server/scripts/World/mob_generic_creature.cpp
index a7370fde1b5..0c71177ccac 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 "Creature.h"
#include "PassiveAI.h"
+#include "SpellMgr.h"
class trigger_periodic : public CreatureScript
{
@@ -29,13 +30,13 @@ public:
{
trigger_periodicAI(Creature* creature) : NullCreatureAI(creature)
{
- spell = me->m_spells[0] ? sSpellMgr->GetSpellInfo(me->m_spells[0]) : NULL;
+ spell = me->m_spells[0] ? sSpellMgr->GetSpellInfo(me->m_spells[0]) : nullptr;
interval = me->GetAttackTime(BASE_ATTACK);
timer = interval;
}
uint32 timer, interval;
- const SpellInfo* spell;
+ SpellInfo const* spell;
void UpdateAI(uint32 diff) override
{
diff --git a/src/server/scripts/World/npc_innkeeper.cpp b/src/server/scripts/World/npc_innkeeper.cpp
index d5cba9a7225..7db733c7f78 100644
--- a/src/server/scripts/World/npc_innkeeper.cpp
+++ b/src/server/scripts/World/npc_innkeeper.cpp
@@ -57,7 +57,7 @@ public:
{
if (IsHolidayActive(HOLIDAY_HALLOWS_END) && !player->HasAura(SPELL_TRICK_OR_TREATED))
{
- const char* localizedEntry;
+ char const* localizedEntry;
switch (player->GetSession()->GetSessionDbcLocale())
{
case LOCALE_frFR: localizedEntry = LOCALE_TRICK_OR_TREAT_2; break;
@@ -76,7 +76,7 @@ public:
if (me->IsInnkeeper())
{
- const char* localizedEntry;
+ char const* localizedEntry;
switch (player->GetSession()->GetSessionDbcLocale())
{
case LOCALE_deDE: localizedEntry = LOCALE_INNKEEPER_3; break;
diff --git a/src/server/scripts/World/npc_professions.cpp b/src/server/scripts/World/npc_professions.cpp
index bfc8f19add0..9f1df957784 100644
--- a/src/server/scripts/World/npc_professions.cpp
+++ b/src/server/scripts/World/npc_professions.cpp
@@ -24,11 +24,14 @@ SDCategory: NPCs/GOBs
EndScriptData */
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
#include "GameObjectAI.h"
+#include "Item.h"
+#include "Log.h"
#include "Player.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "SpellInfo.h"
+#include "SpellMgr.h"
#include "WorldSession.h"
/*
@@ -288,7 +291,7 @@ bool EquippedOk(Player* player, uint32 spellId)
if (!reqSpell)
continue;
- Item* item = NULL;
+ Item* item = nullptr;
for (uint8 j = EQUIPMENT_SLOT_START; j < EQUIPMENT_SLOT_END; ++j)
{
item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, j);
@@ -433,7 +436,7 @@ void ProcessUnlearnAction(Player* player, Creature* creature, uint32 spellId, ui
player->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, creature, 0, 0);
}
else
- player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, NULL, NULL);
+ player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, nullptr, nullptr);
CloseGossipMenuFor(player);
}
diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp
index 7a8b8e77e9a..8fc60e6ace7 100644
--- a/src/server/scripts/World/npcs_special.cpp
+++ b/src/server/scripts/World/npcs_special.cpp
@@ -17,26 +17,27 @@
*/
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
-#include "ScriptedEscortAI.h"
-#include "ObjectMgr.h"
-#include "ScriptMgr.h"
-#include "World.h"
-#include "PassiveAI.h"
+#include "CellImpl.h"
+#include "CombatAI.h"
+#include "CreatureTextMgr.h"
#include "GameEventMgr.h"
-#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
-#include "Cell.h"
-#include "CellImpl.h"
-#include "SpellHistory.h"
-#include "SpellAuras.h"
+#include "Log.h"
+#include "MotionMaster.h"
+#include "MoveSplineInit.h"
+#include "ObjectAccessor.h"
+#include "ObjectMgr.h"
+#include "PassiveAI.h"
#include "Pet.h"
-#include "CreatureTextMgr.h"
-#include "CombatAI.h"
+#include "ScriptedEscortAI.h"
+#include "ScriptedGossip.h"
+#include "ScriptMgr.h"
#include "SmartAI.h"
+#include "SpellAuras.h"
+#include "SpellHistory.h"
+#include "SpellMgr.h"
#include "Vehicle.h"
-#include "MoveSplineInit.h"
+#include "World.h"
/*########
# npc_air_force_bots
@@ -104,13 +105,13 @@ public:
{
npc_air_force_botsAI(Creature* creature) : ScriptedAI(creature)
{
- SpawnAssoc = NULL;
+ SpawnAssoc = nullptr;
SpawnedGUID.Clear();
// find the correct spawnhandling
- static uint32 entryCount = sizeof(spawnAssociations) / sizeof(SpawnAssociation);
+ static uint8 constexpr const EntryCount = uint8(std::extent<decltype(spawnAssociations)>::value);
- for (uint8 i = 0; i < entryCount; ++i)
+ for (uint8 i = 0; i < EntryCount; ++i)
{
if (spawnAssociations[i].thisCreatureEntry == creature->GetEntry())
{
@@ -128,7 +129,7 @@ public:
if (!spawnedTemplate)
{
TC_LOG_ERROR("sql.sql", "TCSR: Creature template entry %u does not exist in DB, which is required by npc_air_force_bots", SpawnAssoc->spawnedCreatureEntry);
- SpawnAssoc = NULL;
+ SpawnAssoc = nullptr;
return;
}
}
@@ -148,7 +149,7 @@ public:
else
{
TC_LOG_ERROR("sql.sql", "TCSR: npc_air_force_bots: wasn't able to spawn Creature %u", SpawnAssoc->spawnedCreatureEntry);
- SpawnAssoc = NULL;
+ SpawnAssoc = nullptr;
}
return summoned;
@@ -161,7 +162,7 @@ public:
if (creature && creature->IsAlive())
return creature;
- return NULL;
+ return nullptr;
}
void MoveInLineOfSight(Unit* who) override
@@ -177,7 +178,7 @@ public:
if (!playerTarget)
return;
- Creature* lastSpawnedGuard = SpawnedGUID.IsEmpty() ? NULL : GetSummonedGuard();
+ Creature* lastSpawnedGuard = SpawnedGUID.IsEmpty() ? nullptr : GetSummonedGuard();
// prevent calling Unit::GetUnit at next MoveInLineOfSight call - speedup
if (!lastSpawnedGuard)
@@ -846,7 +847,7 @@ public:
void Initialize()
{
DoctorGUID.Clear();
- Coord = NULL;
+ Coord = nullptr;
}
ObjectGuid DoctorGUID;
@@ -1810,7 +1811,7 @@ public:
void DamageTaken(Unit* doneBy, uint32& damage) override
{
me->AddThreat(doneBy, float(damage)); // just to create threat reference
- _damageTimes[doneBy->GetGUID()] = time(NULL);
+ _damageTimes[doneBy->GetGUID()] = time(nullptr);
damage = 0;
}
@@ -1830,7 +1831,7 @@ public:
{
case EVENT_TD_CHECK_COMBAT:
{
- time_t now = time(NULL);
+ time_t now = time(nullptr);
for (std::unordered_map<ObjectGuid, time_t>::iterator itr = _damageTimes.begin(); itr != _damageTimes.end();)
{
// If unit has not dealt damage to training dummy for 5 seconds, remove him from combat
@@ -2180,7 +2181,7 @@ public:
GameObject* FindNearestLauncher()
{
- GameObject* launcher = NULL;
+ GameObject* launcher = nullptr;
if (isCluster())
{
@@ -2295,7 +2296,7 @@ public:
break;
}
- const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(spellId);
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (spellInfo && spellInfo->Effects[0].Effect == SPELL_EFFECT_SUMMON_OBJECT_WILD)
return spellInfo->Effects[0].MiscValue;
@@ -2340,7 +2341,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);